-
Notifications
You must be signed in to change notification settings - Fork 75
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
fakechroot on amd64 fails to chroot into aarch64 #120
Comments
There are a couple of prerequisites you need for this to work:
All of this is done by Ultimately though, please know that fakechroot is very brittle and using unshared user namespaces there are only very, very few situations where you should use fakechroot. What is your use-case? |
I trying to assemble a usable sysroot for cross compiling arm64/aarch64 applications without requiring root privileges. I start with
Now I want too chroot into noble-arm64 (or rather fakechroot) to further configure the sysroot for by installing addition packages need for my cross compilation. |
If you want to cross-compile for arm64 on amd64, then you do not need an arm64 chroot. You need an amd64 chroot and then install arm64 cross-build dependencies into it. If you build arm64 binaries inside a foreign architecture chroot using qemu user mode emulation then you are not cross compiling but you are emulating native compilation. Is there a specific software or package you want to cross-compile? The goal of not requiring superuser privileges for doing things with (even foreign) chroots is one that i share and on which I spent my free-time for more than 10 years already. This is why I can tell you that foreign architecture fakechroot does work (see mmdebstrap for proof) but that it is very fragile and that for anything serious you want to use something that is built around linux user namespaces, for example. |
Sorry for the confusion, I completely understand the cross compilation process and have used buildroot and yocto to generate sysroots previously. I'm trying to generate a Debian/Ubuntu arm64 sysroot for later use. I'm trying to use qemu userspace emulation and a chroot environments for build up this sysroot.
The sysroot I'm trying to assemble will be used to build a ROS2 application. The large Debian/Ubuntu dependency set of ROS2 is driving the hope to use a pre-configured sysroot to short circuit the build complexity.
I will look into mmdebstrap, thanks for the pointer and you insights! |
Crossbuilding in Debian/Ubuntu does not work like cross-building in Yocto. You do not need to create a sysroot. Crossbuilding works using the multiarch mechanism which allows you to install foreign architecture packages in your native architecture build environment. You do not create a foreign architecture chroot if you want to cross-build on Debian or Ubuntu. Thus, you also do not need qemu userspace emulation to create the sysroot. Crossbuilding in Debian and Ubuntu does not require QEMU emulation of the foreign architecture at any point. Maybe I can help you with your ROS problem as well. I also maintain a number of ROS packages in Debian. |
I'm trying to chroot into a ARM64 tree setup on AMD64 system, the command:
and
both fail on Ubuntu 24.04. While directly using
sudo chroot $PWD/arm64
works as expected. Is there a way to make this work? FYIfakechroot fakeroot chroot $PWD/amd64
works as expected. Note the working example is a AMD64 tree.The text was updated successfully, but these errors were encountered: