ESP32 Compile Error with BME680

Hello,
I just want to get the library working in Arduino IDE 1.8.13. However, it always fails to compile. I have adjusted the platform.txt, however it did not do anything. I have downloaded the library from github (https://github.com/BoschSensortec/BSEC-Arduino-library). It always comes back the same error when compiling with the ESP32 board. Where is my mistake?

Here is the debug code:

 

libraries/BSEC_Software_Library/BSEC_Software_Library.a(bsec.cpp.o):(.literal._ZN4Bsec11beginCommonEv+0x4): undefined reference to `bsec_init'
libraries/BSEC_Software_Library/BSEC_Software_Library.a(bsec.cpp.o):(.literal._ZN4Bsec11beginCommonEv+0x8): undefined reference to `bsec_get_version'
libraries/BSEC_Software_Library/BSEC_Software_Library.a(bsec.cpp.o):(.literal._ZN4Bsec18updateSubscriptionEP21bsec_virtual_sensor_thf+0x0): undefined reference to `bsec_update_subscription'
libraries/BSEC_Software_Library/BSEC_Software_Library.a(bsec.cpp.o):(.literal._ZN4Bsec8setStateEPh+0x10): undefined reference to `bsec_set_state'
libraries/BSEC_Software_Library/BSEC_Software_Library.a(bsec.cpp.o):(.literal._ZN4Bsec15readProcessDataEx19bsec_bme_settings_t+0x14): undefined reference to `bsec_do_steps'
libraries/BSEC_Software_Library/BSEC_Software_Library.a(bsec.cpp.o):(.literal._ZN4Bsec3runEx+0x0): undefined reference to `bsec_sensor_control'
libraries/BSEC_Software_Library/BSEC_Software_Library.a(bsec.cpp.o):(.literal._ZN4Bsec3runEx+0x4): undefined reference to `bsec_get_state'
libraries/BSEC_Software_Library/BSEC_Software_Library.a(bsec.cpp.o): In function `Bsec::beginCommon()':
/Users/Service/Documents/Arduino/libraries/BSEC_Software_Library/src/bsec.cpp:476: undefined reference to `bsec_init'
libraries/BSEC_Software_Library/BSEC_Software_Library.a(bsec.cpp.o): In function `Bsec::getVersion()':
/Users/Service/Documents/Arduino/libraries/BSEC_Software_Library/src/bsec.cpp:476: undefined reference to `bsec_get_version'
libraries/BSEC_Software_Library/BSEC_Software_Library.a(bsec.cpp.o): In function `Bsec::updateSubscription(bsec_virtual_sensor_t*, unsigned char, float)':
/Users/Service/Documents/Arduino/libraries/BSEC_Software_Library/src/bsec.cpp:476: undefined reference to `bsec_update_subscription'
libraries/BSEC_Software_Library/BSEC_Software_Library.a(bsec.cpp.o): In function `Bsec::setState(unsigned char*)':
/Users/Service/Documents/Arduino/libraries/BSEC_Software_Library/src/bsec.cpp:476: undefined reference to `bsec_set_state'
libraries/BSEC_Software_Library/BSEC_Software_Library.a(bsec.cpp.o): In function `Bsec::readProcessData(long long, bsec_bme_settings_t)':
/Users/Service/Documents/Arduino/libraries/BSEC_Software_Library/src/bsec.cpp:385: undefined reference to `bsec_do_steps'
libraries/BSEC_Software_Library/BSEC_Software_Library.a(bsec.cpp.o): In function `Bsec::run(long long)':
/Users/Service/Documents/Arduino/libraries/BSEC_Software_Library/src/bsec.cpp:200: undefined reference to `bsec_init'
/Users/Service/Documents/Arduino/libraries/BSEC_Software_Library/src/bsec.cpp:210: undefined reference to `bsec_update_subscription'
/Users/Service/Documents/Arduino/libraries/BSEC_Software_Library/src/bsec.cpp:210: undefined reference to `bsec_sensor_control'
/Users/Service/Documents/Arduino/libraries/BSEC_Software_Library/src/bsec.cpp:246: undefined reference to `bsec_get_state'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board DOIT ESP32 DEVKIT V1.

 

I have attached the platform.txt.
Thank you

platform.txt.zip
3.37KB
Best reply by Jo_Felus

Hello,
Yes I installed the library as mentioned in the link.
Then I tested a lot and came to the solution.
For the ESP32 one had to make one more modification in the Platform.txt.

Under ## Combine gc-sections, archives, and objects you have to replace the existing line with the following:

 

recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} {compiler.libraries. ldflags} -Wl,--start-group {object_files} "{archive_file_path}" {compiler.c.elf.libs} {compiler.libraries.ldflags} -Wl,--end-group -Wl,-EL -o "{build.path}/{build.project_name}.elf"

 

So at least I didn't get any more errors.

View original
1
7 replies
Resolved