Skip to content

llvm/clang link to libc++ #7170

@oscarfv

Description

@oscarfv

After upgrading to LLVM/Clang 11 and rebuilding my projects, they failed with unresolved symbols like this:

C:/apps/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: plugins/llvm/CMakeFiles/lp0LLVM.dir/llvm.cpp.obj:llvm.cpp:(.text+0x9e73): undefined reference to `llvm::WriteBitcodeToFile(llvm::Module const&, llvm::raw_ostream&, bool, llvm::ModuleSummaryIndex const*, bool, std::array<unsigned int, 5u>*)'

The corresponding symbol exported from libLLVM.dll.a is:

llvm::WriteBitcodeToFile(llvm::Module const&, llvm::raw_ostream&, bool, llvm::ModuleSummaryIndex const*, bool, std::__1::array<unsigned int, 5ull>*)

Note the __1:: postfix to std::. This hinted that the problem is that libLLVM.dll is linked to libc++.dll. Sure enough, after the build script was modified to use libc++, it succeeded.

This is the scenario where we are now (and please correct me if I'm wrong):

  1. g++ can't use the LLVM libraries.
  2. clang++ can link to the LLVM libraries if libc++ is used, but then using every other C++ library we distribute is problematic.

Was the transition to libc++ made taking into account those factors? And what do we gain with the move?

@mati865

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions