2022-12-04 10:59 AM
Hello, I am doing a little bit of cross compiling but I have a problem with the linux interpreter. I am using the openstlinux-weston distro with the ld-linux-armhf.so.3 but the binaries after coming out of my cross compilation are using ld-linux.so.3. I need a little bit of hints here how to make it proper.
here's my cmake toolchain and cmake itself it's just stupid example to compile simple hello world print out. Thank everybody in advance :)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_C_COMPILER /usr/bin/arm-linux-gnueabi-gcc)
2022-12-05 01:51 PM
Hello @binarybee,
There is no blocker to use CMake for cross-compilation. Are you sure to have the SDK sourced before trying to execute the make command ?
I am not sure that you have to precise the CMAKE_C_COMPILER. In fact you have almost nothing to do if you well sourced the SDK. CMake will do it for you (in the case of a simple example like you. In more complete and complexe project, you will have to document yourself about CMake usage).
Let's try with a very simple example described at the following link (that is not from me) https://lappweb.in2p3.fr/~paubert/ASTERICS_HPC/2-2-100.html
Source your SDK as follow:
PC$> source <SDK_DIR>/environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
Then just follow the steps described in the precedent link. You will see that the Makefile generated by CMake is perfectly usable for cross compilation. If you check your binary with file <your_bin> you will see that it has been compiled for ARM:
PC$> file hello_world
> hello_world: ELF 32-bit LSB executable, ARM <.....>
I hope that this information will help you. Come back to me if you still have troubles.
Kind regards,
Erwan.
In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'