binplz / binplz.dev

binplz.dev

Home Page:https://binplz.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cross-compilation

jonascarpay opened this issue · comments

The server currently allows a caller to specify a target platform, but this doesn't actually work yet. I think it'd be very valuable if we made this work, since it's great for e.g. embedded devices that don't have build tools/capabilities but do have an internet connection. If possible, I'd like this working to some degree before we release.


Cross-compiling with ?sys=aarch64-linux doesn't work yet, probably just because I don't have emulation set up yet

Oh, that'd be pretty neat if we could get this working! If we decide to use nixbuild.net as our builder, I think they have support for aarch64, which might make this easy for us: https://blog.nixbuild.net/posts/2021-09-20-nixbuild-net-now-supports-arm-builds.html

maybe there's a way to not need to do that, through pkgsCross or something?

I sorta have a blog post about this: https://functor.tokyo/blog/2021-10-20-nix-cross-static

You can cross-compile and statically-link at the same time by using an attribute like pkgsCross.aarch64-multiplatform.pkgsStatic.vim. Although, from what I've seen, the set of things that are successfully able to be statically-linked while being cross-compiled is... pretty small.

Oh, and for our initial release, my opinion is that we can just ignore this for now. We could just throw an error if a user tried to send a sys of aarch64-linux.

Originally posted by @cdepillabout in #6 (comment)

Although, from what I've seen, the set of things that are successfully able to be statically-linked while being cross-compiled is... pretty small.

My experience is a bit different. I think there are quite a few packages that cross compile nicely. The issues I've encountered are usually down to unfree software being compiled against glibc (nothing to do there) or interpreted languages (read Python) assuming that you are dynamically linking against libraries at runtime.

I think we can close this issue for now. With nixbuild.net, it seems that cross compilation mostly just works.