I am trying to cross-compile odas library for Raspberry PI. The code actually builds out of the box on the platform (either Raspberry PI, or Ubuntu box). However, when I am trying to cross compile the same code using this tool chain file (the whole thing started in the previous question):
# Cross-compilation system informationSET(CMAKE_SYSTEM_NAME Linux)SET(CMAKE_SYSTEM_VERSION 1)set(CMAKE_SYSTEM_PROCESSOR "arm")# Specify the cross compilerSET(CMAKE_C_COMPILER /home/raspberrypi/opt/x-tools/aarch64-rpi3-linux-gnu/bin/aarch64-rpi3-linux-gnu-gcc)SET(CMAKE_CXX_COMPILER /home/raspberrypi/opt/x-tools/aarch64-rpi3-linux-gnu/bin/aarch64-rpi3-linux-gnu-g++)# where is the target environment locatedset(CMAKE_SYSROOT /home/raspberrypi/sysroot)set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --sysroot=${CMAKE_FIND_ROOT_PATH}")SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --sysroot=${CMAKE_FIND_ROOT_PATH}")SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} --sysroot=${CMAKE_FIND_ROOT_PATH}")# adjust the default behavior of the FIND_XXX() commands:# search programs in the host environmentset(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)# search headers and libraries in the target environmentset(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
I am getting a bunch of errors, like
[1/2] Linking C executable bin/odasserverFAILED: bin/odasserver : && /home/raspberrypi/opt/x-tools/aarch64-rpi3-linux-gnu/bin/aarch64-rpi3-linux-gnu-gcc --sysroot=/home/raspberrypi/sysroot -g --sysroot=/home/raspberrypi/sysroot CMakeFiles/odasserver.dir/demo/odasserver/main.obj -o bin/odasserver lib/libodas.so -lfftw3f -lasound -lconfig -lpulse-simple -lpulse -lm -lpthread && :/home/raspberrypi/opt/x-tools/aarch64-rpi3-linux-gnu/bin/../lib/gcc/aarch64-rpi3-linux-gnu/12.2.0/../../../../aarch64-rpi3-linux-gnu/bin/ld.bfd: lib/libodas.so: undefined reference to `__pthread_create'/home/raspberrypi/opt/x-tools/aarch64-rpi3-linux-gnu/bin/../lib/gcc/aarch64-rpi3-linux-gnu/12.2.0/../../../../aarch64-rpi3-linux-gnu/bin/ld.bfd: lib/libodas.so: undefined reference to `_dl_wait_lookup_done'/home/raspberrypi/opt/x-tools/aarch64-rpi3-linux-gnu/bin/../lib/gcc/aarch64-rpi3-linux-gnu/12.2.0/../../../../aarch64-rpi3-linux-gnu/bin/ld.bfd: lib/libodas.so: undefined reference to `_dl_init_static_tls'/home/raspberrypi/opt/x-tools/aarch64-rpi3-linux-gnu/bin/../lib/gcc/aarch64-rpi3-linux-gnu/12.2.0/../../../../aarch64-rpi3-linux-gnu/bin/ld.bfd: lib/libodas.so: undefined reference to `__pointer_chk_guard_local'/home/raspberrypi/opt/x-tools/aarch64-rpi3-linux-gnu/bin/../lib/gcc/aarch64-rpi3-linux-gnu/12.2.0/../../../../aarch64-rpi3-linux-gnu/bin/ld.bfd: lib/libodas.so: undefined reference to `_dl_stack_flags'/home/raspberrypi/opt/x-tools/aarch64-rpi3-linux-gnu/bin/../lib/gcc/aarch64-rpi3-linux-gnu/12.2.0/../../../../aarch64-rpi3-linux-gnu/bin/ld.bfd: lib/libodas.so: undefined reference to `_dl_pagesize'collect2: error: ld returned 1 exit status
What could be possibly wrong here?