Ubuntu Jammy (in WSL): adding armhf arch, can't find packages or repositories

I’m trying to use WSL to cross-compile a c++ program for armhf on a Windows PC.

I’ve saved how i was able to do it on a Debian image some years ago, and now i need to do it again on a new PC. Since the powershell command wsl.exe --install automagically installed Ubuntu Jammy, i’m fine at keeping it.

The next steps I want to do is to add the armhf architecture (sudo dpkg --add-architecture armhf) but I get a lot of errors like these ones:

E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy/main/binary-armhf/Packages  404  Not Found [IP: 185.125.190.39 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-updates/main/binary-armhf/Packages  404  Not Found [IP: 185.125.190.39 80] 
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-backports/main/binary-armhf/Packages  404  Not Found [IP: 185.125.190.39 80] 
E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jammy-security/main/binary-armhf/Packages  404  Not Found [IP: 91.189.91.82 80] 
E: Some index files failed to download. They have been ignored, or old ones used instead.

I’ve looked at those URLs and the directory binary-armhf doesn’t exist in any of them.

Obviously, then I can’t apt -install the libgtk-3-dev:armhf packages or the arm gcc compiler.

I’m not really an expert in Linux; I understand that I may need to add repositories to the list, but I’m unable to find where they are.

Could someone tell me what should I do to build for armhf using the Ubuntu Jammy image available from the Windows Store for WSL?

Asked By: Parduz

||

Your final sources.list should look something like:

deb [ arch=amd64,i386 ] http://archive.ubuntu.com/ jammy main restricted universe multiverse
deb [ arch=amd64,i386 ] http://archive.ubuntu.com/ jammy-updates main restricted universe multiverse
deb [ arch=amd64,i386 ] http://archive.ubuntu.com/ jammy-security main restricted universe multiverse
deb [ arch=amd64,i386 ] http://archive.ubuntu.com/ jammy-backports main restricted universe multiverse

deb [ arch=armhf ] http://ports.ubuntu.com/ jammy main restricted universe multiverse
deb [ arch=armhf ] http://ports.ubuntu.com/ jammy-updates main restricted universe multiverse
deb [ arch=armhf ] http://ports.ubuntu.com/ jammy-security main restricted universe multiverse
deb [ arch=armhf ] http://ports.ubuntu.com/ jammy-backports main restricted universe multiverse

(Plus the deb-src lines which I omitted for brevity)

Just for the sake of clarity, I’d suggest putting the armhf repos in a separate .list file in /etc/apt/sources.list.d.

Answered By: muru