Skip to content

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

Closed
@jmciver

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    build-problemcmakeBuild system in general and CMake in particular

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions