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

[pseudo] clangPseudoCXX link time error due to missing symbol in Debug build #55935

Closed
jmciver opened this issue Jun 8, 2022 · 2 comments
Closed
Labels
build-problem cmake Build system in general and CMake in particular

Comments

@jmciver
Copy link
Contributor

jmciver commented Jun 8, 2022

I am seeing the following link time error when building in Debug mode on main in the clang pseudoparser:

[1/4] Linking CXX shared library lib/libclangPseudoCXX.so.15git
FAILED: lib/libclangPseudoCXX.so.15git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wmisleading-indentation -fdiagnostics-color -fno-common -Woverloaded-virtual -fno-strict-aliasing -g  -Wl,-z,defs -Wl,-z,nodelete -fuse-ld=gold -shared -Wl,-soname,libclangPseudoCXX.so.15git -o lib/libclangPseudoCXX.so.15git tools/clang/tools/extra/pseudo/lib/cxx/CMakeFiles/obj.clangPseudoCXX.dir/CXX.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib"  lib/libclangPseudoGrammar.so.15git  -Wl,-rpath-link,/work/jmciver/llvmLatest/build/Debug/lib && :
tools/clang/tools/extra/pseudo/lib/cxx/CMakeFiles/obj.clangPseudoCXX.dir/CXX.cpp.o:CXX.cpp:llvm::VerifyEnableABIBreakingChecks: error: undefined reference to 'llvm::EnableABIBreakingChecks'
collect2: error: ld returned 1 exit status

The following CMake options are being used to build:

cmake \
  -GNinja \
  -DCMAKE_BUILD_TYPE=Debug \
  -DLLVM_USE_LINKER=gold \
  -DLLVM_ENABLE_PROJECTS="clang;llvm;clang-tools-extra" \
  -DLLVM_TARGETS_TO_BUILD=X86 \
  -DBUILD_SHARED_LIBS=ON ../../llvm-project/llvm

The link error in Debug mode is due to an undefined reference to llvm::EnableABIBreakingChecks, which is defined in the LLVMSupport library. Adding this library to the clangPseudoCXX target link libraries resolves the issue. Release mode does not have this issue as ABI breaking checks are not enabled by default. The link time dependency was created sometime after commit d4609ae.

I have provided a possible patch here: https://reviews.llvm.org/D127271

@jmciver
Copy link
Contributor Author

jmciver commented Jun 8, 2022

I can take ownership of this ticket.

@MaskRay
Copy link
Member

MaskRay commented Jun 9, 2022

Fixed by dd2f290

@MaskRay MaskRay closed this as completed Jun 9, 2022
@EugeneZelenko EugeneZelenko added the cmake Build system in general and CMake in particular label Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-problem cmake Build system in general and CMake in particular
Projects
None yet
Development

No branches or pull requests

3 participants