.///platform/c++11/platform.h:29:17: fatal error: mutex: No such file or directory
发布这个问题的人似乎和我一样使用了同样的Bazel交叉构建教程,但他们对根本原因得出了非常不同的结论(即,他们声称这是由于输入错误的include路径导致的用户错误)。在我的例子中,所有路径都是正确的,但它们被nsync的构建忽略/重写。我真的需要一些帮助来弄清楚需要什么更改才能用Linaro工具链正确构建nsync。
下面是一个小脚本,它在我的html" target="_blank">系统上100%地重现了这个问题:
#!/bin/bash
# File: repro-nsync-error.sh
set -euo pipefail
# Work in a temp folder
mkdir tempxxx && cd tempxxx
# Clone the bits
git clone https://github.com/bazelbuild/bazel.git
git clone https://github.com/google/nsync.git
# Copy custom toolchain example files from the Bazel toolchain tutorial into nsync project
cd nsync
cp -a ../bazel/src/test/shell/bazel/testdata/bazel_toolchain_test_data/compilers .
cp -a ../bazel/src/test/shell/bazel/testdata/bazel_toolchain_test_data/tools/arm_compiler ./tools
cat ../bazel/src/test/shell/bazel/testdata/bazel_toolchain_test_data/WORKSPACE.linaro >> ./WORKSPACE
# Set executable bit on wrapper scripts
chmod +x ./tools/arm_compiler/linaro_linux_gcc/arm-linux-gnueabihf-*
# Nix the `.linaro` extension that the Bazel project uses to 'hide' the
# example files during normal Bazel builds, otherwise Bazel won't 'see' them
for file in $(find -name "*.linaro"); do mv "${file}" "$(dirname ${file})/$(basename ${file%.*})"; done
# Attempt to build
bazel build --verbose_failures --crosstool_top=//tools/arm_compiler:toolchain --cpu=armeabi-v7a //:nsync_cpp
下面是我运行它时得到的输出:
$ ./repro-nsync-error.sh
Cloning into 'bazel'...
remote: Counting objects: 305983, done.
remote: Compressing objects: 100% (184/184), done.
remote: Total 305983 (delta 127), reused 273 (delta 104), pack-reused 305624
Receiving objects: 100% (305983/305983), 457.28 MiB | 2.62 MiB/s, done.
Resolving deltas: 100% (188973/188973), done.
Checking connectivity... done.
Cloning into 'nsync'...
remote: Counting objects: 944, done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 944 (delta 10), reused 23 (delta 7), pack-reused 910
Receiving objects: 100% (944/944), 316.81 KiB | 0 bytes/s, done.
Resolving deltas: 100% (496/496), done.
Checking connectivity... done.
WARNING: ignoring http_proxy in environment.
Starting local Bazel server and connecting to it...
.........
INFO: Analysed target //:nsync_cpp (10 packages loaded).
INFO: Found 1 target...
ERROR: /home/evadeflow/Desktop/tempxxx/nsync/BUILD:463:1: C++ compilation of rule '//:nsync_cpp' failed (Exit 1): arm-linux-gnueabihf-gcc failed: error executing command
(cd /home/evadeflow/.cache/bazel/_bazel_evadeflow/595bcf82ccc39f6a61512641b728b082/execroot/__main__ && \
exec env - \
PATH=/home/evadeflow/.virtualenvs/tfbootstrap/bin:/home/evadeflow/.local/bin:/home/evadeflow/.virtualenvs/tfbootstrap/bin:/home/evadeflow/.local/bin:/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/home/evadeflow/.local/bin:/usr/local/bin:/usr/bin:/home/evadeflow/bin:/usr/local/sbin:/usr/sbin:/home/evadeflow/bin:/home/evadeflow/bin:/home/evadeflow/bin:/home/evadeflow/bin \
PWD=/proc/self/cwd \
tools/arm_compiler/linaro_linux_gcc/arm-linux-gnueabihf-gcc '--sysroot=external/org_linaro_components_toolchain_gcc_5_3_1/arm-linux-gnueabihf/libc' '-mfloat-abi=hard' -nostdinc -isystem external/org_linaro_components_toolchain_gcc_5_3_1/lib/gcc/arm-linux-gnueabihf/5.3.1/include -isystem external/org_linaro_components_toolchain_gcc_5_3_1/arm-linux-gnueabihf/libc/usr/include -isystem external/org_linaro_components_toolchain_gcc_5_3_1/lib/gcc/arm-linux-gnueabihf/5.3.1/include-fixed -isystem external/org_linaro_components_toolchain_gcc_5_3_1/arm-linux-gnueabihf/libc/usr/include -U_FORTIFY_SOURCE -fstack-protector -fPIE '-fdiagnostics-color=always' -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -MD -MF bazel-out/armeabi-v7a-fastbuild/bin/_objs/nsync_cpp/internal/dll.pic.d -fPIC -iquote . -iquote bazel-out/armeabi-v7a-fastbuild/genfiles -iquote external/bazel_tools -iquote bazel-out/armeabi-v7a-fastbuild/genfiles/external/bazel_tools -isystem public -isystem bazel-out/armeabi-v7a-fastbuild/genfiles/public -isystem bazel-out/armeabi-v7a-fastbuild/bin/public -x c++ '-std=c++11' -DNSYNC_ATOMIC_CPP11 -DNSYNC_USE_CPP11_TIMEPOINT -I.///platform/c++11 -I.///platform/gcc -I.///platform/arm -I.///public -I.///internal -I.///platform/posix '-D_POSIX_C_SOURCE=200809L' -pthread -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c internal/dll.c -o bazel-out/armeabi-v7a-fastbuild/bin/_objs/nsync_cpp/internal/dll.pic.o)
Use --sandbox_debug to see verbose messages from the sandbox
In file included from internal/dll.c:16:0:
.///platform/c++11/platform.h:29:17: fatal error: mutex: No such file or directory
compilation terminated.
Target //:nsync_cpp failed to build
INFO: Elapsed time: 15.023s, Critical Path: 6.77s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
#include <mutex>
#!/bin/bash
# File: build.sh
set -euo pipefail
bazel build -s --verbose_failures --crosstool_top=//tools/arm_compiler:toolchain --cpu=armeabi-v7a \
--cxxopt="-isystem external/org_linaro_components_toolchain_gcc_5_3_1/arm-linux-gnueabihf/include/c++/5.3.1/arm-linux-gnueabihf" \
--cxxopt="-isystem external/org_linaro_components_toolchain_gcc_5_3_1/arm-linux-gnueabihf/include/c++/5.3.1" \
--cxxopt="-isystem external/org_linaro_components_toolchain_gcc_5_3_1/include/c++/5.3.1/arm-linux-gnueabihf" \
--cxxopt="-isystem external/org_linaro_components_toolchain_gcc_5_3_1/include/c++/5.3.1" \
//:nsync_cpp
当我运行它时,它会以同样的错误失败,但是-如果IS/cxxopt/copt
和S/isystem/I
如下所示-它编译成功:
#!/bin/bash
# File: build.sh
set -euo pipefail
bazel build -s --verbose_failures --crosstool_top=//tools/arm_compiler:toolchain --cpu=armeabi-v7a \
--copt="-Iexternal/org_linaro_components_toolchain_gcc_5_3_1/arm-linux-gnueabihf/include/c++/5.3.1/arm-linux-gnueabihf" \
--copt="-Iexternal/org_linaro_components_toolchain_gcc_5_3_1/arm-linux-gnueabihf/include/c++/5.3.1" \
--copt="-Iexternal/org_linaro_components_toolchain_gcc_5_3_1/include/c++/5.3.1/arm-linux-gnueabihf" \
--copt="-Iexternal/org_linaro_components_toolchain_gcc_5_3_1/include/c++/5.3.1" \
//:nsync_cpp
所以...我可以肯定地看到‘错误的’编译器标志被应用的地方。但我不确定解决问题的“正确”方法是什么。上面的方法看起来像是一种“蛮力”方法,可能会产生意想不到的副作用[?],所以我仍然在寻找一个更干净的解决方案。
问题是,在CROSSTOOL中,包含互斥头的include目录只添加到C++命令行中。我可以看到这是如何产生的,mutex所在的目录是org_linaro_components_toolchain_gcc_5_3_1/arm-linux-gnueabihf/include/c++/5.3.1/mutex
,请注意C++
。如果您认为该目录对于C编译也是有效的,原则上的修正是将交叉表中的cxx_flag
更改为compiler_flag
。
你是对的,G++和GCC是不一样的。https://github.com/bazelbuild/bazel/issues/4644有一个问题。但这与您的问题并不相关,只有bazel没有将cxx_flags放入C编译命令行,而不是GCC。还是我漏掉了什么?
我建议不要依赖Bazel测试数据交叉:)
我正在努力使用Bazel为ARM处理器交叉编译一个程序。我遵循了Bazel的以下教程: https://github.com/bazelbuild/bazel/wiki/building-with-a-custom-toolchain 当我运行上述教程中编写的确切命令时,错误日志如下所示: 我对巴泽尔一无所知,因为我是新来的。任何帮助都将不胜感激。
问题内容: 我创建了一个交叉编译的arm可执行文件。我想找到可执行文件的库依赖项。我正在使用ubuntu natty并安装了不包含ldd的arm-linux- gnueabi工具链。有没有可用的工具来查看Linux中arm可执行文件库的依赖性。 问题答案: 这有点儿混乱,但这是我能找到的最好的解决方案,对于基本用途它确实很好用-只需使用其他交叉工具将此脚本另存为“ arm-none-linux-g
我在、Visual C++和交叉编译器的帮助下为构建项目。它运行良好,但如何处理情况时,我需要链接到库?我是否应该用当前的交叉编译器构建所有必需的库?例如如何处理库?
本文档说明如何在kali linux上配置ARM交叉编译环境,是我们多份关于”定制ARM镜像”的文档的起点. 开发机的配置 编译内核生成镜象通常需要大量硬盘空间.确保你的开发机至少有50G可用硬盘空间以及足够的内存,CPU不要太差. 安装依赖 先安装ARM交叉编译所需的依赖. apt-get install git-core gnupg flex bison gperf libesd0-dev b
本文向大家介绍使用Bazel编译TensorBoard教程,包括了使用Bazel编译TensorBoard教程的使用技巧和注意事项,需要的朋友参考一下 1.TensorBoard Tensorboard是一套用于查看和理解TensorFlow运行情况的工具,有时可能现有的功能并不能满足我们当前的需求,那么则需要我们对Tensorboard进行定制化开发,定制化的第一步就是编译源码。 TensorB
问题内容: 各位 我正在尝试在Ant和终端上玩Javac Cross编译。在本地和集成环境中,我在一个非常基本的问题上遇到了同样的问题。 我在linux终端(以及在Windows和cmd的cygwin上)上运行此命令: 与Main.java一起使用,仅是System.out.println。 我收到错误消息: 我在本地Windows机器上的配置大致相同,结果完全相同。 我的理解是,交叉编译就是使用