我试图将此代码与aarch64编译器交叉编译,并得到以下错误:
/usr/bin/aarch64-linux-gnu-as: invalid option -- 'B'
make[2]: *** [third_party/boringssl-with-bazel/CMakeFiles/crypto.dir/build.make:63: third_party/boringssl-with-bazel/CMakeFiles/crypto.dir/linux-aarch64/crypto/chacha/chacha-armv8.S.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:3931: third_party/boringssl-with-bazel/CMakeFiles/crypto.dir/all] Error 2
make: *** [Makefile:130: all] Error 2该build.make文件的第63行是:
cd /home/a/Documents/third_party/grpc/build_arm/third_party/boringssl-with-bazel && /usr/bin/aarch64-linux-gnu-as $(ASM_DEFINES) $(ASM_INCLUDES) $(ASM_FLAGS) -o CMakeFiles/crypto.dir/linux-aarch64/crypto/chacha/chacha-armv8.S.o -c /home/a/Documents/third_party/grpc/third_party/boringssl-with-bazel/linux-aarch64/crypto/chacha/chacha-armv8.S我的toolchain.cmake是:
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(TARGET_ABI "linux-gnu")
# specify the cross compiler
SET(CMAKE_C_COMPILER aarch64-${TARGET_ABI}-gcc)
SET(CMAKE_CXX_COMPILER aarch64-${TARGET_ABI}-g++)
# To build the tests, we need to set where the target environment containing
# the required library is. On Debian-like systems, this is
# /usr/aarch64-linux-gnu.
SET(CMAKE_FIND_ROOT_PATH "/usr/aarch64-${TARGET_ABI}")
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# Set additional variables.
# If we don't set some of these, CMake will end up using the host version.
# We want the full path, however, so we can pass EXISTS and other checks in
# the our CMake code.
find_program(GCC_FULL_PATH aarch64-${TARGET_ABI}-gcc)
if (NOT GCC_FULL_PATH)
message(FATAL_ERROR "Cross-compiler aarch64-${TARGET_ABI}-gcc not found")
endif ()
get_filename_component(GCC_DIR ${GCC_FULL_PATH} PATH)
SET(CMAKE_LINKER ${GCC_DIR}/aarch64-${TARGET_ABI}-ld CACHE FILEPATH "linker")
SET(CMAKE_ASM_COMPILER ${GCC_DIR}/aarch64-${TARGET_ABI}-as CACHE FILEPATH "assembler")
SET(CMAKE_OBJCOPY ${GCC_DIR}/aarch64-${TARGET_ABI}-objcopy CACHE FILEPATH "objcopy")
SET(CMAKE_STRIP ${GCC_DIR}/aarch64-${TARGET_ABI}-strip CACHE FILEPATH "strip")
SET(CMAKE_CPP ${GCC_DIR}/aarch64-${TARGET_ABI}-cpp CACHE FILEPATH "cpp")这是什么错误?
发布于 2021-06-14 00:07:21
当编译器找不到as时,我遇到了这个问题。
我通过运行strace g++并分析输出来找到它。
您能为目标平台运行as (例如,在您的情况下是arm )吗?
https://unix.stackexchange.com/questions/596738
复制相似问题