git: 9083fa424c08 - 2025Q1 - lang/ldc: fix build with LLVM_DEFAULT=19
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 31 Jan 2025 23:03:15 UTC
The branch 2025Q1 has been updated by dim: URL: https://cgit.FreeBSD.org/ports/commit/?id=9083fa424c08d775d58d62500ae7b04da34e0300 commit 9083fa424c08d775d58d62500ae7b04da34e0300 Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2025-01-25 16:45:16 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2025-01-31 23:02:34 +0000 lang/ldc: fix build with LLVM_DEFAULT=19 When building lang/ldc with LLVM_DEFAULT=19, linking ldc-profdata fails with: FAILED: bin/ldc-profdata : && /usr/local/llvm19/bin/clang++ -O2 -pipe -fPIC -fstack-protector-strong -fno-strict-aliasing -DDMDV2 -O2 -pipe -fPIC -fstack-protector-strong -fno-strict-aliasing -DNDEBUG -fstack-protector-strong -Xlinker --dependency-file=tools/CMakeFiles/ldc-profdata.dir/link.d tools/CMakeFiles/ldc-profdata.dir/ldc-profdata/llvm-profdata-19.1.cpp.o -o bin/ldc-profdata -lLLVM-19 -L/usr/local/llvm19/lib && : ld: error: undefined symbol: pthread_create >>> referenced by llvm-profdata-19.1.cpp >>> tools/CMakeFiles/ldc-profdata.dir/ldc-profdata/llvm-profdata-19.1.cpp.o:(std::__1::future<void> std::__1::__make_async_assoc_state[abi:sn190107]<void, std::__1::__async_func<std::__1::function<void ()>>>(std::__1::__async_func<std::__1::function<void ()>>&&)) clang++: error: linker command failed with exit code 1 (use -v to see invocation) This is because the link command line is missing -lpthread. For the tools/ subdirectory, use the CMAKE_THREAD_LIBS_INIT macro to fix the target_link_libraries() directive. PR: 284344 Approved by: acm (maintainer) MFH: 2025Q1 (cherry picked from commit c580801b319fde451d9e12648519ee83a5e64231) --- lang/ldc/files/patch-tools_CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lang/ldc/files/patch-tools_CMakeLists.txt b/lang/ldc/files/patch-tools_CMakeLists.txt new file mode 100644 index 000000000000..52ac65f48f9b --- /dev/null +++ b/lang/ldc/files/patch-tools_CMakeLists.txt @@ -0,0 +1,11 @@ +--- tools/CMakeLists.txt.orig 2024-12-15 13:48:09 UTC ++++ tools/CMakeLists.txt +@@ -37,7 +37,7 @@ if(LDC_BUNDLE_LLVM_TOOLS) + COMPILE_FLAGS "${LLVM_CXXFLAGS} ${LDC_CXXFLAGS}" + LINK_FLAGS "${SANITIZE_LDFLAGS}" + ) +- target_link_libraries(ldc-profdata ${LLVM_LIBRARIES} ${CMAKE_DL_LIBS} ${LLVM_LDFLAGS}) ++ target_link_libraries(ldc-profdata ${LLVM_LIBRARIES} ${CMAKE_DL_LIBS} ${LLVM_LDFLAGS} ${CMAKE_THREAD_LIBS_INIT}) + install(TARGETS ldc-profdata DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) + + # Set path to executable, used by the lit testsuite.