构建 Chromium (Ubuntu) - 链接器错误
Building Chromium (Ubuntu) - Linker Error
我正在尝试从头开始构建 Chromium Checking out and building Chromium on Linux。我正在使用具有 20GB RAM 和 150GB HDD 运行 干净 Ubuntu 16.04 LTS.
的虚拟机
我正在使用“-finstrument-functions”标志进行编译。
然而,当我尝试构建时,我收到一条有线错误消息(见下文)。对我来说,这看起来像是一个链接问题。但是我不知道怎么解决。
[21/33890] SOLINK ./libcommon.so
FAILED: libcommon.so libcommon.so.TOC
python "../../build/toolchain/gcc_solink_wrapper.py" --readelf="readelf" --nm="nm" --sofile="./libcommon.so" --tocfile="./libcommon.so.TOC" --output="./libcommon.so" -- ../../third_party/llvm-build/Release+Asserts/bin/clang++ -shared -Wl,--fatal-warnings -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--no-as-needed -lpthread -Wl,--as-needed -fuse-ld=lld -Wl,--icf=all -m64 -Werror -Wl,--gdb-index -nostdlib++ --sysroot=../../build/linux/debian_jessie_amd64-sysroot -L../../build/linux/debian_jessie_amd64-sysroot/lib/x86_64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_jessie_amd64-sysroot/lib/x86_64-linux-gnu -L../../build/linux/debian_jessie_amd64-sysroot/usr/lib/x86_64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_jessie_amd64-sysroot/usr/lib/x86_64-linux-gnu -o "./libcommon.so" -Wl,-soname="libcommon.so" @"./libcommon.so.rsp"
/home/chromtest/chromium/src/out/Default/../../third_party/llvm-build/Release+Asserts/bin/ld.lld: error: undefined symbol: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string()
>>> referenced by gcm_messages.cc
>>> obj/components/gcm_driver/common/common/gcm_messages.o:(gcm::OutgoingMessage::OutgoingMessage())
/home/chromtest/chromium/src/out/Default/../../third_party/llvm-build/Release+Asserts/bin/ld.lld: error: undefined symbol: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__zero()
>>> referenced by gcm_messages.cc
[... more lines ...]
/home/chromtest/chromium/src/out/Default/../../third_party/llvm-build/Release+Asserts/bin/ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[22/33890] CXX obj/components/keyed_service/core/core/dependency_graph.o
[23/33890] ACTION //components/resources:about_credits(//build/toolchain/linux:clang_x64)
ninja: build stopped: subcommand failed.
有专门的 Chrome clang 构建说明,您是否遵循了这些说明?
https://chromium.googlesource.com/chromium/src/+/master/docs/clang.md
这个 linking 错误表明代码无法 link 针对 C++ 运行时,对于 clang 通常是 libc++
(与 gcc 的 libstdc++
相反). Chrome 默认使用 clang,所以你应该安装一个有效的 clang/libc++ 工具链。
或者,您可以尝试使用 gcc 进行构建,如上文所述 link。
我使用这两个标志(如 mailing list 中所建议的那样)成功编译了 Chromium
use_lld = false
is_component_build = false
我正在尝试从头开始构建 Chromium Checking out and building Chromium on Linux。我正在使用具有 20GB RAM 和 150GB HDD 运行 干净 Ubuntu 16.04 LTS.
的虚拟机我正在使用“-finstrument-functions”标志进行编译。
然而,当我尝试构建时,我收到一条有线错误消息(见下文)。对我来说,这看起来像是一个链接问题。但是我不知道怎么解决。
[21/33890] SOLINK ./libcommon.so
FAILED: libcommon.so libcommon.so.TOC
python "../../build/toolchain/gcc_solink_wrapper.py" --readelf="readelf" --nm="nm" --sofile="./libcommon.so" --tocfile="./libcommon.so.TOC" --output="./libcommon.so" -- ../../third_party/llvm-build/Release+Asserts/bin/clang++ -shared -Wl,--fatal-warnings -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--no-as-needed -lpthread -Wl,--as-needed -fuse-ld=lld -Wl,--icf=all -m64 -Werror -Wl,--gdb-index -nostdlib++ --sysroot=../../build/linux/debian_jessie_amd64-sysroot -L../../build/linux/debian_jessie_amd64-sysroot/lib/x86_64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_jessie_amd64-sysroot/lib/x86_64-linux-gnu -L../../build/linux/debian_jessie_amd64-sysroot/usr/lib/x86_64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_jessie_amd64-sysroot/usr/lib/x86_64-linux-gnu -o "./libcommon.so" -Wl,-soname="libcommon.so" @"./libcommon.so.rsp"
/home/chromtest/chromium/src/out/Default/../../third_party/llvm-build/Release+Asserts/bin/ld.lld: error: undefined symbol: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string()
>>> referenced by gcm_messages.cc
>>> obj/components/gcm_driver/common/common/gcm_messages.o:(gcm::OutgoingMessage::OutgoingMessage())
/home/chromtest/chromium/src/out/Default/../../third_party/llvm-build/Release+Asserts/bin/ld.lld: error: undefined symbol: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__zero()
>>> referenced by gcm_messages.cc
[... more lines ...]
/home/chromtest/chromium/src/out/Default/../../third_party/llvm-build/Release+Asserts/bin/ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[22/33890] CXX obj/components/keyed_service/core/core/dependency_graph.o
[23/33890] ACTION //components/resources:about_credits(//build/toolchain/linux:clang_x64)
ninja: build stopped: subcommand failed.
有专门的 Chrome clang 构建说明,您是否遵循了这些说明?
https://chromium.googlesource.com/chromium/src/+/master/docs/clang.md
这个 linking 错误表明代码无法 link 针对 C++ 运行时,对于 clang 通常是 libc++
(与 gcc 的 libstdc++
相反). Chrome 默认使用 clang,所以你应该安装一个有效的 clang/libc++ 工具链。
或者,您可以尝试使用 gcc 进行构建,如上文所述 link。
我使用这两个标志(如 mailing list 中所建议的那样)成功编译了 Chromium
use_lld = false
is_component_build = false