Bosch Sensortec Community

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

    Error compiling BSEC on ESP8266 with Arduino IDE

    Davide
    Member

    Error compiling BSEC on ESP8266 with Arduino IDE

    Hi everyone,
    I would kindly need support for compiling a script for the ESP8266 controller with Arduino IDE.
    I have a BME680 sensor connected to a NodeMCU 8266 controller and some time ago I already created a working script to read the air quality index (Arduino IDE 1.8.11 and I don't remember which version of BSEC).
    Today I tried to load the same script again with Arduino IDE 1.8.12 and BSEC 1.4.7.4, but there is no way to compile it, I always find the same error. Also trying with basic example provided with BSEC library.
    I read on the internet that there are problems with the IDE 1.8.12, so I tried to remove it completely (even doing folder cleaning) and to install version 1.8.9, but unfortunately without success.
    I state that I have applied exactly the indications for Arduino contained in the pdf present in the BSEC package.
    I replaced the arduino-builder-219.exe file, modified the platform.txt and eagle.app.v6.common.ld files as indicated and placed the libalgobsec.a files in the BSEC library folder (trying both the normal and light version).
    Despite this, I find the following error:
    ***************************************************************************************************************************************************
    Arduino:1.8.9 (Windows 10), Scheda:"NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"
    c:/users/david/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\bsec\bsec.cpp.o: in function `Bsec::i2cRead(unsigned char, unsigned char, unsigned char*, unsigned short)':
    C:\Users\david\Documents\Arduino\libraries\bsec\src/bsec.cpp:442: undefined reference to `bsec_init'
    c:/users/david/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\david\Documents\Arduino\libraries\bsec\src/bsec.cpp:442: undefined reference to `bsec_get_version'
    c:/users/david/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\bsec\bsec.cpp.o: in function `Bsec::beginCommon()':
    C:\Users\david\Documents\Arduino\libraries\bsec\src/bsec.cpp:448: undefined reference to `bsec_init'
    c:/users/david/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\david\Documents\Arduino\libraries\bsec\src/bsec.cpp:133: undefined reference to `bsec_get_version'
    c:/users/david/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\bsec\bsec.cpp.o: in function `Bsec::begin(unsigned char, TwoWire&)':
    C:\Users\david\Documents\Arduino\libraries\bsec\src/bsec.cpp:104: undefined reference to `bsec_update_subscription'
    c:/users/david/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\bsec\bsec.cpp.o: in function `Bsec::updateSubscription(bsec_virtual_sensor_t*, unsigned char, float)':
    C:\Users\david\Documents\Arduino\libraries\bsec\src/bsec.cpp:155: undefined reference to `bsec_update_subscription'
    c:/users/david/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\bsec\bsec.cpp.o: in function `Bsec::Bsec()':
    C:\Users\david\Documents\Arduino\libraries\bsec\src/bsec.cpp:70: undefined reference to `bsec_do_steps'
    c:/users/david/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\bsec\bsec.cpp.o: in function `Bsec::readProcessData(long long, bsec_bme_settings_t)':
    C:\Users\david\Documents\Arduino\libraries\bsec\src/bsec.cpp:288: undefined reference to `bsec_do_steps'
    c:/users/david/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\bsec\bsec.cpp.o:(.text._ZN4Bsec3runEv+0x4): undefined reference to `bsec_sensor_control'
    c:/users/david/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\bsec\bsec.cpp.o: in function `Bsec::run()':
    C:\Users\david\Documents\Arduino\libraries\bsec\src/bsec.cpp:166: undefined reference to `bsec_sensor_control'
    collect2.exe: error: ld returned 1 exit status
    exit status 1
    ***************************************************************************************************************************************************
    Could anyone kindly help me?
    Thanks
    Yours sincerely
    David
    15 REPLIES 15
    Davide
    Member

    Re: Error compiling BSEC on ESP8266 with Arduino IDE

    I am doing some tests and I noticed that the error is upstream ...
    If I do an empty sketch where I only include the library with #include "bsec.h" the compiler does not give errors (so the library is supposed to be read correctly).
    But as soon as I create an object of class Bsec with the code "Bsec iaqSensor;" then the compiler gives error (the following to be precise).

    ********************************************************************************************************************************************************

    Arduino:1.8.9 (Windows 10), Scheda:"NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

    c:/users/david/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: sketch\basic.ino.cpp.o:(.text.startup._GLOBAL__sub_I_iaqSensor+0x8): undefined reference to `Bsec::Bsec()'

    c:/users/david/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: sketch\basic.ino.cpp.o: in function `_GLOBAL__sub_I_iaqSensor':

    C:\Users\david\AppData\Local\Temp\arduino_modified_sketch_894290/basic.ino:19: undefined reference to `Bsec::Bsec()'

    collect2.exe: error: ld returned 1 exit status

    exit status 1
    Errore durante la compilazione per la scheda NodeMCU 1.0 (ESP-12E Module).

    ********************************************************************************************************************************************************

    Yannbou
    New Poster

    Re: Error compiling BSEC on ESP8266 with Arduino IDE

    Hello,

    I have the same issue and I am completly stuck. Tests done with IDE1.8.11

    Compiling the "basic example" for Arduino Mega is OK but download not tested as I don't have got one

    Compiling for "basic example" ESP8266 give the same error as Davide.

    Compiling an empty sketch with only #include "bsec.h"  and the object of class Bsec declared with the code "Bsec iaqSensor;"  is OK

    Issue begin when I add "iaqSensor.begin(BME680_I2C_ADDR_PRIMARY, Wire); "  (see sketch hereunder). When compilator starts part "Linking everything together..."

    ******sketch***************************************************************

    #include "bsec.h"
    Bsec iaqSensor;
    String output;

    void setup(void)
    {
    Serial.begin(115200);
    Wire.begin();
    iaqSensor.begin(BME680_I2C_ADDR_PRIMARY, Wire);
    }

    void loop(void)
    {

    }

    ********************Errors returned******************

    c:/users/ybourdais/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\YBOURD~1\AppData\Local\Temp\arduino_build_117553\libraries\BSEC-Arduino-library-master\bsec.cpp.o: in function `Bsec::i2cRead(unsigned char, unsigned char, unsigned char*, unsigned short)':

    C:\Users\ybourdais\Documents\Arduino\libraries\BSEC-Arduino-library-master\src/bsec.cpp:552: undefined reference to `bsec_init'

    c:/users/ybourdais/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\ybourdais\Documents\Arduino\libraries\BSEC-Arduino-library-master\src/bsec.cpp:561: undefined reference to `bsec_get_version'

    c:/users/ybourdais/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\YBOURD~1\AppData\Local\Temp\arduino_build_117553\libraries\BSEC-Arduino-library-master\bsec.cpp.o: in function `Bsec::beginCommon()':

    C:\Users\ybourdais\Documents\Arduino\libraries\BSEC-Arduino-library-master\src/bsec.cpp:155: undefined reference to `bsec_init'

    c:/users/ybourdais/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\ybourdais\Documents\Arduino\libraries\BSEC-Arduino-library-master\src/bsec.cpp:158: undefined reference to `bsec_get_version'

    collect2.exe: error: ld returned 1 exit status

    Utilisation de la bibliothèque BSEC-Arduino-library-master version 1.5.1474 dans le dossier: C:\Users\ybourdais\Documents\Arduino\libraries\BSEC-Arduino-library-master
    Utilisation de la bibliothèque Wire version 1.0 dans le dossier: C:\Users\ybourdais\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.1\libraries\Wire
    Utilisation de la bibliothèque SPI version 1.0 dans le dossier: C:\Users\ybourdais\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.1\libraries\SPI
    exit status 1
    Erreur de compilation pour la carte Generic ESP8266 Module

     

    Thank you for your help

    Yann

    handytech
    Community Moderator

    Re: Error compiling BSEC on ESP8266 with Arduino IDE

    When using Arduino IDE v1.8.9, it is no longer needed to replace the arduino-builder ".exe" file as it supports libraries by default, but you still need to manually add the "compiler.libraries.ldflags" to your platform.txt file and "*libalgobsec.a:(.literal.* .text.*)" to your eagle.app.v6.common.ld.h  file.

    It would be helpful to enable verbose and share some data from the console log to verify that the BSEC library is successfully included in your toolchain, especially the linking command(s) under "Linking everything together...". For example in my setup, the last two arguments shown below indicate the valid path to my libalgobsec.a file for the ESP8266 and that the library is effectively included:

    Linking everything together...
    [...]
    [...] -lm -lc -lgcc "-LC:\\Users\\user\\Documents\\Arduino\\libraries\\BSEC_Software_Library\\src\\esp8266" -lalgobsec [...]
    [...]
    Creating BIN file [...]

     

    Davide
    Member

    Re: Error compiling BSEC on ESP8266 with Arduino IDE

    Hi,

    thanks for your answer.

    Here is the detailed error message (full version should be attached, but not sure it's loaded correctly... I can't see it in the post).

    I specify that in my case, unlike Yannbou, the error appears if I declare Bsec iaqSensor; (in his case fill in correctly with this declaration).

    ************************************************************************************************************************

    Linking everything together...
    "C:\\Users\\david\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\2.5.0-4-b40a506/bin/xtensa-lx106-elf-gcc" -CC -E -P -DVTABLES_IN_FLASH "C:\\Users\\david\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.1/tools/sdk/ld/eagle.app.v6.common.ld.h" -o "C:\\Users\\david\\AppData\\Local\\Temp\\arduino_build_524158/local.eagle.app.v6.common.ld"
    "C:\\Users\\david\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\2.5.0-4-b40a506/bin/xtensa-lx106-elf-gcc" -fno-exceptions -Wl,-Map "-Wl,C:\\Users\\david\\AppData\\Local\\Temp\\arduino_build_524158/basic.ino.map" -g -w -Os -nostdlib -Wl,--no-check-sections -u app_entry -u _printf_float -u _scanf_float -Wl,-static "-LC:\\Users\\david\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.1/tools/sdk/lib" "-LC:\\Users\\david\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.1/tools/sdk/lib/NONOSDK22x_190703" "-LC:\\Users\\david\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.1/tools/sdk/ld" "-LC:\\Users\\david\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.1/tools/sdk/libc/xtensa-lx106-elf/lib" -Teagle.flash.4m2m.ld -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,spi_flash_read -o "C:\\Users\\david\\AppData\\Local\\Temp\\arduino_build_524158/basic.ino.elf" -Wl,--start-group "C:\\Users\\david\\AppData\\Local\\Temp\\arduino_build_524158\\sketch\\basic.ino.cpp.o" "C:\\Users\\david\\AppData\\Local\\Temp\\arduino_build_524158\\libraries\\Wire\\Wire.cpp.o" "C:\\Users\\david\\AppData\\Local\\Temp\\arduino_build_524158\\libraries\\SPI\\SPI.cpp.o" "C:\\Users\\david\\AppData\\Local\\Temp\\arduino_build_524158\\core\\core.a" -lhal -lphy -lpp -lnet80211 -llwip2-536-feat -lwpa -lcrypto -lmain -lwps -lbearssl -laxtls -lespnow -lsmartconfig -lairkiss -lwpa2 -lstdc++ -lm -lc -lgcc "-LC:\\Users\\david\\Documents\\Arduino\\libraries\\BSEC-Arduino-library-1.5.1474\\src\\esp8266" -lalgobsec -lalgobsec -Wl,--end-group "-LC:\\Users\\david\\AppData\\Local\\Temp\\arduino_build_524158"
    c:/users/david/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\david\AppData\Local\Temp\arduino_build_524158\sketch\basic.ino.cpp.o:(.text.startup._GLOBAL__sub_I_iaqSensor+0x4): undefined reference to `Bsec::Bsec()'

    c:/users/david/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\david\AppData\Local\Temp\arduino_build_524158\sketch\basic.ino.cpp.o: in function `_GLOBAL__sub_I_iaqSensor':

    C:\Users\david\AppData\Local\Temp\arduino_modified_sketch_401029/basic.ino:4: undefined reference to `Bsec::Bsec()'

    collect2.exe: error: ld returned 1 exit status

    Uso la libreria BSEC-Arduino-library-1.5.1474 alla versione 1.5.1474 nella cartella: C:\Users\david\Documents\Arduino\libraries\BSEC-Arduino-library-1.5.1474
    Uso la libreria Wire alla versione 1.0 nella cartella: C:\Users\david\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.1\libraries\Wire
    Uso la libreria SPI alla versione 1.0 nella cartella: C:\Users\david\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.1\libraries\SPI
    exit status 1
    Errore durante la compilazione per la scheda NodeMCU 1.0 (ESP-12E Module).

    ************************************************************************************************************************

    For completeness I also insert the parts of the modified platform.txt and eagle.ld files (maybe they are wrong ...).

    eagle.PNG

    platform1.PNGplatform2.PNG

    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