Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    ESP32 Compile Error with BME680

    ESP32 Compile Error with BME680

    Jo_Felus
    Member

    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

    7 REPLIES 7

    tstahov
    Member

    I am having the same problem. 

    BSTRobin
    Community Moderator
    Community Moderator

    Hello Jo_Felus,

    Have you installed library correctly?
    There was a guide for library installation.
    https://www.arduino.cc/en/Guide/Libraries

    I believe the library is installed correctly because it works for another architecture. More specifically, the library works with the Adafruit Feather M4 which has an ATSAMD51 (i.e., ARM Cortex M4) processor. The problem seems to be that the linker cannot find the precompiled lib file for the ESP32 architecture. 

    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.

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist