Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    algobsec for raspberry pi 3 running Ubuntu 64-bit

    algobsec for raspberry pi 3 running Ubuntu 64-bit


    Hello, I'm building a binary for BME680 on Ubuntu Bionic 64-bit on Raspberry Pi 3. When linking to libalgobsec.a library from BSEC_1.4.7.4_Generic_Release\algo\normal_version\bin\RaspberryPI\PiThree_ArmV8-a-64bits folder, I get an error:

    gcc -O3 -o bsec bsec.c -li2c -L . -l:libalgobsec.a
    /usr/bin/ld: skipping incompatible ./libalgobsec.a when searching for -l:libalgobsec.a

    Any ideas?


    PS. When I extract the members from the library and check them, it shows 32-bit, not 64! Where would I get 64-bit library then?

    ar x libalgobsec.a

    file bsec_codegen_data.o
    bsec_codegen_data.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped

    20 REPLIES 20

    I think I'd just provided the compiler that I'm using in my previous post:

    file /usr/bin/aarch64-linux-gnu-gcc-7
    /usr/bin/aarch64-linux-gnu-gcc-7: ELF 64-bit LSB executable, ARM aarch64, version 1 (GNU/Linux), dynamically linked, interpreter /lib/, for GNU/Linux 3.7.0, BuildID[sha1]=3a5223b90c905cab7dc44678133d22f44650872f, stripped

    It's a default gcc compiler that comes with Ubuntu 18.08 LTS (Bionix) 64-bit linux OS for Raspberry Pi 3. Not sure which other commands you want me to provide. It can be downloaded from

    Community Moderator
    Community Moderator

    Our engineer team is taking is task and setup the environment.

    The new BSEC lib will be released by middle of Oct.

    Ok, thanks for the update. As a workaround, I was able to make 32-bit binary and run it in 64-bit Ubuntu but still having native 64-bit one would be preferred. If anybody is interested how to build 32-bit binary in 64-bit Ubuntu, I'll post it here for the record:

    1. Install and run arch-test, which will show the architectures supported by the kernel

    sudo apt install arch-test

    2. Install gcc-multilib for the second architecture (armhf - which is 32-bit arm)

    sudo apt install gcc-8-multilib-arm-linux-gnueabihf

    3. All other linked libs should be 32-bit as well. Because I use i2c library to talk to the sensor, I had to build 32-bit version of it. I downloaded the source code of libi2c from Uncompressed and edited Makefile. Note the cross-compiler name and -marm option to produce 32-bit code:

    CC := /usr/bin/arm-linux-gnueabihf-gcc-8
    CFLAGS ?= -O2 -marm

    then build the static i2c library using make.

    Finally, I compiled and statically linked my code - bsec.c file (again using  the cross-compiler from gcc-multilib and -march option) together with provided bsec_integration.c and the driver bme680.c. Note the -lm and -static options, which will statically link libm and libc:

    /usr/bin/arm-linux-gnueabihf-gcc-8 -marm -O3 -o bsec bsec.c bsec_integration.c bme680.c -L ../../i2c-tools-4.2/lib -L . -li2c -lalgobsec -lm -static

    Check the resulting binary, which should run just fine in 64-bit Ubintu kernel:

    file bsec
    bsec: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), statically linked, for GNU/Linux 3.2.0, BuildID[sha1]=0cf8e44276b114a9f271244a7b111a63c12a57f1, not stripped

    Is there any update for this? The last release for the BSEC was in July of 2020.

    I'm running the raspberry pi 4, not sure if there is any plan to support that as well.

    Community Moderator
    Community Moderator

    Sorry, this task was delayed.  Estimate delivery time will be end of Feb.  

    Since you are switching to Pi4,  should we close this and switch to Pi4 instead?