alpinelinux / alpine-chroot-install

Install Alpine Linux in chroot with a breeze. Build ARM on Travis CI or any other x86_64 CI.
MIT License
290 stars 59 forks source link

any guide about how to use this for cross build #37

Closed yf13 closed 1 year ago

yf13 commented 1 year ago

Hi,

I tried to use this tool within Ubuntu on x86_64 PC to build aports/main/linux-rpi. However, the abuild tool complains that architecture is mismatched.

Since I am rather new to "abuild" tool as well, I tried to use CHOST=aarch64 abuild again but it seems that packages like build-base-aarch64 is needed but which I couldn't install with apk add command.

I am wondering if there is any brief materials about how to achieve my use case? The readme of this tool claims it is aimed for cross building but there is no more hints for AlpineLinux newbie.

Regards, yf

johannesneyer commented 1 year ago

I think the idea is to use qemu-user-static and qemu-user-static-binfmt to cross compile. The script can set this up for you with the -a option:

./alpine-chroot-install -a armv7 -d /path/to/alpine-armv7-chroot

https://github.com/alpinelinux/alpine-chroot-install/blob/6d08f12a8a70dd9b9dc7d997c88aa7789cc03c42/alpine-chroot-install#L6-L7

yf13 commented 1 year ago

@johannesneyer thanks a lot.

jirutka commented 1 year ago

You might find useful this: https://github.com/jirutka/setup-alpine#cross-compile-rust-application-with-system-libraries