Trouble configuring project for BME 688 sensor and nrf52840

SDK version - v2.7.0

Project repository

Hi! I am a junior embedded systems software developer, and I just started working with Nordic's environment. This is my first time using an external library, and I’m having trouble with the BME68X sensor.

I began by creating a new application by copying the "BME68X Sensor Sample" and quickly realized that I needed to download the external library separately, which I did.

I proceeded to download the BME68X library and placed the relevant files in the location shown at the end of this post (see the CMakeLists.txt content). I also downloaded the BSEC static library. Then I built the project to check for any errors, and I encountered the following:


-- Configuring done
-- Generating done
-- Build files have been written to: /Users/emericopedrazagomez/Documents/zephyr/bme68x_iaq/build
-- west build: building application
ninja: error: '/opt/nordic/ncs/v2.7.0/modules/lib/bsec/src/cortex-m4/fpv4-sp-d16-hard/libalgobsec.a', needed by 'zephyr/zephyr_pre0.elf', missing and no known rule to make it
FATAL ERROR: command exited with status 1: /opt/nordic/ncs/toolchains/f8037e9b83/bin/cmake --build /Users/emericopedrazagomez/Documents/zephyr/bme68x_iaq/build


I don’t fully understand how to include external pre-compiled libraries yet. Based on this example, it seems that I just need to add the location of the .a file and the directory of the other files using the library. So I added the following lines to my CMakeLists.txt:

add_library(mylibalgobsec STATIC IMPORTED GLOBAL)
set_target_properties(mylibalgobsec PROPERTIES IMPORTED_LOCATION {$LIB_DIR}/BSEC/algo/bsec_IAQ/bin/gcc/Cortex_M4/libalgobsec.a)
set_target_properties(mylibalgobsec PROPERTIES INTERFACE_INCLUDE_DIRECTORIES /opt/nordic/ncs/v2.7.0/modules/lib/bme68x/src/bme68x)
target_link_libraries(app PUBLIC mylibalgobsec)

However, I’m still getting the same error when building the application. Why do I need to use the location shown in the error?

I tried moving the files to that location, which resulted in different errors, but I’d like to understand what I’m doing wrong here first.

I apologize if this question seems basic—any help would be appreciated!

Related