Date
1 - 1 of 1
external library building with cmake
antonisk
hello, i am new to zephyr and i am looking into application development.
I am trying to build an external library that is normally built with CMake. I have tried to use the external_lib https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/application_development/external_lib sample as reference, but it seems that it is required that the external library has a Makefile. Since this defeats the purpose of abstracting the build system with Cmake, i tried to make a version of the sample that is built using cmake instead. Basically i added a .cmake file under /mylib and included it in the CMakelists.txt as you can see in this branch: https://github.com/kalamara/zephyr/tree/ext_lib_sample_cmake/samples/application_development/external_lib The problem is when i pass the compiler options to the mylib target, i get this weird error: arm-zephyr-eabi-gcc: fatal error: cannot specify '-o' with '-c', '-S' or '-E' with multiple files when from the compile commands it is clear that there are no multiple files: {
"directory": "/home/antonkal/zephyr-test/build/da1469x_dk_pro/external_lib",
"command": "/home/antonkal/zephyr-sdk-0.14.2/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -I/home/antonkal/zephyr-test/zephyr/samples/application_development/external_lib/mylib/include -I/home/antonkal/zephyr-test/zephyr/samples/application_development/external_lib/mylib -g -DKERNEL -D__ZEPHYR__=1 -D_FORTIFY_SOURCE=2 -D__PROGRAM_START -Os -imacros /home/antonkal/zephyr-test/build/da1469x_dk_pro/external_lib/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33+nodsp -mthumb -mabi=aapcs -mfp16-format=ieee --sysroot=/home/antonkal/zephyr-sdk-0.14.2/arm-zephyr-eabi/arm-zephyr-eabi /home/antonkal/zephyr-test/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=/home/antonkal/zephyr-test/zephyr/samples/application_development/external_lib=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/antonkal/zephyr-test/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/antonkal/zephyr-test=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -nostdinc -o CMakeFiles/mylib.dir/mylib/src/mylib.c.obj -c /home/antonkal/zephyr-test/zephyr/samples/application_development/external_lib/mylib/src/mylib.c",
"file": "/home/antonkal/zephyr-test/zephyr/samples/application_development/external_lib/mylib/src/mylib.c"
},
I get the same error when i try using add_subdirectory() instead. could some compiler option cause this problem? Is there something i could do to filter out the problematic options? In general, what approach would you advise to build a cmake based external library for zephyr? Thanks in advance antonis |
|