Is any cross compilation tool still supported?

Hi, I’ve been trying to get a cross-compilation toolchain working with gitlab CI at work. Primarily for musl and Windows. I’ve been working on it for about a week, and it’s just been a constant stream of issues.

Also complicating the effort is that this toolchain builds a C++ library, so I need g++ working instead of just gcc.

(1)

Doing the cross-compilation myself runs first into toolchain errors (eg needing to symlink for C++ support for musl and switch mingw toolchain to POSIX threads to make std::thread available), but then eventually failed from linking errors due to some kind of atexit mechanism. I tried disabling this with -fno-use-cxa-atexit but it had no effect. At this point I decided to try using the cross tool, figuring it would be better maintained and supported.





(2)
I then looked into using docker’s official docker-in-docker images with cargo cross. This required building rustup natively. However, it appears that somehow the outside container’s toolchain is still used for the compilation of the actual library. Since alpine does not provide glibc and forces me to use musl for the outside container toolchain, this prohibits proc-macros.

One thing that seemed a bit odd to me during this process was that cross appeared to immediately start downloading the dependencies, then it would notify me that my toolchain didn’t support proc_macros (it only specified the target toolchain, but in searching the web I found an issue complaining that the host toolchain wasn’t specified in this error message even though it could be the actual cause).

Interestingly, alpine does appear to have enabled dynamic linking for its own musl-based Rust toolchain (x86_64-alpine-linux-musl) but even patching rustup to accept this host tuple does not allow me to proceed, since linking it as a system toolchain does not support components.




https://dev.alpinelinux.org/irclogs/%23alpine-devel-2017-04.log

(3)

I then looked into using gitlab’s official (albeit dated) docker-in-docker, which is based on Ubuntu, with cargo cross. I got further, but then I started running into the same initial errors that I fixed in (1), which is not encouraging.

There seem to be many different solutions, and the general pattern is that each one gets partway there and then seems to be abandoned. I was initially under the impression that cross would solve my problem, but it also seems to be abandoned now, with the last commit in January and the last release in 2017.

I’m going to try installing cross directly from the github repo, but at this point I’m just wondering if (A) there’s something I totally missed that supplanted cargo cross, and (B) if there’s any “blessed” group responsible for cross-compilation I could focus on working with or basing my solution on?

Thanks.

EDIT: Fixed double-paste of message.

1 Like

cross IS the blessed option. Yes, C++ support is missing in cross’s musl targets. This is clearly documented in cross’s README. Contributions welcome.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.