trying to play around with odas library, using following CMakeLists.txt file to crosscompile for Raspberry PI platform:
make_minimum_required(VERSION 3.10)
# Set some basic project attributes
project (Audio_Sweep_Cross_CMake_04
VERSION 0.1
DESCRIPTION "Audio Sweep Project")
# Referencing ODAS here
include (CMakeListsOdas.cmake)
#Add base directory for includes (global)
include_directories(include)
set (SRC src)
# This project will output an executable file
add_executable(${PROJECT_NAME} ${SRC}/main.cpp )
# Include the configuration header in the build
SET(GCC_COVERAGE_LINK_FLAGS "-lm -lpthread " )
set(ENV{PKG_CONFIG_PATH} "/sysroot/usr/lib/aarch64-linux-gnu/pkgconfig")
find_package(PkgConfig REQUIRED)
pkg_check_modules(PC_ALSA REQUIRED alsa)
pkg_check_modules(PC_FFTW3 REQUIRED fftw3f)
pkg_check_modules(PC_LIBCONFIG REQUIRED libconfig)
pkg_check_modules(PC_PULSEAUDIO REQUIRED libpulse-simple)
target_link_libraries(${PROJECT_NAME}
odas
${PC_FFTW3_LIBRARIES}
${PC_ALSA_LIBRARIES}
${PC_LIBCONFIG_LIBRARIES}
${PC_PULSEAUDIO_LIBRARIES}
# m
# pthread
)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}")
This one compiles no problem. However, if I comment out
# SET(GCC_COVERAGE_LINK_FLAGS "-lm -lpthread " )
and un-comment m and pthread in
target_link_libraries(${PROJECT_NAME}
odas
${PC_FFTW3_LIBRARIES}
${PC_ALSA_LIBRARIES}
${PC_LIBCONFIG_LIBRARIES}
${PC_PULSEAUDIO_LIBRARIES}
m
pthread
)
then, when i try to build the project, i am getting a bunch of errors:
**** Incremental Build of configuration Debug for project RPI_audio_sweep_04 ****
/usr/bin/ninja -j 8 all
[1/1] Linking CXX executable Audio_Sweep_Cross_CMake_04
FAILED: Audio_Sweep_Cross_CMake_04
: && /opt/x-tools/aarch64-rpi3-linux-gnu/bin/aarch64-rpi3-linux-gnu-g++ --sysroot=/sysroot -g --sysroot=/sysroot CMakeFiles/Audio_Sweep_Cross_CMake_04.dir/src/main.cpp.o -o Audio_Sweep_Cross_CMake_04 -Wl,-rpath,/RPI_audio_sweep_04/_build/Debug libodas.so -lfftw3f -lasound -lconfig -lpulse-simple -lpulse -lm -lpthread && :
/opt/x-tools/aarch64-rpi3-linux-gnu/bin/../lib/gcc/aarch64-rpi3-linux-gnu/12.2.0/../../../../aarch64-rpi3-linux-gnu/bin/ld.bfd: /sysroot/lib/aarch64-linux-gnu/libpthread.a(pthread_create.o): in function `allocate_stack':
./nptl/allocatestack.c:525: undefined reference to `_dl_stack_flags'
/opt/x-tools/aarch64-rpi3-linux-gnu/bin/../lib/gcc/aarch64-rpi3-linux-gnu/12.2.0/../../../../aarch64-rpi3-linux-gnu/bin/ld.bfd: ./nptl/allocatestack.c:647: undefined reference to `_dl_stack_flags'
/opt/x-tools/aarch64-rpi3-linux-gnu/bin/../lib/gcc/aarch64-rpi3-linux-gnu/12.2.0/../../../../aarch64-rpi3-linux-gnu/bin/ld.bfd: /sysroot/lib/aarch64-linux-gnu/libpthread.a(nptl-init.o): in function `__pthread_initialize_minimal_internal':
./nptl/nptl-init.c:335: undefined reference to `_dl_pagesize'
/opt/x-tools/aarch64-rpi3-linux-gnu/bin/../lib/gcc/aarch64-rpi3-linux-gnu/12.2.0/../../../../aarch64-rpi3-linux-gnu/bin/ld.bfd: ./nptl/nptl-init.c:344: undefined reference to `_dl_pagesize'
/opt/x-tools/aarch64-rpi3-linux-gnu/bin/../lib/gcc/aarch64-rpi3-linux-gnu/12.2.0/../../../../aarch64-rpi3-linux-gnu/bin/ld.bfd: ./nptl/nptl-init.c:360: undefined reference to `_dl_init_static_tls'
/opt/x-tools/aarch64-rpi3-linux-gnu/bin/../lib/gcc/aarch64-rpi3-linux-gnu/12.2.0/../../../../aarch64-rpi3-linux-gnu/bin/ld.bfd: ./nptl/nptl-init.c:362: undefined reference to `_dl_wait_lookup_done'
/opt/x-tools/aarch64-rpi3-linux-gnu/bin/../lib/gcc/aarch64-rpi3-linux-gnu/12.2.0/../../../../aarch64-rpi3-linux-gnu/bin/ld.bfd: /sysroot/lib/aarch64-linux-gnu/libpthread.a(nptl-init.o): in function `__pthread_get_minstack':
./nptl/nptl-init.c:393: undefined reference to `_dl_pagesize'
/opt/x-tools/aarch64-rpi3-linux-gnu/bin/../lib/gcc/aarch64-rpi3-linux-gnu/12.2.0/../../../../aarch64-rpi3-linux-gnu/bin/ld.bfd: /sysroot/lib/aarch64-linux-gnu/libpthread.a(unwind.o): in function `_jmpbuf_sp':
./nptl/../sysdeps/aarch64/jmpbuf-offsets.h:52: undefined reference to `__pointer_chk_guard_local'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
"/usr/bin/ninja -j 8 all" terminated with exit code 1. Build might be incomplete.
Not sure what is going on here.