Linking error on WSL Ubuntu
EtoDemerzel0427 opened this issue ยท 10 comments
Thought it might be more appropriate to raise this in a separate issue. As you indicated previously, performance on Apple Silicon might not reflect the real performance considering the lack of AVX etc., so I am building mutable on my PC now. It is an Ubuntu 20.04 (in WSL), with LLVM-19.
I am building with libc++
and lld
, other configurations are the same as the build/debug_shared
settings in the setup document.
Shell output
[19/23] Linking CXX executable bin/parse
FAILED: bin/parse
: && /usr/bin/clang++ -g -stdlib=libc++ -lc++abi -fuse-ld=lld -fsanitize=address -fsanitize=undefined -fno-sanitize=vptr -fsanitize-link-c++-runtime src/CMakeFiles/parse-bin.dir/parse.cpp.o -o bin/parse -L/home/wrhuang/codespace/adv-query-opt/mutable/build/debug_shared/third-party/src/Boost/stage/lib -L/home/wrhuang/codespace/adv-query-opt/mutable/build/debug_shared/third-party/src/Replxx-build -L/home/wrhuang/codespace/adv-query-opt/mutable/build/debug_shared/third-party/src/Binaryen-build/lib -L/home/wrhuang/codespace/adv-query-opt/mutable/build/debug_shared/third-party/src/V8-build/out -L/home/wrhuang/codespace/adv-query-opt/mutable/build/debug_shared/lib -Wl,-rpath,/home/wrhuang/codespace/adv-query-opt/mutable/build/debug_shared/third-party/src/Boost/stage/lib:/home/wrhuang/codespace/adv-query-opt/mutable/build/debug_shared/third-party/src/Replxx-build:/home/wrhuang/codespace/adv-query-opt/mutable/build/debug_shared/third-party/src/Binaryen-build/lib:/home/wrhuang/codespace/adv-query-opt/mutable/build/debug_shared/third-party/src/V8-build/out:/home/wrhuang/codespace/adv-query-opt/mutable/build/debug_shared/lib lib/libmutable.so -lv8 -lv8_libplatform -lbinaryen third-party/src/Boost/stage/lib/libboost_system.so third-party/src/Boost/stage/lib/libboost_container.so -ldl && :
ld.lld: error: undefined reference: v8::platform::NewDefaultPlatform(int, v8::platform::IdleTaskSupport, v8::platform::InProcessStackDumping, std::__1::unique_ptr<v8::TracingController, std::__1::default_delete<v8::TracingController>>)
>>> referenced by lib/libmutable.so (disallowed by --no-allow-shlib-undefined)
ld.lld: error: undefined reference: v8::ArrayBuffer::New(v8::Isolate*, std::__1::shared_ptr<v8::BackingStore>)
>>> referenced by lib/libmutable.so (disallowed by --no-allow-shlib-undefined)
ld.lld: error: undefined reference: wasm::Module::addGlobal(std::__1::unique_ptr<wasm::Global, std::__1::default_delete<wasm::Global>>&&)
>>> referenced by lib/libmutable.so (disallowed by --no-allow-shlib-undefined)
ld.lld: error: undefined reference: wasm::Module::addFunction(std::__1::unique_ptr<wasm::Function, std::__1::default_delete<wasm::Function>>&&)
>>> referenced by lib/libmutable.so (disallowed by --no-allow-shlib-undefined)
ld.lld: error: undefined reference: wasm::IString::interned(std::__1::basic_string_view<char, std::__1::char_traits<char>>, bool)
>>> referenced by lib/libmutable.so (disallowed by --no-allow-shlib-undefined)
ld.lld: error: undefined reference: wasm::ExpressionManipulator::flexibleCopy(wasm::Expression*, wasm::Module&, std::__1::function<wasm::Expression* (wasm::Expression*)>)
>>> referenced by lib/libmutable.so (disallowed by --no-allow-shlib-undefined)
ld.lld: error: undefined reference: wasm::Module::addExport(std::__1::unique_ptr<wasm::Export, std::__1::default_delete<wasm::Export>>&&)
>>> referenced by lib/libmutable.so (disallowed by --no-allow-shlib-undefined)
ld.lld: error: undefined reference: std::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char>>&, wasm::Module&)
>>> referenced by lib/libmutable.so (disallowed by --no-allow-shlib-undefined)
ld.lld: error: undefined reference: wasm::Module::addMemory(std::__1::unique_ptr<wasm::Memory, std::__1::default_delete<wasm::Memory>>&&)
>>> referenced by lib/libmutable.so (disallowed by --no-allow-shlib-undefined)
ld.lld: error: undefined reference: wasm::Literal::Literal(std::__1::array<wasm::Literal, 16ul> const&)
>>> referenced by lib/libmutable.so (disallowed by --no-allow-shlib-undefined)
ld.lld: error: undefined reference: wasm::Literal::Literal(std::__1::array<wasm::Literal, 2ul> const&)
>>> referenced by lib/libmutable.so (disallowed by --no-allow-shlib-undefined)
ld.lld: error: undefined reference: wasm::Literal::Literal(std::__1::array<wasm::Literal, 8ul> const&)
>>> referenced by lib/libmutable.so (disallowed by --no-allow-shlib-undefined)
ld.lld: error: undefined reference: wasm::Literal::Literal(std::__1::array<wasm::Literal, 4ul> const&)
>>> referenced by lib/libmutable.so (disallowed by --no-allow-shlib-undefined)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[20/23] Linking CXX executable bin/lex
FAILED: bin/lex
....
Sorry for so many environment setup problems on different platforms :(
No worries, we'll get you there ;)
We don't have the resources to test on many different platforms. So sorry for you being our Ubuntu test infra for now.
Can you please share the output of
$ echo | clang -v -x c++ -std=c++20 -o -
$ ld.lld --version
$ whereis gn # or `which gn` or `where gn` or whatever your shell supports
$ whereis fetch
This will help us diagnose the problem. Thanks
Hi, the outputs are as below:
$ echo | clang -v -x c++ -std=c++20 -o -
Ubuntu clang version 19.0.0 (++20240228052953+b6f4dd9ee8cd-1~exp1~20240228173104.946)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/10
Candidate multilib: .;@m64
Selected multilib: .;@m64
Found CUDA installation: /usr/local/cuda-12.1, version 12.1
$ ld.lld --version
ld.lld --version
Ubuntu LLD 19.0.0 (compatible with GNU linkers)
$ which gn
/usr/local/bin/gn
$which fetch
/home/wrhuang/codespace/depot_tools/fetch
Yes, I saw that doc, but is there a specific reason that I should build clang from source? I installed LLVM via apt
.
What's LLVM/Clang at version "Ubuntu clang version 19.0.0"? ๐
The most recent release according to llvm.org is 17.0.6: https://releases.llvm.org/
Ubuntu is usually super far behind on releases. Like... years behind. That's why I can only suggest you build a recent compiler release. We rely on proper C++20 support, with an emphasis on proper ;)
Same goes for ld.lld
.
gn
and depot_tools
are looking good. Sadly, that doesn't mean anything. Google tooling can be extremely flaky, failing for the weirdest reasons (rising tide, leap year, who knows...)
EDIT: Oh, so there's this: https://apt.llvm.org/ . So you have Clang nightly?
Yes, I actually wasn't aware that was nightly. I simply did:
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal main"
and then installed llvm
without specifying its version and it installed 19 automatically ๐. I didn't know it was nightly.
I would try stable version first to see if anything changed.
Hey @EtoDemerzel0427, any progress?
Hi @ImmanuelHaffner thanks for checking! I was distracted by other issues this week, so haven't yet. I may come back to this early next week.
Any progress?
I am not actively trying to fix this issue at this moment: we decided to prototype on Mac first and then move to other platforms. I do think it shouldn't be hard to fix. So I am closing this issue for now.
All right. Thanks for letting us know. Please don't refrain from reopening this issue or filing a new one when you want to revisit this. We are here to help :)