Skip to content

Compilation fails with BSEC_2.2.0.0_Generic_Release_30052022 #17

Description

@falste

I followed the "How to install the extension with BSEC" readme steps. I am using BSEC_2.2.0.0_Generic_Release_30052022. Since the BSEC library name changes depending on version (see also #14), I just named the folder libbsec and changed the following files:

Click to expand
$ git diff
diff --git a/bme68xmodule.c b/bme68xmodule.c
index d43671b..999286e 100644
--- a/bme68xmodule.c
+++ b/bme68xmodule.c
@@ -18,7 +18,7 @@ uint8_t bsec_state[BSEC_MAX_STATE_BLOB_SIZE];
 uint8_t work_buffer[BSEC_MAX_WORKBUFFER_SIZE];
 uint32_t bsec_state_len = 0;
 bsec_library_return_t bsec_status = BSEC_OK;
-const char *bsec_conf_path = "BSEC_2.0.6.1_Generic_Release_04302021/config/bsec_sel_iaq_33v_4d/2021_04_29_02_51_bsec_h2s_nonh2s_2_0_6_1 .config";
+const char *bsec_conf_path = "libbsec/config/bsec_sel_iaq_33v_4d/2021_04_29_02_51_bsec_h2s_nonh2s_2_0_6_1 .config";
 FILE *bsec_conf;
 #endif

diff --git a/internal_functions.h b/internal_functions.h
index 9bc1c6e..934f109 100644
--- a/internal_functions.h
+++ b/internal_functions.h
@@ -19,8 +19,8 @@
 #include "BME68x-Sensor-API/bme68x_defs.h"

 #ifdef BSEC
-#include "BSEC_2.0.6.1_Generic_Release_04302021/algo/normal_version/bin/RaspberryPi/PiThree_ArmV6/bsec_interface.h"
-#include "BSEC_2.0.6.1_Generic_Release_04302021/algo/normal_version/bin/RaspberryPi/PiThree_ArmV6/bsec_datatypes.h"
+#include "libbsec/algo/normal_version/bin/RaspberryPi/PiThree_ArmV6/bsec_interface.h"
+#include "libbsec/algo/normal_version/bin/RaspberryPi/PiThree_ArmV6/bsec_datatypes.h"
 #endif

 /* CPP guard */
diff --git a/setup.py b/setup.py
index e41a4e3..27c66d3 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ if BSEC:
     ext_comp_args = ['-D BSEC']
     libs = ['pthread', 'm', 'rt', 'algobsec']
     lib_dirs = ['/usr/local/lib',
-                'BSEC_2.0.6.1_Generic_Release_04302021/algo/normal_version/bin/RaspberryPi/PiThree_ArmV6']
+                'libbsec/algo/normal_version/bin/RaspberryPi/PiThree_ArmV6']
 else:
     ext_comp_args = []
     libs = ['pthread', 'm', 'rt']
@@ -49,7 +49,7 @@ setup(name='bme68x',
       py_modules=['bme68xConstants', 'bsecConstants'],
       package_data={
           'bme68x': [
-               'BSEC_2.0.6.1_Generic_Release_04302021/config/bsec_sel_iaq_33v_4d/2021_04_29_02_51_bsec_h2s_nonh2s_2_0_6_1 .config',
+               'libbsec/config/bsec_sel_iaq_33v_4d/2021_04_29_02_51_bsec_h2s_nonh2s_2_0_6_1 .config',
           ]
       },
       headers=['BME68x-Sensor-API/bme68x.h',

Sadly, the installation still fails, mainly because BSEC_SAMPLE_RATE_HIGH_PERFORMANCE and BSEC_OUTPUT_COMPENSATED_GAS are undeclared:

Click to expand
bme68x-python-library $ sudo python3 setup.py install
running install
running bdist_egg
running egg_info
writing bme68x.egg-info/PKG-INFO
writing dependency_links to bme68x.egg-info/dependency_links.txt
writing top-level names to bme68x.egg-info/top_level.txt
reading manifest file 'bme68x.egg-info/SOURCES.txt'
writing manifest file 'bme68x.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-armv7l/egg
running install_lib
running build_py
running build_ext
building 'bme68x' extension
arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include -I/usr/include/python3.9 -c BME68x-Sensor-API/bme68x.c -o build/temp.linux-armv7l-3.9/BME68x-Sensor-API/bme68x.o -D BSEC
arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include -I/usr/include/python3.9 -c bme68xmodule.c -o build/temp.linux-armv7l-3.9/bme68xmodule.o -D BSEC
bme68xmodule.c:11: warning: "BSEC" redefined
   11 | #define BSEC
      |
<command-line>: note: this is the location of the previous definition
bme68xmodule.c: In function ‘bme_get_sensor_id’:
bme68xmodule.c:338:50: warning: passing argument 2 of ‘bme68x_get_regs’ from incompatible pointer type [-Wincompatible-pointer-types]
  338 |     rslt = bme68x_get_regs(BME68X_REG_UNIQUE_ID, &id_regs, len, &(self->bme));
      |                                                  ^~~~~~~~
      |                                                  |
      |                                                  uint8_t (*)[4] {aka unsigned char (*)[4]}
In file included from internal_functions.h:18,
                 from bme68xmodule.c:4:
BME68x-Sensor-API/bme68x.h:122:51: note: expected ‘uint8_t *’ {aka ‘unsigned char *’} but argument is of type ‘uint8_t (*)[4]’ {aka ‘unsigned char (*)[4]’}
  122 | int8_t bme68x_get_regs(uint8_t reg_addr, uint8_t *reg_data, uint32_t len, struct bme68x_dev *dev);
      |                                          ~~~~~~~~~^~~~~~~~
bme68xmodule.c: In function ‘bme_subscribe_gas_estimates’:
bme68xmodule.c:388:52: error: ‘BSEC_SAMPLE_RATE_HIGH_PERFORMANCE’ undeclared (first use in this function)
  388 |         requested_virtual_sensors[i].sample_rate = BSEC_SAMPLE_RATE_HIGH_PERFORMANCE;
      |                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bme68xmodule.c:388:52: note: each undeclared identifier is reported only once for each function it appears in
bme68xmodule.c: In function ‘bme_subscribe_ai_classes’:
bme68xmodule.c:408:48: error: ‘BSEC_SAMPLE_RATE_HIGH_PERFORMANCE’ undeclared (first use in this function)
  408 |     requested_virtual_sensors[0].sample_rate = BSEC_SAMPLE_RATE_HIGH_PERFORMANCE;
      |                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bme68xmodule.c: In function ‘bme_bsec_process_data’:
bme68xmodule.c:820:15: warning: unused variable ‘data’ [-Wunused-variable]
  820 |     PyObject *data = PyDict_New();
      |               ^~~~
bme68xmodule.c:818:13: warning: unused variable ‘num_bsec_outputs’ [-Wunused-variable]
  818 |     uint8_t num_bsec_outputs = 0;
      |             ^~~~~~~~~~~~~~~~
bme68xmodule.c:817:19: warning: unused variable ‘bsec_outputs’ [-Wunused-variable]
  817 |     bsec_output_t bsec_outputs[BSEC_NUMBER_OUTPUTS];
      |                   ^~~~~~~~~~~~
bme68xmodule.c:740:18: warning: variable ‘inputs’ set but not used [-Wunused-but-set-variable]
  740 |     bsec_input_t inputs[BSEC_MAX_PHYSICAL_SENSOR];
      |                  ^~~~~~
bme68xmodule.c:821:1: warning: no return statement in function returning non-void [-Wreturn-type]
  821 | }
      | ^
bme68xmodule.c: In function ‘bme_get_digital_nose_data’:
bme68xmodule.c:829:20: warning: comparison of integer expressions of different signedness: ‘int64_t’ {aka ‘long long int’} and ‘uint64_t’ {aka ‘long long unsigned int’} [-Wsign-compare]
  829 |     if (time_stamp >= self->next_call)
      |                    ^~
bme68xmodule.c:1069:42: error: ‘BSEC_OUTPUT_COMPENSATED_GAS’ undeclared (first use in this function)
 1069 |                                     case BSEC_OUTPUT_COMPENSATED_GAS:
      |                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
bme68xmodule.c: In function ‘bme_get_bsec_data’:
bme68xmodule.c:1120:20: warning: comparison of integer expressions of different signedness: ‘int64_t’ {aka ‘long long int’} and ‘uint64_t’ {aka ‘long long unsigned int’} [-Wsign-compare]
 1120 |     if (time_stamp >= self->next_call)
      |                    ^~
bme68xmodule.c:1331:34: error: ‘BSEC_OUTPUT_COMPENSATED_GAS’ undeclared (first use in this function)
 1331 |                             case BSEC_OUTPUT_COMPENSATED_GAS:
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
bme68xmodule.c: In function ‘bme_enable_gas_estimates’:
bme68xmodule.c:1587:48: error: ‘BSEC_SAMPLE_RATE_HIGH_PERFORMANCE’ undeclared (first use in this function)
 1587 |     requested_virtual_sensors[0].sample_rate = BSEC_SAMPLE_RATE_HIGH_PERFORMANCE;
      |                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At top level:
bme68xmodule.c:737:18: warning: ‘bme_bsec_process_data’ defined but not used [-Wunused-function]
  737 | static PyObject *bme_bsec_process_data(BMEObject *self, bsec_bme_settings_t *sensor_settings, uint8_t i, int64_t time_stamp)
      |                  ^~~~~~~~~~~~~~~~~~~~~
error: command '/usr/bin/arm-linux-gnueabihf-gcc' failed with exit code 1

I guess it is ignoring the bsecConstants.py, because BSEC_SAMPLE_RATE_HIGH_PERFORMANCE is defined there, but I am not sure what the deal with BSEC_OUTPUT_COMPENSATED_GAS is.

My system:

$ uname -a
Linux raspberrypi 5.15.70-v7l+ #1590 SMP Tue Sep 27 15:58:00 BST 2022 armv7l GNU/Linux
$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions