From 7e020882cbe1c75e172787d490c100f42c469859 Mon Sep 17 00:00:00 2001 From: Joris Vaillant Date: Fri, 25 Oct 2024 14:50:30 +0200 Subject: [PATCH] pixi: Improve LDFLAGS definition --- scripts/activation.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/activation.sh b/scripts/activation.sh index 52aad22cb..e05a3dbd5 100644 --- a/scripts/activation.sh +++ b/scripts/activation.sh @@ -10,9 +10,19 @@ unset DEBUG_CPPFLAGS unset DEBUG_CXXFLAGS unset LDFLAGS -# On OSX it's really important to setup these linker path or the linker -# will use the system libc++ that can be incompatible with our dependencies -export LDFLAGS="-Wl,-rpath,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib" +export &> /tmp/a + +if [[ $host_alias == *"apple"* ]]; +then + # On OSX setting the rpath and -L it's important to use the conda libc++ instead of the system one. + # If conda-forge use install_name_tool to package some libs, -headerpad_max_install_names is then mandatory + export LDFLAGS="-Wl,-headerpad_max_install_names -Wl,-rpath,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib" +elif [[ $host_alias == *"linux"* ]]; +then + # On GNU/Linux, I don't know if these flags are mandatory with g++ but + # it allow to use clang++ as compiler + export LDFLAGS="-Wl,-rpath,$CONDA_PREFIX/lib -Wl,-rpath-link,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib" +fi # Setup ccache export CMAKE_CXX_COMPILER_LAUNCHER=ccache