Bug 268985

Summary: Mk/Features/pie.mk: fix Fortran ports when WITH_PIE is set (was: math/lapack)
Product: Ports & Packages Reporter: Alexander Leidinger <netchild>
Component: Individual Port(s)Assignee: Port Management Team <portmgr>
Status: In Progress ---    
Severity: Affects Some People CC: emaste, portmgr, thierry
Priority: --- Flags: thierry: maintainer-feedback+
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 278460    
Attachments:
Description Flags
Set FFLAGS when WITH_PIE is defined
thierry: maintainer-approval? (portmgr)
Set CMAKE_Fortran_FLAGS thierry: maintainer-approval+

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).