【问题标题】:failed cross compiling aws webrtc library交叉编译 aws webrtc 库失败
【发布时间】:2021-04-12 22:35:37
【问题描述】:

我正在尝试为 arm 交叉编译 aws webrtc 库(https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c)。所以我按照 Readme.md 上的说明进行操作,但失败了。

我做了什么

export CC=arm-linux-gnueabihf-gcc
export CXX=arm-linux-gnueabihf-g++
cmake .. -DBUILD_TEST=TRUE -DBUILD_OPENSSL=TRUE -DBUILD_STATIC_LIBS=TRUE -DBUILD_OPENSSL_PLATFORM=linux-generic32 -DBUILD_LIBSRTP_HOST_PLATFORM=x86_64-pc-linux-gnu -DBUILD_LIBSRTP_DESTINATION_PLATFORM=arm-unknown-linux-uclibcgnueabi

我遇到的错误

Scanning dependencies of target kvsCommonLws
[ 26%] Building C object CMakeFiles/kvsCommonLws.dir/src/source/Common/Auth.c.o
In file included from /home/jacob/Workspace/Github/amazon-kinesis-video-streams-webrtc-sdk-c/open-source/libkvsCommonLws/build/src/libkvsCommonLws-download/src/source/Common/Include_i.h:41,
                 from /home/jacob/Workspace/Github/amazon-kinesis-video-streams-webrtc-sdk-c/open-source/libkvsCommonLws/build/src/libkvsCommonLws-download/src/source/Common/Auth.c:5:
/home/jacob/Workspace/Github/amazon-kinesis-video-streams-webrtc-sdk-c/open-source/include/libwebsockets.h:120:10: fatal error: sys/capability.h: No such file or directory
  120 | #include <sys/capability.h>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/kvsCommonLws.dir/build.make:62: recipe for target 'CMakeFiles/kvsCommonLws.dir/src/source/Common/Auth.c.o' failed
make[5]: *** [CMakeFiles/kvsCommonLws.dir/src/source/Common/Auth.c.o] Error 1
make[4]: *** [CMakeFiles/kvsCommonLws.dir/all] Error 2
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/kvsCommonLws.dir/all' failed
Makefile:129: recipe for target 'all' failed
CMakeFiles/libkvsCommonLws-download.dir/build.make:111: recipe for target 'build/src/libkvsCommonLws-download-stamp/libkvsCommonLws-download-build' failed
make[3]: *** [all] Error 2
make[2]: *** [build/src/libkvsCommonLws-download-stamp/libkvsCommonLws-download-build] Error 2
make[1]: *** [CMakeFiles/libkvsCommonLws-download.dir/all] Error 2
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/libkvsCommonLws-download.dir/all' failed
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
CMake Error at CMake/Utilities.cmake:65 (message):
  CMake step for libkvsCommonLws failed: 2
Call Stack (most recent call first):
  CMakeLists.txt:150 (build_dependency)

【问题讨论】:

  • 每个包都有这个头文件(Debian):libcap-dev,libklibc-dev,dietlibc-dev (我不知道,哪个是正确的)
  • @JCWasmx86 我安装了所有的,但它是一样的。我也应该为 arm 交叉编译 libcap-dev 吗?
  • 您应该将它们全部安装为交叉编译的二进制文件

标签: c linux amazon-web-services embedded cross-compiling


【解决方案1】:

您的 ARM 工具链或构建系统使用它的方式有问题。您是从哪里获得的以及如何安装的?

标头 sys/capability.h 包含在 ARM 工具链中。例如,当我安装 Debian 软件包 gcc-arm-linux-gnueabihf 时,这个头文件会被复制到 /usr/arm-linux-gnueabihf/include/linux/capability.h。工具链应该可以自行找到它。

命令arm-linux-gnueabihf-gcc -v 将显示工具链在哪里配置以查找其自己的头文件。例如。在下面的输出中,重要的是--includedir=/usr/arm-linux-gnueabihf/include,应该相对于该目录找到标题。我为超长的队伍道歉。

$ arm-linux-gnueabihf-gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/arm-linux-gnueabihf/10/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Debian 10.2.1-1' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --without-target-system-zlib --enable-multiarch --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-werror --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueabihf --program-prefix=arm-linux-gnueabihf- --includedir=/usr/arm-linux-gnueabihf/include --with-build-config=bootstrap-lto-lean --enable-link-mutex
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.1 20201207 (Debian 10.2.1-1)

您还可以尝试增加 cmake 构建过程的详细程度,以验证它是否调用了正确的交叉编译器。我忘记了细节,但也许添加一个标志 -v 会有所帮助。

【讨论】:

  • 我检查了但没有选项(--includedir=)。是否可以添加选项?我用工具链交叉编译了 libcap-dev。
  • 您的工具链似乎已损坏。你在什么系统上,你从哪里得到编译器的?
  • 不是常用的工具链。它来自一些PCB公司。
  • 那么你就任由他们摆布了 :) 无论如何,最流行的 ARM gcc 工具链来自 ARM、linaro 或你的发行版(Debian/Ubuntu?)——也许你可以切换到其中之一。跨度>
  • 查看此演示文稿,幻灯片 5:elinux.org/images/1/15/… 通常您的工具链名称与您的平台相对应。如果您正确选择了“arm-linux-gnueabihf”,那就是平台。
猜你喜欢
  • 2021-04-20
  • 2018-08-08
  • 1970-01-01
  • 2017-10-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多