2.0 KiB
2.0 KiB
Creating cross-compilers
This folder contains configuration, scripts and docker images used in the creation of cross-compilers and a cross-compilation environment. The intended use case is that these scripts can be used to very easilly create an environment where we can build software for different platforms. Docker is being used to create a contained reproducable environment.
For these scripts and instructions to work you only need docker and the bare minimum of shell scripting support.
How to use:
- Have this repository available on your local machine
- Build the cross compiler & create a cross build environment.
cd scripts/create-cross-compiler./create-armv6-rpi-linux-gnueabihf.shThe resulting cross compiler is stored in the "build-tools" folder. There will also be a docker image created that can be used in the process of building. - Do some cross compiling
docker run -ti \
-v <PATH TO WORKSPACE>:/workspace \
bmr-cross-compiler
How to build the software:
cd /workspace
conan remote remove conancenter
conan remote add conan-upload https://artifacts.4beumer.nl/repository/conan-bmrdev/
conan remote add conan-remote https://artifacts.4beumer.nl/repository/conan-center-proxy/
conan build . -of build-cross \
-s compiler.cppstd=23 \
-s build_type=Debug \
--build=missing \
--profile:build=default \
--profile:host=/x-tools/armv6-rpi-linux-gnueabihf/conan.profile
cmake --preset conan-debug .
cmake --build ./build-cross
cmake --install ./build-cross --prefix=/workspace/build-cross-install
- Configuration needs to be provided. (environment variable: CROSS_TARGET_INFO_PATH).
- Destination location needs to be provided (environment variable: CROSS_TARGET_DST_PATH).
- Use docker volume functionality to link directories to the docker container.
docker run -ti -e CROSS_TARGET_INFO_PATH=/config -e CROSS_TARGET_DST_PATH=/dst -v ./armv6-rpi-linux:/config -v ./dst:/dst <docker image name>