Skip to content

Commit c6437d5

Browse files
Clang + libstdc++ binaries to use rpath (#632)
Binaries built with clang + libstdc++ from brew GCC didn't actually use same libstdc++ at runtime. Instead, they used system provided libstdc++. This change adds an rpath linker command to instruct ldd to load libstdc++.so.6 from the same brew GCC library dir that is used during linking.
1 parent 1071f8d commit c6437d5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

.github/files/CMakeUserPresets.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@
186186
"PRESET_CXX_FLAGS_LIBSTDCPP_FOR_CLANG_COMMON": "-stdlib++-isystem$penv{HOMEBREW_PREFIX}/opt/gcc@$penv{GCC_MAJOR_VERSION}/include/c++/$penv{GCC_MAJOR_VERSION}"
187187
},
188188
"cacheVariables": {
189-
"CMAKE_EXE_LINKER_FLAGS": "-stdlib=libstdc++ -L$penv{HOMEBREW_PREFIX}/opt/gcc@$penv{GCC_MAJOR_VERSION}/lib/gcc/$penv{GCC_MAJOR_VERSION}",
190-
"CMAKE_SHARED_LINKER_FLAGS": "-stdlib=libstdc++ -L$penv{HOMEBREW_PREFIX}/opt/gcc@$penv{GCC_MAJOR_VERSION}/lib/gcc/$penv{GCC_MAJOR_VERSION}",
189+
"CMAKE_EXE_LINKER_FLAGS": "-stdlib=libstdc++ -L$penv{HOMEBREW_PREFIX}/opt/gcc@$penv{GCC_MAJOR_VERSION}/lib/gcc/$penv{GCC_MAJOR_VERSION} -Wl,-rpath,$penv{HOMEBREW_PREFIX}/opt/gcc@$penv{GCC_MAJOR_VERSION}/lib/gcc/$penv{GCC_MAJOR_VERSION}",
190+
"CMAKE_SHARED_LINKER_FLAGS": "-stdlib=libstdc++ -L$penv{HOMEBREW_PREFIX}/opt/gcc@$penv{GCC_MAJOR_VERSION}/lib/gcc/$penv{GCC_MAJOR_VERSION} -Wl,-rpath,$penv{HOMEBREW_PREFIX}/opt/gcc@$penv{GCC_MAJOR_VERSION}/lib/gcc/$penv{GCC_MAJOR_VERSION}",
191191
"CONAN_HOST_PROFILE": "auto-cmake;${sourceDir}/conan-profile-gcc-libstd++-for-clang"
192192
}
193193
},

0 commit comments

Comments
 (0)