pi3g / bme68x-python-library

Python 3 Library for BME688 and BME680 (Bosch Sensortec sensors), supports Bosch BSEC
MIT License
45 stars 18 forks source link

Can't Compile because of Library Update? #14

Open Proktologe opened 2 years ago

Proktologe commented 2 years ago

The new Version is: BSEC_2.0.6.1_Generic_Release_corrected_05092022 but your Compile Scripts is looking for:
BSEC_2.0.6.1_Generic_Release_04302021

I tried to change the Name of my current downloaded file to your version but this gives me the following error result (in terminal after enter sudo python3 setup.py install):

arm-linux-gnueabihf-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 build/temp.linux-armv7l-cpython-39/BME68x-Sensor-API/bme68x.o build/temp.linux-armv7l-cpython-39/bme68xmodule.o build/temp.linux-armv7l-cpython-39/internal_functions.o -L/usr/local/lib -LBSEC_2.0.6.1_Generic_Release_04302021/algo/normal_version/bin/RaspberryPi/PiThree_ArmV6/bsec_interface.h -L/usr/lib -lpthread -lm -lrt -lalgobsec -o build/lib.linux-armv7l-cpython-39/bme68x.cpython-39-arm-linux-gnueabihf.so
/usr/bin/ld: cannot find -lalgobsec
collect2: error: ld returned 1 exit status
error: command '/usr/bin/arm-linux-gnueabihf-gcc' failed with exit code 1
mcalisterkm commented 2 years ago

I saw the same issue in that Bosch have issued an update that has the following directory name: BSEC_2.0.6.1_Generic_Release_corrected_05092022. My sd-card failed and I rebuilt a new card last week. I renamed the folder to match the old release name BSEC_2.0.6.1_Generic_Release_04302021 and it built succesfully with the usual warnings.
You did built yours as root or with sudo?

I looked for your missing file and in my system (raspbian bullseye) it is a symbolic link to gcc10: /usr/bin/arm-linux-gnueabihf-gcc -> gcc-10

Hope this helps

Regards Keith

mcalisterkm commented 2 years ago

Are you running a PI 4 and 64 bit OS?

Proktologe commented 2 years ago

Are you running a PI 4 and 64 bit OS?

No, Raspberry Pi OS 32 Bit, on a Pi 400

mcalisterkm commented 2 years ago

OK So the PI 400 is a 4GB PI4 overclocked with a large heatsink in a keyboard shell. I just checked and my PI 4's are running Buster. Here is a succesful build on a 32 bit buster PI4 with 4GB. I use FileZilla to copy the PI3G 1.3 code from April 2022 (v1.3) and the latest Bosch release BSEC_2.0.6.1_Generic_Release_corrected_05092022 to the PI.

Check your version of the PI OS matches

root@PI4-3:/home/pi/bme68x-python-library-main# cat /etc/os-release PRETTY_NAME="Raspbian GNU/Linux 10 (buster)" NAME="Raspbian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster 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"

I run $sudo su - to get root as.

Your folder should look like this:

root@PI4-3:/home/pi/bme68x-python-library-main# ls -l total 156 -rw-r--r-- 1 pi pi 2863 Jun 5 19:35 bme68xConstants.py -rw-r--r-- 1 pi pi 77891 Jun 5 19:35 bme68xmodule.c drwxr-xr-x 3 pi pi 4096 Jun 5 19:35 BME68x-Sensor-API drwxr-xr-x 6 pi pi 4096 Jun 5 19:36 BSEC_2.0.6.1_Generic_Release_corrected_05092022 -rw-r--r-- 1 pi pi 571 Jun 5 19:35 bsecConstants.py -rw-r--r-- 1 pi pi 12875 Jun 5 19:35 Documentation.md drwxr-xr-x 2 pi pi 4096 Jun 5 19:35 examples -rw-r--r-- 1 pi pi 17983 Jun 5 19:35 internal_functions.c -rw-r--r-- 1 pi pi 2545 Jun 5 19:35 internal_functions.h -rw-r--r-- 1 pi pi 1065 Jun 5 19:35 LICENSE -rw-r--r-- 1 pi pi 2500 Jun 5 19:35 README.md -rw-r--r-- 1 pi pi 2316 Jun 5 19:35 setup.py drwxr-xr-x 3 pi pi 4096 Jun 5 19:35 tools root@PI4-3:/home/pi/bme68x-python-library-main#

Here is the first error due to the BSEC release name change

building 'bme68x' extension creating build/temp.linux-armv7l-3.7 creating build/temp.linux-armv7l-3.7/BME68x-Sensor-API arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include -I/usr/include/python3.7m -c bme68xmodule.c -o build/temp.linux-armv7l-3.7/bme68xmodule.o -D BSEC In file included from bme68xmodule.c:4: internal_functions.h:22:10: fatal error: BSEC_2.0.6.1_Generic_Release_04302021/algo/normal_version/bin/RaspberryPi/PiThree_ArmV6/bsec_interface.h: No such file or directory

include "BSEC_2.0.6.1_Generic_Release_04302021/algo/normal_version/bin/RaspberryPi/PiThree_ArmV6/bsec_interface.h"

      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

compilation terminated.

Correct the folder name as follows

root@PI4-3:/home/pi/bme68x-python-library-main# mv BSEC_2.0.6.1_Generic_Release_corrected_05092022 BSEC_2.0.6.1_Generic_Release_04302021

And it should now look like this:

root@PI4-3:/home/pi/bme68x-python-library-main# ls -l total 164 -rw-r--r-- 1 pi pi 2863 Jun 5 19:35 bme68xConstants.py drwxr-xr-x 2 root root 4096 Jun 5 19:40 bme68x.egg-info -rw-r--r-- 1 pi pi 77891 Jun 5 19:35 bme68xmodule.c drwxr-xr-x 3 pi pi 4096 Jun 5 19:35 BME68x-Sensor-API drwxr-xr-x 6 pi pi 4096 Jun 5 19:36 BSEC_2.0.6.1_Generic_Release_04302021 -rw-r--r-- 1 pi pi 571 Jun 5 19:35 bsecConstants.py drwxr-xr-x 4 root root 4096 Jun 5 19:40 build -rw-r--r-- 1 pi pi 12875 Jun 5 19:35 Documentation.md drwxr-xr-x 2 pi pi 4096 Jun 5 19:35 examples -rw-r--r-- 1 pi pi 17983 Jun 5 19:35 internal_functions.c -rw-r--r-- 1 pi pi 2545 Jun 5 19:35 internal_functions.h -rw-r--r-- 1 pi pi 1065 Jun 5 19:35 LICENSE -rw-r--r-- 1 pi pi 2500 Jun 5 19:35 README.md -rw-r--r-- 1 pi pi 2316 Jun 5 19:35 setup.py drwxr-xr-x 3 pi pi 4096 Jun 5 19:35 tools root@PI4-3:/home/pi/bme68x-python-library-main#

Run again:

root@PI4-3:/home/pi/bme68x-python-library-main# 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 -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include -I/usr/include/python3.7m -c bme68xmodule.c -o build/temp.linux-armv7l-3.7/bme68xmodule.o -D BSEC bme68xmodule.c:11: warning: "BSEC" redefined

define BSEC

............

There are a bunch of warnings about redifined variables but it succeeds: .........

Installed /usr/local/lib/python3.7/dist-packages/bme68x-1.3.0-py3.7-linux-armv7l.egg Processing dependencies for bme68x==1.3.0 Finished processing dependencies for bme68x==1.3.0 root@PI4-3:/home/pi/bme68x-python-library-main#

If you can't get this start with a clean raspbian install, and work from that.

Keith

mcalisterkm commented 2 years ago

I used pip3 to uninstall , copied in the new library 2.2.0.0 then renamed it and built it using python3 setup.py install and it works. Perhaps that is not a clean enough build to see your issues.

mcalisterkm commented 2 years ago

I have cleaned up and built from scratch and I see the two errors mentioned: bme68xmodule.c:388:52: error: ‘BSEC_SAMPLE_RATE_HIGH_PERFORMANCE’ undeclared bme68xmodule.c:1069:42: error: ‘BSEC_OUTPUT_COMPENSATED_GAS’ undeclared

These are due to changes in the BOSCH header bsec_datatypes.h a) BOSCH have renamed BSEC_SAMPLE_RATE_HIGH_PERFORMANCE’ to BSEC_SAMPLE_RATE_SCAN b) BOSCH have deleted BSEC_OUTPUT_COMPENSATED_GAS from the enumerated list of virtual sensors.

The changes BOSCH have made at BSEC 2.2.0 breaks bme68x v 1.3, and I think we need a new version of bme68x to support BSEC 2.2.0.