Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    algobsec for raspberry pi 3 running Ubuntu 64-bit

    algobsec for raspberry pi 3 running Ubuntu 64-bit

    arkadi
    Member

    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?

    Thanks!

    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/ld-linux-aarch64.so.1, 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 https://ubuntu.com/download/raspberry-pi

    Vincent
    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
    arch-test
    arm64
    armhf

    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 https://git.kernel.org/pub/scm/utils/i2c-tools/i2c-tools.git/snapshot/i2c-tools-4.2.tar.gz. 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
    BUILD_DYNAMIC_LIB ?= 0
    BUILD_STATIC_LIB ?= 1

    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.

    Vincent
    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?  

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist