pi3g / bme68x-python-library

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

Not compiling on RPi 4B with Ubuntu 20.04.04 and BSEC_2.0.6.1_Generic_Release_04302021 #12

Closed collaxo closed 2 years ago

collaxo commented 2 years ago

Hi pi3g developers,

unfortunately, following your step-by-step guide for compiling the library with BSEC didn't work out on a Raspberry Pi 4 B running Ubuntu 20.04.04 with the BSEC 2.0.6.1 library. Linking fails with -lalgobsec being incompatible:

aarch64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-aarch64-3.8/bme68xmodule.o build/temp.linux-aarch64-3.8/BME68x-Sensor-API/bme68x.o build/temp.linux-aarch64-3.8/internal_functions.o -L/usr/local/lib -LBSEC_2.0.6.1_Generic_Release_04302021/algo/normal_version/bin/RaspberryPi/PiThree_ArmV6 -lpthread -lm -lrt -lalgobsec -o build/lib.linux-aarch64-3.8/bme68x.cpython-38-aarch64-linux-gnu.so /usr/bin/ld: inkompatibles BSEC_2.0.6.1_Generic_Release_04302021/algo/normal_version/bin/RaspberryPi/PiThree_ArmV6/libalgobsec.a wird bei der Suche nach -lalgobsec übersprungen /usr/bin/ld: -lalgobsec kann nicht gefunden werden collect2: error: ld returned 1 exit status error: command 'aarch64-linux-gnu-gcc' failed with exit status 1

I guess, the issue is related to the compiler aarch64-linux-gnu-gcc. Everything worked well using arm-linux-gnueabihf-gcc on a Raspberry Pi 3 B+ with Raspbian installed. Also, I noticed that there is no "RaspberryPi/PiFour_.." folder present in the BSEC library, so it seems that there is still no release for the RPi 4B?

Unfortunately, I'm not an expert in this matter, so is anyone able to help?

Thank you! Patrick

mcalisterkm commented 2 years ago

The update from BOSCH - BSEC_2.0.6.1_Generic_Release_corrected_05092022 has support for PIThree Arm v6 and PIThree ARM v8. From that I am guessing it is 32 bit support only. The PI 4 is Arm V8a 64 bit and recent PI 3 are also Arm V8a but 32bit. So I guess its down to running 32bit code on a 64 bit OS.

There is a thread about running 32 bit libs on 64 bit linux here that might help: https://thalib.github.io/2017/02/17/32bit-no-such-a-file-or-directory/

collaxo commented 2 years ago

Alright, thank you! I'll give it a try.