-
Notifications
You must be signed in to change notification settings - Fork 119
Add cross-compilation support to Makefile #461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
I suppose I should also document this in README if the change is accepted. |
b59d444 to
f62c49d
Compare
| endif | ||
|
|
||
| OS = $(shell uname -s) | ||
| ARCH = $(shell uname -m) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can return arm64 on macOS or aarch64 on Linux but clang seems happy with either in the target triple.
|
Having to gather all binaries for putting together a sysroot is a bit cumbersome. I was wondering if we could, perhaps, provide a Containerfile that would build |
|
My idea was to minimize build dependencies (i.e. it should be doable without any container runtime / virtualization solution). I first added this for FreeBSD on my branch where making a sysroot was as simple as downloading and unpacking base.txz. Maybe I could write a similar script for Linux. For example, it's possible to use skopeo and umoci to download and extract files from any OCI image. But I'm sure one could find Debian tarballs or something like that as well. |
|
Yep, you can just download these four deb packages, unpack with |
Signed-off-by: Jan Noha <[email protected]>
Signed-off-by: Jan Noha <[email protected]>
0c1863d to
c4dadf1
Compare
|
Ok, I updated the Makefile to generate a Debian sysroot automatically on macOS. These are downloaded and unpacked to This should ultimately simplify homebrew packaging of libkrun as well. |
Signed-off-by: Jan Noha <[email protected]>
Signed-off-by: Jan Noha <[email protected]>
At the moment, I'm porting
init.krunto FreeBSD (hoping to open that PR soon) and I thought it would be neat to have the option to compile on macOS without spinning up a VM if one so chooses.This relies on
clangandlld(the LLVM linker). Plus, you need to provide path to a suitable sysroot. I tested the build by copying/usr/include,/usr/lib/aarch64-linux-gnuand/usr/lib/gcc/aarch64-linux-gnufrom a Debian Bookworm system.Just wasn't sure if I should strip the binary or not. Right now it's configured to only strip
debug_info.