I'm trying to build a parallel version of Mesa (v21.3.0) in my /home with Clang and libc++ against my own LLVM13, libva and libvdpau but the build always fails when linking. This is the output produced:
[2/809] Linking target src/gallium/drivers/llvmpipe/lp_test_format
FAILED: src/gallium/drivers/llvmpipe/lp_test_format
/home/etna/Runtime/BuildSystem/LLVM13WithWASM/bin/clang++ -stdlib=libc++ -o src/gallium/drivers/llvmpipe/lp_test_format src/gallium/drivers/llvmpipe/lp_test_format.p/lp_test_format.c.o src/gallium/drivers/llvmpipe/lp_test_format.p/lp_test_main.c.o -L/home/etna/Runtime/MesaWithDecodeAccel/lib -L/home/etna/Runtime/MesaWithDecodeAccel/lib64 -L/home/etna/Runtime/MesaWithDecodeAccel/lib/x86_64-linux-gnu -L/home/etna/Runtime/MesaWithDecodeAccel/lib/x86_64-linux-gnu/vdpau -L/home/etna/Runtime/Deps/python-3.10.0/lib -L/home/etna/Runtime/Deps/python-3.10.0/lib64 -L/home/etna/Runtime/BuildSystem/LLVM13WithWASM/lib -I/home/etna/Runtime/MesaWithDecodeAccel/include -I/home/etna/Runtime/Deps/python-3.10.0/include -I/home/etna/Runtime/BuildSystem/LLVM13WithWASM/include -Wl,--as-needed -Wl,--no-undefined -Wl,-rpath -Wl,/home/etna/Runtime/MesaWithDecodeAccel/lib -Wl,-rpath -Wl,/home/etna/Runtime/MesaWithDecodeAccel/lib64 -Wl,-rpath -Wl,/home/etna/Runtime/MesaWithDecodeAccel/lib/x86_64-linux-gnu -Wl,-rpath -Wl,/home/etna/Runtime/MesaWithDecodeAccel/lib/x86_64-linux-gnu/vdpau -Wl,-rpath -Wl,/home/etna/Runtime/Deps/python-3.10.0/lib -Wl,-rpath -Wl,/home/etna/Runtime/Deps/python-3.10.0/lib64 -Wl,-rpath -Wl,/home/etna/Runtime/BuildSystem/LLVM13WithWASM/lib -fPIC -stdlib=libc++ -Wl,--start-group src/gallium/drivers/llvmpipe/libllvmpipe.a src/util/libmesa_util.a src/util/format/libmesa_format.a src/gallium/auxiliary/libgallium.a src/compiler/nir/libnir.a src/compiler/libcompiler.a -lLLVM-13 -pthread -ldl /usr/lib/x86_64-linux-gnu/libz.so -lm -lLLVM-13 /usr/lib/x86_64-linux-gnu/libdrm.so -lLLVM-13 -Wl,--end-group
ld: error: undefined symbol: llvm::EngineBuilder::EngineBuilder(std::__1::unique_ptr<llvm::Module, std::__1::default_delete<llvm::Module> >)
>>> referenced by lp_bld_misc.cpp
>>> gallivm_lp_bld_misc.cpp.o:(lp_build_create_jit_compiler_for_module) in archive src/gallium/auxiliary/libgallium.a
ld: error: undefined symbol: llvm::EngineBuilder::setMCJITMemoryManager(std::__1::unique_ptr<llvm::RTDyldMemoryManager, std::__1::default_delete<llvm::RTDyldMemoryManager> >)
>>> referenced by lp_bld_misc.cpp
>>> gallivm_lp_bld_misc.cpp.o:(lp_build_create_jit_compiler_for_module) in archive src/gallium/auxiliary/libgallium.a
ld: error: undefined symbol: llvm::RTDyldMemoryManager::getSymbolAddressInProcess(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
>>> referenced by lp_bld_misc.cpp
>>> gallivm_lp_bld_misc.cpp.o:(llvm::RTDyldMemoryManager::getSymbolAddress(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)) in archive src/gallium/auxiliary/libgallium.a
ld: error: undefined symbol: llvm::LegacyJITSymbolResolver::lookup(std::__1::set<llvm::StringRef, std::__1::less<llvm::StringRef>, std::__1::allocator<llvm::StringRef> > const&, llvm::unique_function<void (llvm::Expected<std::__1::map<llvm::StringRef, llvm::JITEvaluatedSymbol, std::__1::less<llvm::StringRef>, std::__1::allocator<std::__1::pair<llvm::StringRef const, llvm::JITEvaluatedSymbol> > > >)>)
>>> referenced by lp_bld_misc.cpp
>>> gallivm_lp_bld_misc.cpp.o:(vtable for ShaderMemoryManager) in archive src/gallium/auxiliary/libgallium.a
>>> referenced by lp_bld_misc.cpp
>>> gallivm_lp_bld_misc.cpp.o:(vtable for DelegatingJITMemoryManager) in archive src/gallium/auxiliary/libgallium.a
ld: error: undefined symbol: llvm::LegacyJITSymbolResolver::getResponsibilitySet(std::__1::set<llvm::StringRef, std::__1::less<llvm::StringRef>, std::__1::allocator<llvm::StringRef> > const&)
>>> referenced by lp_bld_misc.cpp
>>> gallivm_lp_bld_misc.cpp.o:(vtable for ShaderMemoryManager) in archive src/gallium/auxiliary/libgallium.a
>>> referenced by lp_bld_misc.cpp
>>> gallivm_lp_bld_misc.cpp.o:(vtable for DelegatingJITMemoryManager) in archive src/gallium/auxiliary/libgallium.a
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
[5/809] Compiling C object src/gallium/winsys/radeon/drm/libradeonwinsys.a.p/radeon_drm_bo.c.o
ninja: build stopped: subcommand failed.
If I build against libstdc++ (i.e.: without the -stdlib=libc++ -lc++ -lc++abi flags) the errors do not happen. So it seems that the issue lies with LLVM or libc++ somewhere. Can anyone help?
The build flags are
LIBRARY_PATH=/home/etna/Runtime/MesaWithDecodeAccel/lib:/home/etna/Runtime/MesaWithDecodeAccel/lib64:/home/etna/Runtime/MesaWithDecodeAccel/lib/x86_64-linux-gnu:/home/etna/Runtime/MesaWithDecodeAccel/lib/x86_64-linux-gnu/vdpau:/home/etna/Runtime/Deps/python-3.10.0/lib:/home/etna/Runtime/Deps/python-3.10.0/lib64:/home/etna/Runtime/BuildSystem/LLVM13WithWASM/lib:$LIBRARY_PATH C_INCLUDE_PATH=/home/etna/Runtime/MesaWithDecodeAccel/include:/home/etna/Runtime/Deps/python-3.10.0/include:/home/etna/Runtime/BuildSystem/LLVM13WithWASM/include:$C_INCLUDE_PATH CPLUS_INCLUDE_PATH=/home/etna/Runtime/MesaWithDecodeAccel/include:/home/etna/Runtime/Deps/python-3.10.0/include:/home/etna/Runtime/BuildSystem/LLVM13WithWASM/include:$CPLUS_INCLUDE_PATH LD_LIBRARY_PATH=/home/etna/Runtime/MesaWithDecodeAccel/lib:/home/etna/Runtime/MesaWithDecodeAccel/lib64:/home/etna/Runtime/MesaWithDecodeAccel/lib/x86_64-linux-gnu:/home/etna/Runtime/MesaWithDecodeAccel/lib/x86_64-linux-gnu/vdpau:/home/etna/Runtime/Deps/python-3.10.0/lib:/home/etna/Runtime/Deps/python-3.10.0/lib64:/home/etna/Runtime/BuildSystem/LLVM13WithWASM/lib:$LD_LIBRARY_PATH PATH=/home/etna/Runtime/MesaWithDecodeAccel/bin:/home/etna/Runtime/MesaWithDecodeAccel/sbin:/home/etna/Runtime/MesaWithDecodeAccel/libexec:/home/etna/Runtime/Deps/python-3.10.0/bin:/home/etna/Runtime/Deps/FlexBison-Build25Jul2021/bin:/home/etna/Runtime/Deps/NasmYasm/bin:/home/etna/Runtime/Deps/gperf-3.1/bin:/home/etna/Runtime/BuildSystem/LLVM13WithWASM/bin:/home/etna/Runtime/BuildSystem/LLVM13WithWASM/libexec:$PATH PKG_CONFIG_PATH=/home/etna/Runtime/MesaWithDecodeAccel/lib/pkgconfig:/home/etna/Runtime/MesaWithDecodeAccel/lib64/pkgconfig:/home/etna/Runtime/MesaWithDecodeAccel/lib/x86_64-linux-gnu/pkgconfig:/home/etna/Runtime/Deps/python-3.10.0/lib/pkgconfig:/home/etna/Runtime/Deps/python-3.10.0/lib64/pkgconfig:/home/etna/Runtime/BuildSystem/LLVM13WithWASM/lib/pkgconfig:$PKG_CONFIG_PATH LDFLAGS='-L/home/etna/Runtime/MesaWithDecodeAccel/lib -L/home/etna/Runtime/MesaWithDecodeAccel/lib64 -L/home/etna/Runtime/MesaWithDecodeAccel/lib/x86_64-linux-gnu -L/home/etna/Runtime/MesaWithDecodeAccel/lib/x86_64-linux-gnu/vdpau -L/home/etna/Runtime/Deps/python-3.10.0/lib -L/home/etna/Runtime/Deps/python-3.10.0/lib64 -L/home/etna/Runtime/BuildSystem/LLVM13WithWASM/lib' CPPFLAGS='-I/home/etna/Runtime/MesaWithDecodeAccel/include -I/home/etna/Runtime/Deps/python-3.10.0/include -I/home/etna/Runtime/BuildSystem/LLVM13WithWASM/include' CC=/home/etna/Runtime/BuildSystem/LLVM13WithWASM/bin/clang CXX="/home/etna/Runtime/BuildSystem/LLVM13WithWASM/bin/clang++ -stdlib=libc++ -lc++ -lc++abi" CFLAGS='-L/home/etna/Runtime/MesaWithDecodeAccel/lib -L/home/etna/Runtime/MesaWithDecodeAccel/lib64 -L/home/etna/Runtime/MesaWithDecodeAccel/lib/x86_64-linux-gnu -L/home/etna/Runtime/MesaWithDecodeAccel/lib/x86_64-linux-gnu/vdpau -L/home/etna/Runtime/Deps/python-3.10.0/lib -L/home/etna/Runtime/Deps/python-3.10.0/lib64 -L/home/etna/Runtime/BuildSystem/LLVM13WithWASM/lib -I/home/etna/Runtime/MesaWithDecodeAccel/include -I/home/etna/Runtime/Deps/python-3.10.0/include -I/home/etna/Runtime/BuildSystem/LLVM13WithWASM/include -Wl,-rpath -Wl,/home/etna/Runtime/MesaWithDecodeAccel/lib -Wl,-rpath -Wl,/home/etna/Runtime/MesaWithDecodeAccel/lib64 -Wl,-rpath -Wl,/home/etna/Runtime/MesaWithDecodeAccel/lib/x86_64-linux-gnu -Wl,-rpath -Wl,/home/etna/Runtime/MesaWithDecodeAccel/lib/x86_64-linux-gnu/vdpau -Wl,-rpath -Wl,/home/etna/Runtime/Deps/python-3.10.0/lib -Wl,-rpath -Wl,/home/etna/Runtime/Deps/python-3.10.0/lib64 -Wl,-rpath -Wl,/home/etna/Runtime/BuildSystem/LLVM13WithWASM/lib -fPIC' CXXFLAGS='-L/home/etna/Runtime/MesaWithDecodeAccel/lib -L/home/etna/Runtime/MesaWithDecodeAccel/lib64 -L/home/etna/Runtime/MesaWithDecodeAccel/lib/x86_64-linux-gnu -L/home/etna/Runtime/MesaWithDecodeAccel/lib/x86_64-linux-gnu/vdpau -L/home/etna/Runtime/Deps/python-3.10.0/lib -L/home/etna/Runtime/Deps/python-3.10.0/lib64 -L/home/etna/Runtime/BuildSystem/LLVM13WithWASM/lib -I/home/etna/Runtime/MesaWithDecodeAccel/include -I/home/etna/Runtime/Deps/python-3.10.0/include -I/home/etna/Runtime/BuildSystem/LLVM13WithWASM/include -Wl,-rpath -Wl,/home/etna/Runtime/MesaWithDecodeAccel/lib -Wl,-rpath -Wl,/home/etna/Runtime/MesaWithDecodeAccel/lib64 -Wl,-rpath -Wl,/home/etna/Runtime/MesaWithDecodeAccel/lib/x86_64-linux-gnu -Wl,-rpath -Wl,/home/etna/Runtime/MesaWithDecodeAccel/lib/x86_64-linux-gnu/vdpau -Wl,-rpath -Wl,/home/etna/Runtime/Deps/python-3.10.0/lib -Wl,-rpath -Wl,/home/etna/Runtime/Deps/python-3.10.0/lib64 -Wl,-rpath -Wl,/home/etna/Runtime/BuildSystem/LLVM13WithWASM/lib -fPIC -stdlib=libc++ -lc++ -lc++abi' meson .. --wrap-mode=nodownload --buildtype=plain --prefix=/home/etna/Runtime/MesaWithDecodeAccel -Ddri-drivers='' -Dvulkan-drivers='amd','swrast','intel' -Dglvnd=true -Dshared-glapi=enabled -Dgallium-xvmc=disabled -Dgallium-omx=disabled -Db_ndebug=true -Dbuild-tests=true -Dglx-direct=true -Dgbm=enabled -Ddri3=enabled "-Dplatforms=x11 ,wayland" -Dgallium-extra-hud=true -Dgallium-vdpau=enabled -Dgallium-xa=enabled -Dllvm=enabled -Dgallium-nine=true -Dgallium-va=enabled -Dgallium-drivers='swrast','r300','r600','nouveau','virgl','svga','iris','radeonsi','zink','crocus' -Dgles1=disabled -Dgles2=enabled -Dosmesa=true -Dvalgrind=enabled -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true