cernlib: fix -fPIC flag for internal lapack, patch for modern gfortran - #5748
cernlib: fix -fPIC flag for internal lapack, patch for modern gfortran#5748nicolamori wants to merge 3 commits into
Conversation
Set the POSITION_INDEPENDENT_CODE flag to ON unconditionally for shared lib build and depending on CERNLIB_POSITION_INDEPENDENT_CODE for static lib build. This patch inverts the previous behavior and aligns the lapack build settings to those of the other sub-packages.
There was a problem hiding this comment.
Pull request overview
This PR adjusts how CERNLIB’s internal LAPACK targets set POSITION_INDEPENDENT_CODE so that shared libraries are always built with PIC and static libraries follow the CERNLIB_POSITION_INDEPENDENT_CODE setting, aligning LAPACK with the behavior of other CERNLIB subpackages.
Changes:
- Add a new Spack patch hook for CERNLIB
@2023:to correct LAPACK PIC handling. - Introduce
fix_lapack_pic_flag.patchto invert the PIC settings between static and shared LAPACK targets.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| repos/spack_repo/builtin/packages/cernlib/package.py | Adds application of a new patch for CERNLIB @2023: to fix LAPACK PIC behavior. |
| repos/spack_repo/builtin/packages/cernlib/fix_lapack_pic_flag.patch | Modifies LAPACK’s CMakeLists.txt to set PIC unconditionally for shared targets and conditionally for static targets. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Following the recommendations of the Copilot overview. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@andriish as you're the maintiner of this package, would you like to review this patch for cernlib 2023 and newer to patch |
The previous patch for GCC 16 is needed for any modern gfortran version, since the etime_ symbol seems to have been removed a long time ago given that it is not present in GCC 11. So patch unconditionally.
|
I stumbled upon and fixed another issue. The GCC16 patch introduced in PR 5675 turned out to be necessary also for GCC 11, so now it is applied unconditionally since it is probably needed for any modern GFortran version. I decided to add it to this PR to not open yet another one being this still open. Sorry for this continuous flow of patches but every time I think I fixed everything something new pops out. |
Set the POSITION_INDEPENDENT_CODE flag to ON unconditionally for shared lib build and depending on CERNLIB_POSITION_INDEPENDENT_CODE for static lib build. This patch inverts the previous behavior and aligns the lapack build settings to those of the other sub-packages.
I found this bug while compiling in an Almalinux 9 container with some external packages (perl, openssl, et al.). From CMakeLists inspection and comparison with other sub-packages (e.g.
packlib) it looks like an erroneous switch of the settings for static and shared libraries,