Bug 268985 - Mk/Features/pie.mk: fix Fortran ports when WITH_PIE is set (was: math/lapack)
Summary: Mk/Features/pie.mk: fix Fortran ports when WITH_PIE is set (was: math/lapack)
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Port Management Team
URL:
Keywords:
: 268984 (view as bug list)
Depends on:
Blocks: 278460
  Show dependency treegraph
 
Reported: 2023-01-16 11:56 UTC by Alexander Leidinger
Modified: 2024-06-03 06:40 UTC (History)
3 users (show)

See Also:
thierry: maintainer-feedback+


Attachments
Set FFLAGS when WITH_PIE is defined (1.35 KB, patch)
2023-01-16 20:41 UTC, Thierry Thomas
thierry: maintainer-approval? (portmgr)
Details | Diff
Set CMAKE_Fortran_FLAGS (1016 bytes, patch)
2023-01-16 20:43 UTC, Thierry Thomas
thierry: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Leidinger freebsd_committer freebsd_triage 2023-01-16 11:56:28 UTC
Hi,

building the port with WITH_PIE makes it fail (error message tells that ld can't relocate a specific symbol and that it should be recompiled with -fPIE). Until this is fixed, the port should get PIE_UNSAFE=yes in the Makefile (this fixes the build for me).

Bye,
Alexander.
Comment 1 Thierry Thomas freebsd_committer freebsd_triage 2023-01-16 20:36:22 UTC
*** Bug 268984 has been marked as a duplicate of this bug. ***
Comment 2 Thierry Thomas freebsd_committer freebsd_triage 2023-01-16 20:41:23 UTC
Created attachment 239510 [details]
Set FFLAGS when WITH_PIE is defined

The proposed patch sets FFLAGS when WITH_PIE is defined.
This fixes Fortran programs.
Comment 3 Thierry Thomas freebsd_committer freebsd_triage 2023-01-16 20:43:02 UTC
Created attachment 239511 [details]
Set CMAKE_Fortran_FLAGS

Set CMAKE_Fortran_FLAGS=${FFLAGS} for Fortran ports using cmake.
Comment 4 Thierry Thomas freebsd_committer freebsd_triage 2023-01-16 20:46:51 UTC
There are two different problems:

1) FFLAGS is not set when WITH_MPI is defined. The first patch fixes that.

2) Even when FFLAGS is set, it may be ignored by cmake if CMAKE_Fortran_FLAGS is not set. The second patch fixes that.

Remark: I modified Mk/Uses/fortran.mk for the cmake case, but we could
also modify Mk/Uses/cmake.mk for the Fortran case.

This should fix other Fortran ports, but it might also reveal brokenness in some other ports.
Comment 5 Thierry Thomas freebsd_committer freebsd_triage 2023-01-16 20:49:33 UTC
Assign to portmgr@FreeBSD.org who is handling Mk/Features/pie.mk.
Comment 6 Alexander Leidinger freebsd_committer freebsd_triage 2024-04-09 07:42:18 UTC
(In reply to Thierry Thomas from comment #4)

Hi Thierry you please look at Bug 268981 which has another cmake part for PIE stuff? How would this interact with your fortran patch?
Comment 7 Alexander Leidinger freebsd_committer freebsd_triage 2024-04-09 07:59:06 UTC
Bug 268981 has a different patch and I validated that math/lapack and math/blas finish a PIE-build in poudriere with the more generic cmake patch in that bug.

Thierry, can you please check if that other patch is ok for you instead of your patch? If yes, please close this bug as a duplicate of Bug 268981.
Comment 8 Alexander Leidinger freebsd_committer freebsd_triage 2024-06-03 06:39:48 UTC
I tested this with py-scipy. Without your patch it fails, with your patch it compiles (and seems to work, at least an application which has it as a dependency doesn't show direct failures).