【问题标题】:/usr/bin/ld: /usr/include/c++/8/bits/stl_construct.h:107: undefined reference to ***/usr/bin/ld: /usr/include/c++/8/bits/stl_construct.h:107: 未定义对 *** 的引用
【发布时间】:2021-10-04 09:35:40
【问题描述】:

在我的 Raspberry Pi 4B 上为 NGINX QUIC 编译 Google 的 BoringSSL 时遇到错误,其中运行的是 Raspberry Pi OS,又名 Raspbian buster。

我用来编译的命令

正如Google's document 所说,我使用了这些命令:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make

我也尝试过运行 cmake 而不通过 -DCMAKE_BUILD_TYPE=Release

错误输出

这是错误消息的一部分。我没有显示整个输出,因为它太长了(有 352 行)。告诉我是否需要整个输出来解决这个问题。

[ 75%] Linking CXX executable crypto_test
/usr/bin/ld: CMakeFiles/crypto_test.dir/abi_self_test.cc.o: in function `ABITest_SanityCheck_Test::TestBody()':
/usr/include/c++/8/bits/unique_ptr.h:81: undefined reference to `abi_test_trampoline'
/usr/bin/ld: CMakeFiles/crypto_test.dir/abi_self_test.cc.o: in function `ABITest_ARM_Test::TestBody()':
/usr/include/c++/8/bits/stl_construct.h:107: undefined reference to `abi_test_clobber_r4'
/usr/bin/ld: /usr/include/c++/8/bits/stl_construct.h:107: undefined reference to `abi_test_trampoline'
/usr/bin/ld: /usr/include/c++/8/bits/stl_construct.h:107: undefined reference to `abi_test_clobber_r0'
/usr/bin/ld: /usr/include/c++/8/bits/stl_construct.h:107: undefined reference to `abi_test_clobber_r1'
/usr/bin/ld: /usr/include/c++/8/bits/stl_construct.h:107: undefined reference to `abi_test_clobber_r2'

......

附加信息

cmake version 3.16.3
GNU Make 4.2.1

$ uname -a
Linux Kaibins-RPi 5.10.52-v8+ #1439 SMP PREEMPT Thu Jul 22 15:43:49 BST 2021 aarch64 GNU/Linux

搜索了谷歌,但我找不到任何类似的案例。我需要帮助。非常感谢。

这个问题也可以在 Chromium bug tracker 中找到:https://crbug.com/boringssl/422。您可以在附件中找到完整的错误输出。

【问题讨论】:

  • 他们的错误跟踪器是here
  • 我相信错误来自 STL 标头的事实是一个红鲱鱼。真正的问题是没有定义与 std::unique_ptr 一起使用的 abi_test_trampoline 类/结构。这是您尝试编译的代码或其配置中的问题,或类似问题。

标签: linux cmake g++ gnu-make boringssl


【解决方案1】:

有一个boringssl package for OpenWrt 支持 BCM2711 板(Raspberry Pi 4B 正在使用的板)。甚至还有一个draft PR to package nginx with QUIC support。所以,原则上,BoringSSL 和 nginx-quic 在这个架构上工作。 OpenWrt 中使用的 BoringSSL 版本来自June 2021

我还在 Raspberry Pi OS 上编译了 BoringSSL,没有任何问题。这些是我记录在 Debian 上编译的步骤,根据我的记忆,在 Raspberry Pi OS 上也是如此:

sudo apt install cmake libpcre3-dev golang mercurial
git clone https://boringssl.googlesource.com/boringssl && cd boringssl
mkdir build && cd build
cmake ..
make -j16
cd ../..
hg clone -b quic https://hg.nginx.org/nginx-quic && cd nginx-quic
./auto/configure --with-debug --with-http_v3_module --with-cc-opt="-I../boringssl/include" --with-ld-opt="-L../boringssl/build/ssl -L../boringssl/build/crypto"
make -j16
sudo cp objs/nginx /usr/bin/nginx-quic

如果我有时间,我可以尝试使用更新的版本再次验证。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-05-07
    • 2014-10-19
    • 2012-04-10
    • 1970-01-01
    • 2011-07-16
    • 2012-05-17
    • 2020-04-14
    • 2012-06-20
    相关资源
    最近更新 更多