09-30-2019 08:58 PM
I am using the BME680 with the ESP32-PoE and I want to use the BSEC library to get the IAQ. I have been stuck at the last step of linking the pre-built libalgobsec.a library. This is what my CMakeLists file in my BSEC components folder looks like:
set(COMPONENT_SRCS "bme680.c"
"bsec_integration.c")
set(COMPONENT_ADD_INCLUDEDIRS "include")
register_component()
add_library(algobsec STATIC IMPORTED)
set_property(TARGET algobsec PROPERTY IMPORTED_LOCATION ../lib/libalgobsec.a)
I have not done the 3 steps for linking as stated in the Integration Guide as I do not know where to find the files to which I need to make changes. I am currently getting this error when I build the project:
I would really appreciate any help to get the library running. Thank you!
Solved! Go to Solution.
10-02-2019 02:46 PM
Would you be able to share a bit more history from your logs and/or enable verbose logging? This type of error could typically be caused by a missing file or wrong file location, a missing/wrong library path in the linker argument, incorrect argument orders, etc.
10-02-2019 10:09 PM
I have uploaded a file containing the logs that are observed when I run build after a fullclean. I think the warnings occur most probably because the the variables are being used in the functions that have undefined reference. I need help with the proper linking of the .a file because I have not been able to find any help online for the ESP32 microcontroller with ESP-IDF.
10-04-2019 08:22 PM
Thank-you for sharing the output.
In your original post, I see that you are including the bsec library to your project:
@Apurva wrote:
add_library(algobsec STATIC IMPORTED)
set_property(TARGET algobsec PROPERTY IMPORTED_LOCATION ../lib/libalgobsec.a)
But in your build_output.pdf, I cannot find any reference to libalgobsec.a. Is this the expected behavior? Please make sure that the relative path used is correct. I am not familiar with ESP-IDF envrionment, could target_link_libraries([...]) possibly help as well?
10-08-2019 12:12 AM
I have tried several variations of commands in that CMakeLists file and for all of them, the build output does not reference libalgobsec.a. I have also tried with target_link_libraries:
add_library(algobsec STATIC IMPORTED)
set_property(TARGET algobsec PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/lib/libalgobsec.a)
target_link_libraries(${CMAKE_CURRENT_SOURCE_DIR}/src PUBLIC algobsec)
The error that I get is "Cannot specify link libraries for target (component path) which is not built by this project."
I tried:
add_library(algobsec STATIC IMPORTED)
set_property(TARGET algobsec PROPERTY IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/components/BSEC/lib/libalgobsec.a)
target_link_libraries(${COMPONENT_TARGET} PUBLIC algobsec)
This gave me an error - FAILED: bme680_test_with_bsec.elf. The CMakeError.log file gives this output:
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/Users/Apurva/.espressif/tools/xtensa-esp32-elf/1.22.0-80-g6c4433a5-5.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++.exe
Build flags: -mlongcalls
Id flags:
The output was:
1
c:/users/apurva/.espressif/tools/xtensa-esp32-elf/1.22.0-80-g6c4433a5-5.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: cannot find crt1-sim.o: No such file or directory
c:/users/apurva/.espressif/tools/xtensa-esp32-elf/1.22.0-80-g6c4433a5-5.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: cannot find _vectors.o: No such file or directory
c:/users/apurva/.espressif/tools/xtensa-esp32-elf/1.22.0-80-g6c4433a5-5.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: cannot find -lsim
c:/users/apurva/.espressif/tools/xtensa-esp32-elf/1.22.0-80-g6c4433a5-5.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: cannot find -lhandlers-sim
c:/users/apurva/.espressif/tools/xtensa-esp32-elf/1.22.0-80-g6c4433a5-5.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: cannot find -lhal
collect2.exe: error: ld returned 1 exit status