Skip to content

C++ STL header include problem #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MarkoSagadin opened this issue Oct 20, 2020 · 2 comments · Fixed by #8
Closed

C++ STL header include problem #5

MarkoSagadin opened this issue Oct 20, 2020 · 2 comments · Fixed by #8
Labels
cmake Issues with cmake build config

Comments

@MarkoSagadin
Copy link
Contributor

MarkoSagadin commented Oct 20, 2020

Commit 3220e63 compiles most of files right now, however compilation stops at one file that includes vector header from c++ library.
Compiler output is following:

[490/613] Building C object CMakeFiles/app.dir/src/main.c.obj
FAILED: CMakeFiles/app.dir/src/main.c.obj 
ccache /home/skobec/zephyr-sdk-0.11.4/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DBUILD_VERSION=v2.3.0-rc1-ncs1 -DKERNEL -DNRF52840_XXAA -DUSE_PARTITION_MANAGER=0 -D_FORTIFY_SOURCE=2 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -I../. -I../src -I../tflite-model -I../model-parameters -I../edge-impulse-sdk -I../edge-impulse-sdk/third_party/ruy -I../edge-impulse-sdk/third_party/gemmlowp -I../edge-impulse-sdk/third_party/flatbuffers/include -I../edge-impulse-sdk/third_party -I../edge-impulse-sdk/tensorflow/lite/schema -I../edge-impulse-sdk/tensorflow -I../edge-impulse-sdk/porting -I../edge-impulse-sdk/dsp/speechpy -I../edge-impulse-sdk/dsp/spectral -I../edge-impulse-sdk/dsp/kissfft -I../edge-impulse-sdk/dsp/dct -I../edge-impulse-sdk/dsp -I../edge-impulse-sdk/classifier -I../edge-impulse-sdk/anomaly -I../edge-impulse-sdk/CMSIS/NN/Include -I../edge-impulse-sdk/CMSIS/DSP/PrivateInclude -I../edge-impulse-sdk/CMSIS/DSP/Include -I../edge-impulse-sdk/CMSIS/Core/Include -I/home/skobec/Programs/ncs/zephyr/include -Izephyr/include/generated -I/home/skobec/Programs/ncs/zephyr/soc/arm/nordic_nrf/nrf52 -I/home/skobec/Programs/ncs/zephyr/lib/libc/newlib/include -I/home/skobec/Programs/ncs/nrf/include -I/home/skobec/Programs/ncs/modules/hal/cmsis/CMSIS/Core/Include -I/home/skobec/Programs/ncs/modules/hal/nordic/nrfx -I/home/skobec/Programs/ncs/modules/hal/nordic/nrfx/drivers/include -I/home/skobec/Programs/ncs/modules/hal/nordic/nrfx/mdk -I/home/skobec/Programs/ncs/modules/hal/nordic/. -I/home/skobec/Programs/ncs/modules/debug/segger/rtt -isystem /home/skobec/Programs/ncs/nrfxlib/crypto/nrf_cc310_platform/include -Os -imacros/home/skobec/work/example-standalone-inferencing-nrf52-zephyr/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -mcpu=cortex-m4 -mthumb -mabi=aapcs -imacros/home/skobec/Programs/ncs/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-address-of-packed-member -Wno-pointer-sign -Wpointer-arith -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=/home/skobec/work/example-standalone-inferencing-nrf52-zephyr=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/skobec/Programs/ncs/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/skobec/Programs/ncs=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=nano.specs -std=c99 -fdiagnostics-color=always -MD -MT CMakeFiles/app.dir/src/main.c.obj -MF CMakeFiles/app.dir/src/main.c.obj.d -o CMakeFiles/app.dir/src/main.c.obj   -c ../src/main.c
In file included from .././edge-impulse-sdk/dsp/spectral/spectral.hpp:27,
                 from ../edge-impulse-sdk/classifier/ei_run_dsp.h:27,
                 from ../edge-impulse-sdk/classifier/ei_run_classifier.h:30,
                 from ../src/main.c:2:
.././edge-impulse-sdk/dsp/spectral/processing.hpp:26:10: fatal error: vector: No such file or directory
   26 | #include <vector>
      |          ^~~~~~~~
compilation terminated.
[499/613] Building CXX object CMakeFiles/app.dir/edge-impulse-sdk/tensorflow/lite/micro/recording_micro_allocator.cc.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/skobec/work/example-standalone-inferencing-nrf52-zephyr/build

Same error happens if I try to compile cpp_synchroization after adding #include <vector> header into its main.
Zephyr had a issue like this in past: zephyrproject-rtos/zephyr#15603, however they seemed to resolve it.

I should try compiling this on regular zephyr commit, to see if this happens there as well.

@MarkoSagadin
Copy link
Contributor Author

No, it seems that problem is also present when compiling with regular zephyr.

@VojislavM VojislavM added the cmake Issues with cmake build config label Oct 20, 2020
@MarkoSagadin
Copy link
Contributor Author

This was solved by adding below lines above find package:

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CONFIG_LIB_CPLUSPLUS ON)
set(CONFIG_NEWLIB_LIBC ON)

This issue can be closed.

@VojislavM VojislavM reopened this Oct 20, 2020
@VojislavM VojislavM linked a pull request Oct 20, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmake Issues with cmake build config
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants