-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Macos %apple-clang cannot handle -rpath when creating static library #45919
Copy link
Copy link
Closed
Labels
Description
Steps to reproduce
When creating a static library on macos using apple-clang, spack passes the entire -rpath to the linker. However apple-clang's ld cannot handle this:
ld: -rpath can only be used when creating a dynamic final linked image
And example of this behaviour is parallel-netcdf-1.12.3 where -rpath is passed to ld as it tries to create a static library:
[...]
/bin/sh ../../libtool --tag=CXX --mode=link /Users/cbm038/Documents/science/code/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/openmpi-5.0.5-fkibfdvo7p66dwxvqcbe6632slj6xucp/bin/mpic++ -fPIC -version-info 4:3:0 -o libpnetcdf.la -rpath /Users/cbm038/Documents/science/code/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/parallel-netcdf-1.12.3-hw6ygpgtgv54yngvev6hwm22xrm3xfyu/lib ../dispatchers/libdispatchers.la ../drivers/common/libcommon.la ../drivers/ncmpio/libncmpio.la ../binding/cxx/libcxx.la ../binding/f77/libf77.la ../binding/f90/libf90.la -L/Users/cbm038/Documents/science/code/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/openmpi-5.0.5-fkibfdvo7p66dwxvqcbe6632slj6xucp/lib -L/Users/cbm038/Documents/science/code/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/gcc-14.1.0-tqacx2dxx2udf7x7qaqyhjaoh35srnrh/bin/../lib/gcc/aarch64-apple-darwin23.6.0/14.1.0 -L/Users/cbm038/Documents/science/code/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/gcc-14.1.0-tqacx2dxx2udf7x7qaqyhjaoh35srnrh/bin/../lib/gcc -L/Users/cbm038/Documents/science/code/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/gcc-14.1.0-tqacx2dxx2udf7x7qaqyhjaoh35srnrh/bin/../lib/gcc/aarch64-apple-darwin23.6.0/14.1.0/../../.. -lemutls_w -lheapt_w -ld_classic -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi -lgfortran -lquadmath -L/Users/cbm038/Documents/science/code/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/openmpi-5.0.5-fkibfdvo7p66dwxvqcbe6632slj6xucp/lib -L/Users/cbm038/Documents/science/code/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/gcc-14.1.0-tqacx2dxx2udf7x7qaqyhjaoh35srnrh/bin/../lib/gcc/aarch64-apple-darwin23.6.0/14.1.0 -L/Users/cbm038/Documents/science/code/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/gcc-14.1.0-tqacx2dxx2udf7x7qaqyhjaoh35srnrh/bin/../lib/gcc -L/Users/cbm038/Documents/science/code/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/gcc-14.1.0-tqacx2dxx2udf7x7qaqyhjaoh35srnrh/bin/../lib/gcc/aarch64-apple-darwin23.6.0/14.1.0/../../.. -lemutls_w -lheapt_w -ld_classic -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi -lgfortran -lquadmath
libtool: link: /Users/cbm038/Documents/science/code/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/openmpi-5.0.5-fkibfdvo7p66dwxvqcbe6632slj6xucp/bin/mpic++ -r -keep_private_externs -nostdlib -o .libs/libpnetcdf.4.dylib-master.o -Wl,-force_load,../dispatchers/.libs/libdispatchers.a -Wl,-force_load,../drivers/common/.libs/libcommon.a -Wl,-force_load,../drivers/ncmpio/.libs/libncmpio.a -Wl,-force_load,../binding/cxx/.libs/libcxx.a -Wl,-force_load,../binding/f77/.libs/libf77.a -Wl,-force_load,../binding/f90/.libs/libf90.a
Error message
No response
Information on your system
spack debug report
* **Spack:** 0.23.0.dev0 (b623f58782c53bc465d14b84b44e91ffc2b872cd)
* **Python:** 3.9.6
[spack-build-out.txt](https://github.com/user-attachments/files/16716577/spack-build-out.txt)
* **Platform:** darwin-sonoma-m1
General information
- I have run
spack debug reportand reported the version of Spack/Python/Platform - I have searched the issues of this repo and believe this is not a duplicate
- I have run the failing commands in debug mode and reported the output
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done