linux - Yocto for Nvidia Jetson 由于 GCC 7 失败 - 无法计算目标文件的后缀

标签 linux bash cuda nvidia yocto

我正在尝试使用 Yocto 和 meta-tegra ( https://github.com/madisongh/meta-tegra ) 为 Nvidia Jetson Nano 构建一个最小的系统。我需要在此平台上使用 CUDA(Nano 当前版本 10)和 OpenCV。 CUDA 10 仅支持 GCC 7,而不支持 GCC 8。GCC 7 已被弃用并从 OpenEmbedded Warrior 版本中删除,取而代之的是 GCC 8.3。我的错误与尝试将 GCC 7 与 Warrior 版本的 OE 一起使用有关:配置:错误:无法计算目标文件的后缀:无法编译

meta-tegra 的自述文件说明如下:

* CUDA 10 supports up through gcc 7 only, and some NVIDIA-provided
  binary libraries appear to be compiled with g++ 7 and cause linker
  failures when building applications with g++ 6, so **only** gcc 7
  should be used if you intend to use CUDA. (For Jetson-TK1, CUDA 6.5
  supports up through gcc 5.x only.)

Selecting the toolchain version
-------------------------------

Toolchain version selection is usually a distro configuration setting,
but you can also set this in your build/conf/local.conf file. To use
gcc 7 instead of gcc 8, set:

GCCVERSION = "7.%"

but you will also need the gcc 7 toolchain recipes in one of your layers,
since it was retired from OE-Core in favor of gcc 8.

我在全新安装的 Ubuntu 16.04 和 Ubuntu 18.04 上尝试了以下脚本。两台机器都失败并出现相同的错误:

# Get current directory
cwd=$PWD

# Yocto build script
cd ~/Desktop
rm -rf dev-jetson-yocto
mkdir -p dev-jetson-yocto/layers
cd dev-jetson-yocto/layers
git clone https://git.yoctoproject.org/git/poky -b warrior
git clone https://github.com/openembedded/meta-openembedded.git -b warrior
git clone https://github.com/meta-qt5/meta-qt5.git -b warrior
git clone https://github.com/madisongh/meta-tegra.git -b warrior
git clone https://git.linaro.org/openembedded/meta-linaro.git -b warrior
cd ../
. layers/poky/oe-init-build-env build
bitbake-layers add-layer ../layers/meta-openembedded/meta-oe
bitbake-layers add-layer ../layers/meta-openembedded/meta-multimedia
bitbake-layers add-layer ../layers/meta-openembedded/meta-python
bitbake-layers add-layer ../layers/meta-openembedded/meta-networking
bitbake-layers add-layer ../layers/meta-linaro/meta-linaro
bitbake-layers add-layer ../layers/meta-linaro/meta-linaro-toolchain
bitbake-layers add-layer ../layers/meta-linaro/meta-linaro-integration
bitbake-layers add-layer ../layers/meta-linaro/meta-aarch64
bitbake-layers add-layer ../layers/meta-tegra
bitbake-layers add-layer ../layers/meta-qt5
cp $cwd/local.conf conf/local.conf
mkdir -p downloads/sdkm_downloads
rsync -av --progress $cwd/nvidia-sources/* downloads/sdkm_downloads
echo 'NVIDIA_DEVNET_MIRROR = "file://sdkm_downloads"' >> conf/local.conf
MACHINE=jetson-nano bitbake core-image-full-cmdline

Local.conf 与名义值的差异:

CONF_VERSION = "1"
IMAGE_CLASSES += "image_types_tegra"
IMAGE_FSTYPES = "tegraflash"
GCCVERSION = "linaro-7.2"
SDKGCCVERSION = "linaro-7.2"

NVIDIA_DEVNET_MIRROR = "file://sdkm_downloads"

错误:

| checking build system type... x86_64-pc-linux-gnu
| checking host system type... aarch64-poky-linux-gnu
| checking for --enable-version-specific-runtime-libs... no
| checking for a BSD-compatible install... /home/user/Desktop/dev-jetson-yocto/build/tmp/hosttools/install -c
| checking for gawk... gawk
| checking for aarch64-poky-linux-ar... aarch64-poky-linux-gcc-ar
| checking for aarch64-poky-linux-lipo... no
| checking for lipo... no
| checking for aarch64-poky-linux-nm... aarch64-poky-linux-nm
| checking for aarch64-poky-linux-ranlib... aarch64-poky-linux-gcc-ranlib
| checking for aarch64-poky-linux-strip... aarch64-poky-linux-strip
| checking whether ln -s works... yes
| checking for aarch64-poky-linux-gcc... aarch64-poky-linux-gcc  -march=armv8-a+crc -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/user/Desktop/dev-jetson-yocto/build/tmp/work/aarch64-poky-linux/libgcc-initial/linaro-7.2-r2017.11/recipe-sysroot
| checking for suffix of object files... configure: error: in `/home/user/Desktop/dev-jetson-yocto/build/tmp/work/aarch64-poky-linux/libgcc-initial/linaro-7.2-r2017.11/gcc-linaro-7.2-2017.11/build.aarch64-poky-linux.aarch64-poky-linux/libgcc':
| configure: error: cannot compute suffix of object files: cannot compile
| See `config.log' for more details.
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_configure (log file is located at /home/user/Desktop/dev-jetson-yocto/build/tmp/work/aarch64-poky-linux/libgcc-initial/linaro-7.2-r2017.11/temp/log.do_configure.17732)
ERROR: Task (/home/user/Desktop/dev-jetson-yocto/layers/meta-linaro/meta-linaro-toolchain/recipes-devtools/gcc/libgcc-initial_linaro-7.2.bb:do_configure) failed with exit code '1'
Waiting for 1 running tasks to finish:
0: qemu-native-3.1.0-r0 do_compile - 100

我怎样才能编译它?

最佳答案

我遇到了同样的问题,经过快速调查后我发现失败的原因是 gcc7 中不存在标志 -fmacro-debug-prefix

如果您将其设置为在 local.conf 中不包含该标志,则它会在 bitbake.conf 中由变量 DEBUG_PREFIX_MAP 使用这个问题将会消失(也许其他问题会出现:P)。

我不是 Yocto 的专家,所以也许这样的改变可能会产生意想不到的副作用(可能调试期间的路径会被搞砸)。

关于linux - Yocto for Nvidia Jetson 由于 GCC 7 失败 - 无法计算目标文件的后缀,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56481980/

相关文章:

linux - cabal 安装失败,因为缺少 C 库

python - cqlsh 无法找到它需要执行的 Python 版本

linux - 如何比较两个压缩包的内容

linux - 临时 shell 变量存储在 shell session 中的什么位置?

bash - 我无法从索引数组中 Ping IP,但可以使用关联数组

CUDA:结果的总和

python - 使用 Popen 独立运行 python 子进程

git - 是否可以将 git 提交消息保存到预提交 Hook 中的文件中?

从C调用cuda函数

cuda - block 中的线程和经线(32 个线程)有什么区别?