08-29-2020 12:45 PM - edited 08-29-2020 01:21 PM
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
Solved! Go to Solution.
09-17-2020 04:33 AM
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.
09-17-2020 10:31 AM - edited 09-17-2020 10:37 AM
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".
09-19-2020 01:31 AM
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.
09-19-2020 12:58 PM - edited 09-19-2020 01:29 PM
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.
09-22-2020 06:25 PM
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.