Alexhuszagh / xcross

"Zero Setup" cross-compilation for C/C++. Supports numerous architectures, build systems, C standard libraries, vcpkg, and Conan.
The Unlicense
38 stars 2 forks source link

Cannot use xcross inside a Docker container #8

Open fripSide opened 3 months ago

fripSide commented 3 months ago

I tend to use containers as my development environment. Consequently, I try to run xcross in the container with the following configuration:

docker run -v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/tmp -it --name qemu-dev -h hy --privileged fripside2021/my-dev:20.04 bash

I encountered an issue where the cross-compilation toolchain is created outside the container on the host.

no such file: /tmp/xcross/.__ahuszagh_xcross_uuid_2f

Thus, I need to share the host's /tmp directory with the container using the -v /tmp:/tmp configuration. Now the container can access the toolchain. However, it still reads the files on the host OS but cannot find the files inside the container.

export CROSS_TARGET=arm64-unknown-linux-musl xcross --dir . c++ main.c -o basic aarch64-unknown-linux-musl-g++: error: main.c: No such file or directory

I want to know how to use xcross within containers. If xcross cannot be used in the container, I will have to revert to using a VM as the development environment.