Cross compiling Fedora to other architectures

I’ve been reading about Fedora moving their baseline requirements to x86_64-v2. Now, AFAIK this won’t come anytime soon, and that’s not the matter of this post. I just wondered, given I have a decently power computer (for its use cases, mind you) that is not v3 compatible, when Fedora does the switch if it ever comes, would I be able to cross compile a functioning distro?

Bonus: If someone where to build a i686 fedora image, would that be possible as well, or would it require some convoluted process to do, or how straightforward would that be?

I’ve read that Fedora doesn’t support cross-compilation, later on I read that it does indeed, but only for the kernel, and not for the userspace. Later on I read it’s a matter of just bringing your compiler and libraries. As I’m a bit lost in how cross-compiling a Fedora image would work on a foreign architecture, I wonder if someone could enlighten me a bit.

1 Like

To build a fedora rpm you, ideally, need to be able to run a mock build.
You can, for example, run an arm rpm build on an x86 processor given you have qemu emulation set up.

If all you are doing is rebuilding with compiler options changed it is likely that you can use the already built compiler. But if you are targeting an architecture that there is not a compiler for them that is a lot more work.

You are likely to find that some rpms will fail to build and will need patches apply.

1 Like

I do not believe that is possible any more. The newer kernels are 64 bit only. Though many 32 bit apps can be run, the OS is actually running as 64 bit.

1 Like

I guess that could be said for basically any architecture not officially supported, right?

I’d have to compile a kernel from outside of Fedora’s repos.

The idea, from my understanding, is firing up a QEMU VM and running the compilation in there. Wouldn’t that make the compilation unbearably slow? How are people porting Fedora to, let’s say, Risc-V? Do they have to create a RiscV VM to perform the compilation inside it?

I may not fully understand why is it that complicated when other distros seem (and correct me if I’m wrong) to let you perform cross-compilation easily.

1 Like

That assumes that you have an OS to boot into tne VM.

But you are proposing to compile that OS and until you have enough RPMs there is nothing to boot in the VM.

With tne mock method all you need is enough RPMs to get mock running, nit a while OS.

In other words you have a boot strapping problem.

You can also build your rpms on COPR, and select different target architectures (chroot the build is compiled in), including arm64:

How slow that becomes would really depend on the number of CPUs and the amount of RAM assigned for use by that VM. Doing it this way would ensure the results are isolated from the host, but otherwise could be considered no different than the compile on the actual host.