4 ms·
Generally, the hard part isn't the cross compiler (nor, these days, the cross binutils), but the cross libraries. There are at least 3 ways (/usr/lib/$ARCH, /us
by o11c 2y ago
Generally, the hard part isn't the cross compiler (nor, these days, the cross binutils), but the cross libraries. There are at least 3 ways (/usr/lib/$ARCH, /usr/$ARCH/lib, /$CHROOT/usr/lib/) to set up the libraries, all incompatible with each other.
Zig is notable for putting a lot of work into hard-coding basic C libraries, though of course you still need a scattering of other C libraries for most real-world programs.
(for a sufficiently advanced language ecosystem, the language's own libraries should be easy enough)
- wucke13 2y agoThe nixpkgs have a rather elegant way to deal with that. Let's presume you need a libpng for an armv7 platform, such as an old RaspberryPi. Then Nix allows you to - get a suitable cross compiler toolchain - pick whether you want dynamic or static linking (most likely static when the target system does not come with /nix/store) - compile all prerequisites for the library such as transitive dependencies - compile the library with the cross compiler for the selected target arch All in one command line call, that does not require you to 'apt-get install' any of the tools manually: nix-build '<nixpkgs>' -A pkgsStatic.libpng --arg crossSystem '{ config = "armv7a-unknown-linux-gnueabihf"; }'
- Cloudef 2y agoYou can combine zig and nix with <https://github.com/Cloudef/zig2nix https://github.com/Cloudef/zig2nix> (shameless plug)