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

    Vincent
    Community Moderator
    Community Moderator

    We are using the following compiler option:

    Compiler: gcc-linaro-arm-linux-gnueabihf-raspbian-x64

    Command: -c -march=armv8-a/armv6 -mfloat-abi=hard -mfpu=vfp -mtls-dialect=gnu

    Can you cross check if it matches your complier option?  if not,  please provide your option to us. 

     

    You are using 32-bit compiler. It is not easy to compile 64-bit binary on 32-bit system but possible using "-m64" option with multilib gcc installed, you will need to have all other libraries 64-bit. It is much easier to compile on the 64-bit system, then you don't need to worry about 64-bit libraries.

    For more info, see stackoverflow article "How to compile 64-bit binary on 32-bit software".

    Vincent
    Community Moderator
    Community Moderator

    I double confirmed with our engineer for this question. 

    Actually, we are compiling on a 64-bit machine and the compiler is also 64-bit as github showing: https://github.com/raspberrypi/tools/tree/master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian...

    The command -m64 is not recognized in this compiler.

    Please provide the compiler name or the complete correct compiler command on your platform so we can double check this.

     
     
     

     

     

     

     

     

     

    Well, then why does it produce 32-bit binaries? It is easy to verify, step by step:

    1. Download and unzip the file that you provided:

    unzip BSEC_1.4.8.0_Raspb_x64_Release_20200904.zip

    2. Extract binary objects from the static library libalgobsec.a with ar

    ar x libalgobsec.a

    3. Verify the bitness of binary objects

    cd BSEC_1.4.8.0_Raspb_x64_Release_20200904/algo/normal/bin/RaspberryPi/x64/PiThree_ArmV8

    for f in `ls *.o`; do file $f; done

    Bsec.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    Channel.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    ChannelHub.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    Entity.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    ExpSmoothing.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    ExpSmoothingBsec.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    GasHumidityBaselineTracker.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    GasHumidityPreProcessor.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    HumidityTemperatureCorrector.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    IaqEstimator.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    SensorHeatCompensator.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    SensorStatusTracker.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    Serialization.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    absHum.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    applyScalarFunctionInPlace.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    bsec_codegen_data.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    bsec_codegen_do_steps.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    bsec_codegen_get_configuration.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    bsec_codegen_get_state.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    bsec_codegen_get_version.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    bsec_codegen_init.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    bsec_codegen_reset_output.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    bsec_codegen_rtwutil.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    bsec_codegen_sensor_control.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    bsec_codegen_set_configuration.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    bsec_codegen_set_state.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    bsec_codegen_update_subscription.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    bsec_interface.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    constructor_bsec.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    convertHumidity.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    crcCcitt2.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    isequal.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    log.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    log10.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    polyval.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    sin.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped
    sqrt.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped

    As you see, they all 32-bit binaries (ELF 32-bit)!

    I suspect that even your hardware is 64-bit (if it is Raspberry PI 3, then for sure it is 64-bit) but your OS is 32-bit. Is it Rasperrian? Just simply run the "file" command on your gcc compiler binary to verify it. Here is what mine shows:

    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

    As you see, mine is 64-bit compiler (ELF 64-bit LSB executable).

    PS. For -m64 to work, you may need to install gcc-multilib libraries.

    Vincent
    Community Moderator
    Community Moderator

    RaspberrPi set 32-bit as default. The cross compiler is published on github as: https://github.com/raspberrypi/tools/tree/master

    This means we only enabled 32-bit supporting armv8-a/armv6.

    From your description,  you are using arch64-linux-gnu-gcc to compile which we currently don't have. 

    So please provide your desired complier here with all the commands you are using in order to enable us to build special version for you. 

    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