I think that we should have a greater variety of cross compiler
toolchains available in aports, providing in reach repo at least enough
cross-compilers to build Alpine for any target supported by a stable
Alpine release.
Thoughts?
Drew DeVault wrote on Wed, Feb 16, 2022 at 11:27:54AM +0100:
> I think that we should have a greater variety of cross compiler> toolchains available in aports, providing in reach repo at least enough> cross-compilers to build Alpine for any target supported by a stable> Alpine release.> > Thoughts?
Thanks for starting this thread!
I'd definitely agree to this, after spending a bit of time on it myself
for work (building some local aarch64/armhf packages)
It's easy enough to rebuild the cross environment with aports's
scripts/bootstrap.sh, but that's not very practical for CI environment.
After a bit of looking I've started using the cross compilers from pmos
repos here:
http://pkgs.postmarketos.org/package/master/postmarketos/x86_64/gcc-aarch64http://pkgs.postmarketos.org/package/master/postmarketos/x86_64/gcc-armhf
which does the job, but if there is a viable alternative within the main
repos I'd be very happy to switch to it.
Cheers,
--
Asmadeus | Dominique Martinet
Hi,
"Drew DeVault" <sir@cmpwn.com> wrote:
> I think that we should have a greater variety of cross compiler> toolchains available in aports, providing in reach repo at least enough> cross-compilers to build Alpine for any target supported by a stable> Alpine release.> > Thoughts?
Thanks for raising this issue. I definitely agree that cross compiler
toolchains for supported architectures would be nice to have in the
repositories.
My two cents on this: In my view cross compilation becomes a lot easier
when using Clang instead of GCC (i.e. you can just pass -target instead
of maintaining separate GCC toolchains for different architectures [1]).
As such, it is already possible today to cross compile C/C++ object
files with Clang on Alpine (e.g. `clang -c -target aarch64-alpine-linux-musl`).
Linking is a different story though and furthermore aports.git does not
really support compilation with Clang at the moment. However, there
have been occasional discussions on IRC if Alpine should switch from GCC
to Clang anyhow. Maybe this yet another argument for this switch?
Greetings,
Sören
[1]: https://clang.llvm.org/docs/CrossCompilation.html#cross-compilation-issues
> On 16 Feb 2022, at 11:27, Drew DeVault <sir@cmpwn.com> wrote:> > I think that we should have a greater variety of cross compiler> toolchains available in aports, providing in reach repo at least enough> cross-compilers to build Alpine for any target supported by a stable> Alpine release.> > Thoughts?
clang is by itself a cross-compiler. basically one can setup an environment by grabbing a minirootfs and extract alpine packages itself and then using appropriate command line options you’re pretty much done:
clang --sysroot=/alpine-aarch64 -target alpine-aarch64-linux-musl -fuse-ld=lld test.c -o test
boum, test is aarch64 executable.
Nothing more, nothing less.
That said cross-compiling is still pretty much utopia. Some packages build executables that they run during the build process, having to specify a host compiler and a target compiler which many build system don’t support. Not mentioning that many software just don’t care.
I don’t think spending effort on this is any useful.
—
David
> On 16 Feb 2022, at 14:52, Sören Tempel <soeren@soeren-tempel.net> wrote:> > However, there have been occasional discussions on IRC if Alpine should switch from GCC> to Clang anyhow. Maybe this yet another argument for this switch?
I’m currently creating a Linux distribution similar to Alpine in spirit but it’s based on a fully LLVM environment (not even libgcc or binutils) and I can tell you that it’s a total nightmare.
Many packages use gcc extensions and do not compile fine under clang. Even though I strongly advise clang as default compiler, it still requires a non neglecting patch sets.
—
David
On Wed, 16 Feb 2022, Drew DeVault wrote:
> I think that we should have a greater variety of cross compiler > toolchains available in aports, providing in reach repo at least enough > cross-compilers to build Alpine for any target supported by a stable > Alpine release.> > Thoughts?
I think this would be nice. In 2018, I actually tried to do this in a
GCC-compatible way:
https://lists.alpinelinux.org/~alpine/devel/%3Calpine.LFD.2.21.1810191534530.26297%40kanala.kunkku.net%3E
However, doing it properly would have required massive refactoring of
abuild. I gave up because I did not have the time.
BR,
Kaarle