Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Clang][Unittests] - Linker failure in clang unittests for Clang driver #109328

Open
bhandarkar-pranav opened this issue Sep 19, 2024 · 2 comments
Labels
build-problem clang Clang issues not falling into any other category

Comments

@bhandarkar-pranav
Copy link
Contributor

I am getting the following build error

FAILED: tools/clang/unittests/Driver/ClangDriverTests
: && /usr/bin/c++ -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG -Wl,--gc-sections tools/clang/unittests/Driver/CMakeFiles/ClangDriverTests.dir/DistroTest.cpp.o tools/clang/unittests/Driver/CMakeFiles/ClangDriverTests.dir/DXCModeTest.cpp.o tools/clang/unittests/Driver/CMakeFiles/ClangDriverTests.dir/GCCVersionTest.cpp.o tools/clang/unittests/Driver/CMakeFiles/ClangDriverTests.dir/ToolChainTest.cpp.o tools/clang/unittests/Driver/CMakeFiles/ClangDriverTests.dir/ModuleCacheTest.cpp.o tools/clang/unittests/Driver/CMakeFiles/ClangDriverTests.dir/MultilibBuilderTest.cpp.o tools/clang/unittests/Driver/CMakeFiles/ClangDriverTests.dir/MultilibTest.cpp.o tools/clang/unittests/Driver/CMakeFiles/ClangDriverTests.dir/SanitizerArgsTest.cpp.o -o tools/clang/unittests/Driver/ClangDriverTests  -Wl,-rpath,/home/prbhanda/git/bhandarkar-pranav/build/build-12Sep24/lib  lib/libLLVMX86CodeGen.so.20.0git  lib/libLLVMX86AsmParser.so.20.0git  lib/libLLVMX86Desc.so.20.0git  lib/libLLVMX86Disassembler.so.20.0git  lib/libLLVMX86Info.so.20.0git  lib/libLLVMAMDGPUCodeGen.so.20.0git  lib/libLLVMAMDGPUAsmParser.so.20.0git  lib/libLLVMAMDGPUDisassembler.so.20.0git  lib/libLLVMNVPTXCodeGen.so.20.0git  lib/libLLVMNVPTXDesc.so.20.0git  lib/libLLVMNVPTXInfo.so.20.0git  lib/libllvm_gtest_main.so.20.0git  lib/libllvm_gtest.so.20.0git  lib/libclangFrontend.so.20.0git  lib/libLLVMAMDGPUDesc.so.20.0git  lib/libLLVMAMDGPUInfo.so.20.0git  lib/libLLVMAMDGPUUtils.so.20.0git  lib/libclangDriver.so.20.0git  lib/libLLVMOption.so.20.0git  lib/libclangBasic.so.20.0git  lib/libLLVMMC.so.20.0git  lib/libLLVMTargetParser.so.20.0git  lib/libLLVMSupport.so.20.0git  -Wl,-rpath-link,/home/prbhanda/git/bhandarkar-pranav/build/build-12Sep24/lib && :
/usr/bin/ld: tools/clang/unittests/Driver/CMakeFiles/ClangDriverTests.dir/ToolChainTest.cpp.o: undefined reference to symbol '_ZN5clang22PCHContainerOperationsC1Ev'
/usr/bin/ld: /home/prbhanda/git/bhandarkar-pranav/build/build-12Sep24/lib/libclangSerialization.so.20.0git: error adding symbols: DSO missing from command line

I build with BUILD_SHARED_LIBS=ON. It started with this commit d1335fb

@github-actions github-actions bot added the clang Clang issues not falling into any other category label Sep 19, 2024
@bhandarkar-pranav
Copy link
Contributor Author

The following change fixes the problem for me.

diff --git a/clang/unittests/Driver/CMakeLists.txt b/clang/unittests/Driver/CMakeLists.txt
index 752037f78fb1..efdd07ea2388 100644
--- a/clang/unittests/Driver/CMakeLists.txt
+++ b/clang/unittests/Driver/CMakeLists.txt
@@ -22,4 +22,5 @@ clang_target_link_libraries(ClangDriverTests
   clangDriver
   clangBasic
   clangFrontend # For TextDiagnosticPrinter.
+  clangSerialization
   )

bhandarkar-pranav added a commit to bhandarkar-pranav/llvm-project that referenced this issue Sep 19, 2024
This PR is a fix for issue llvm#109328. libclangSerializaton.so is
needed for building clang driver unittests after
llvm#76838 was merged.
@shafik
Copy link
Collaborator

shafik commented Sep 19, 2024

CC @Prabhuk

bhandarkar-pranav added a commit that referenced this issue Sep 19, 2024
This PR is a fix for issue
[#109328](#109328).
libclangSerializaton.so is needed for building clang driver unittests
after
#76838 was merged. Needed for
builds with `BUILD_SHARED_LIBS=ON`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-problem clang Clang issues not falling into any other category
Projects
None yet
Development

No branches or pull requests

3 participants