Я пытаюсь кросс-компилировать libwebsockets с помощью cmake, но я получаю следующие ошибки:
root@ubuntu-Latitude-E5450:/home/ubuntu/Downloads/libwebsockets/build# cmake .. -DCMAKE_INSTALL_PREFIX_PATH=/home/ubuntu/toolchain/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/ -DCMAKE_LIBRARY_PATH=/home/ubuntu/toolchain/sysroots/aarch64-oe-linux/usr/lib/ -DCMAKE_SYSROOT=/ubuntu/home/das_toolchain/sysroots/aarch64-oe-linux/ -DCMAKE_TOOLCHAIN_FILE=../cross-arm-oe-linux-gnueabi.cmake -DLWS_WITHOUT_EXTENSIONS=1 -DLWS_WITH_SSL=0 -DLWS_WITH_ZIP_FOPS=0 -DLWS_WITH_ZLIB=0
-- The C compiler identification is GNU 4.9.3
-- Check for working C compiler: /home/ubuntu/das_toolchain/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-gcc
-- Check for working C compiler: /home/ubuntu/das_toolchain/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-gcc -- broken
CMake Error at /usr/local/share/cmake-3.8/Modules/CMakeTestCCompiler.cmake:51 (message):
The C compiler
"/home/ubuntu/das_toolchain/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-gcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/ubuntu/Downloads/libwebsockets/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_515b7/fast"
/usr/bin/make -f CMakeFiles/cmTC_515b7.dir/build.make
CMakeFiles/cmTC_515b7.dir/build
make[1]: Entering directory
`/home/ubuntu/Downloads/libwebsockets/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_515b7.dir/testCCompiler.c.o
/home/ubuntu/das_toolchain/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-gcc
--sysroot=/ubuntu/home/das_toolchain/sysroots/aarch64-oe-linux/ -o
CMakeFiles/cmTC_515b7.dir/testCCompiler.c.o -c
/home/ubuntu/Downloads/libwebsockets/build/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_515b7
/usr/local/bin/cmake -E cmake_link_script
CMakeFiles/cmTC_515b7.dir/link.txt --verbose=1
/home/ubuntu/das_toolchain/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-gcc
--sysroot=/ubuntu/home/das_toolchain/sysroots/aarch64-oe-linux/ -rdynamic
CMakeFiles/cmTC_515b7.dir/testCCompiler.c.o -o cmTC_515b7
/home/ubuntu/toolchain/sysroots/x86_64-oesdk-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.9.3/real-ld:
error: cannot open crt1.o: No such file or directory
/home/ubuntu/toolchain/sysroots/x86_64-oesdk-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.9.3/real-ld:
error: cannot open crti.o: No such file or directory
/home/ubuntu/toolchain/sysroots/x86_64-oesdk-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.9.3/real-ld:
error: cannot open crtbegin.o: No such file or directory
/home/ubuntu/toolchain/sysroots/x86_64-oesdk-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.9.3/real-ld:
error: cannot open crtend.o: No such file or directory
/home/ubuntu/toolchain/sysroots/x86_64-oesdk-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.9.3/real-ld:
error: cannot open crtn.o: No such file or directory
/home/ubuntu/toolchain/sysroots/x86_64-oesdk-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.9.3/real-ld:
error: cannot find -lgcc
/home/ubuntu/toolchain/sysroots/x86_64-oesdk-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.9.3/real-ld:
error: cannot find -lgcc_s
/home/ubuntu/toolchain/sysroots/x86_64-oesdk-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.9.3/real-ld:
error: cannot find -lc
/home/ubuntu/toolchain/sysroots/x86_64-oesdk-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.9.3/real-ld:
error: cannot find -lgcc
/home/ubuntu/toolchain/sysroots/x86_64-oesdk-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.9.3/real-ld:
error: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
make[1]: *** [cmTC_515b7] Error 1
make[1]: Leaving directory
`/home/ubuntu/Downloads/libwebsockets/build/CMakeFiles/CMakeTmp'
make: *** [cmTC_515b7/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:146 (project)
-- Configuring incomplete, errors occurred!
See also "/home/ubuntu/Downloads/libwebsockets/build/CMakeFiles/CMakeOutput.log".
See also "/home/ubuntu/Downloads/libwebsockets/build/CMakeFiles/CMakeError.log".
Я указал CMAKE_SYSROOT в файле цепочки инструментов, а также указал то же самое в моей командной строке, покастроительство.Где я ошибаюсь?
Ваша помощь будет принята.
Ниже приведен мой файл набора инструментов:
#
# CMake Toolchain file for crosscompiling on ARM.
#
# This can be used when running cmake in the following way:
# cd build/
# cmake .. -DCMAKE_TOOLCHAIN_FILE=../cross-arm-oe-linux-gnueabi.cmake
#
set(CROSS_COMPILER_PATH /home/ubuntu/das_toolchain/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/)
set(CROSS_PATH /ubuntu/home/das_toolchain/sysroots/aarch64-oe-linux/)
set(TOOLCHAIN_PREFIX arm-oe-linux-gnueabi-)
#set(SYSROOT --sysroot=/ubuntu/home/das_toolchain/sysroots/aarch64-oe-linux/)
set(CMAKE_SYSROOT /ubuntu/home/das_toolchain/sysroots/aarch64-oe-linux/)
# Target operating system name.
#set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_NAME Arm)
# Name of C compiler.
#set(CMAKE_C_COMPILER "${CROSS_PATH}/bin/arm-linux-gnueabihf-gcc")
#set(CMAKE_CXX_COMPILER "${CROSS_PATH}/bin/arm-linux-gnueabihf-g++")
#set(CMAKE_C_COMPILER "${CROSS_PATH}${TOOLCHAIN_PREFIX}gcc ${SYSROOT}")
#set(CMAKE_CXX_COMPILER "${CROSS_PATH}${TOOLCHAIN_PREFIX}g++ ${SYSROOT}")
set(CMAKE_C_COMPILER "${CROSS_COMPILER_PATH}${TOOLCHAIN_PREFIX}gcc")
set(CMAKE_CXX_COMPILER "${CROSS_COMPILER_PATH}${TOOLCHAIN_PREFIX}g++")
#set(CMAKE_C_FLAGS ${SYSROOT})
#set(CMAKE_CXX_FLAGS ${SYSROOT})
# Where to look for the target environment. (More paths can be added here)
set(CMAKE_FIND_ROOT_PATH "${CROSS_PATH}")
# Adjust the default behavior of the FIND_XXX() commands:
# search programs in the host environment only.
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# Search headers and libraries in the target environment only.
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)