Skip to content
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

Feature/Discus request regarding canadian-cross compiling the toolchain #27

Open
BlackDex opened this issue Feb 13, 2024 · 4 comments
Open

Comments

@BlackDex
Copy link

BlackDex commented Feb 13, 2024

Hello there,

Because discussions is not enabled for this repo, I place it here, as it's not an issue.

I wonder if someone every tried to do a canadian-cross compile with this?
What my main goal is.

  • Build everything on a x86_64-linux-gnu system
  • Which targets armv6-linux-musleabihf for example
  • But, the host architecture where all is running on would be aarch64-linux-gnu

This way it would be possible to build cross-compilers for all the provided targets but then are able to run on a arm64/aarch64 host/architecture.

Else something like QEMU needs to be used to emulate the aarch64 architecture, which is probably not going to provide the best performance.

Someone an idea, or tried this before either using mussel or something else? And if so, does someone have any pointers?

Thanks in advance!

btw. I already tried to install the aarch64-linux-gnu-g** cross compilers, use that as GCC/G++ and added the correct --host and --build arguments to the configure commands.

@ghost
Copy link

ghost commented Mar 14, 2024

I'm a bit confused here. So you're trying to build on x86_64-linux-gnu, for armv6-linux-musleabihf? or are you trying to build on aarch64-linux-gnu?

@BlackDex
Copy link
Author

The host which is building the binary is x86_64
The build target, so for which arch the final binary will be is armv6
And the target host is aarch64.

So in the end we would have a musl gcc compiler which runs on aarch64 and compiles to armv6 but all was build first on a x86_64.

@ghost
Copy link

ghost commented Mar 15, 2024

So in the end we would have a musl gcc compiler which runs on aarch64 and compiles to armv6 but all was build first on a x86_64.

Thanks for clarifying. The script doesn't currently self-host, but what you could probably do is

  1. Build a toolchain targetting aarch64-linux-musl as usual.
  2. Using that toolchain, build whatever libraries are needed to build GCC (eg. zlib, libzstd, libatomic) for aarch64-linux-musl.
  3. After the first-pass toolchain has access to the required libraries, edit the ./configure invocations for GCC & binutils and add --build=aarch64-linux-musl. After that, build a toolchain targetting armv6-linux-musleabihf.

In step 3, you'll need to run mussel.sh on compatible hardware since once the new armv6-linux-musleabihf compiler won't run on x86_64, but on aarch64. So, to answer your question, you'd either need access to an armv8 host or qemu-aarch64 to emulate it, at least as far as I know. Hope this helps.

@firasuke
Copy link
Owner

firasuke commented Apr 9, 2024

Because discussions is not enabled for this repo, I place it here, as it's not an issue.

I have enabled discussions for this repo, feel free to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants