Commit graph

11 commits

Author SHA1 Message Date
Oliver Smith
d9830c6304
cross/crossdirect: partially use sccache for rust (MR 4310)
Wrap rustc commands with sccache when building native build scripts.
More interesting will be using sscache for compiling for the target
architecture, but sccache currently refuses to cache with --sysroot.
This can be optimized further later on, get some initial support for
sccache in here first.

While at it, tweak the -vV logic to also support -V, start using semver
with this and add myself as maintainer of the package.

[ci:skip-build]: already built successfully in CI
2023-09-05 08:45:41 +02:00
Affe Null
f0286576e7
cross/crossdirect: improve rust handling (MR 4234)
Add a cargo wrapper which appends a --target argument to the command
line. This makes cargo pass the --target argument to rustc for crates
being built for the target architecture, even if the target is the same
as the host. It will omit the --target argument for build scripts and
crates used in macros.

Check for this --target argument in the rustc wrapper and adjust the
library paths depending on its presence. The fallback that runs rustc
under qemu is no longer needed because macros are now built for the
native architecture and can be loaded into the native compiler without
any problems.

Also check if the arguments passed to rustc are "-vV". If this is the
case, we still need to fall back to the target rustc because the native
rustc will return the wrong architecture. If the wrong host architecture
is passed to a build script, it might try to look for a cross-compiler
or do something else that doesn't work.

[ci:skip-build]: already built successfully in CI
2023-07-24 08:32:10 +02:00
Oliver Smith
caf226cd33
cross/crossdirect: translate cc to gcc (MR 1545)
Fix errors when trying to compile with "cc":
	ccache: error: Could not find compiler "aarch64-alpine-linux-musl-cc" in PATH
2020-09-11 13:27:08 +02:00
Oliver Smith
a5ec53f157
cross/crossdirect: add more comments and license (MR 1545)
Make it easier to wrap one's head around the code and make the license
explicit. It was implicit already by the LICENSE file of this repository.
2020-09-11 13:27:08 +02:00
Luca Weiss
a81946781a
cross/crossdirect: fix rust breakage (!1139)
See:
* https://gitlab.alpinelinux.org/alpine/aports/issues/11349
* 7bb907ec23
2020-04-10 19:57:36 +02:00
Oliver Smith
f329c8f5ac
cross/crossdirect: support rust (!845)
Use the native rustc cross compiler where possible, and fall back to the
qemu rustc if necessary. This should improve speed and reliability.
Without this patch, building squeekbox 1.4.0 for aarch64 with the
pmbootstrap stack just hangs forever.

Related: pmbootstrap#1861
2020-01-14 02:45:18 +01:00
Oliver Smith
de2b9a33b4
cross/crossdirect: pkgrel bump
Rebuild to make it use the new armhf triplet. Otherwise cross compiling
with crossdirect to armhf fails with:

ERROR: crossdirect: failed to execute /native/usr/lib/ccache/bin/armv6-alpine-linux-muslgnueabihf-gcc: No such file or directory

This finally fixes #295.
2019-09-11 20:51:14 +02:00
Luca Weiss
a66fed62cc
Format **/*.c with clang-format (!465)
[ci:skip-build]: already built successfully in CI
[ci:skip-vercheck]
2019-06-26 22:36:24 +02:00
Oliver Smith
2c07f28419
cross/crossdirect: use qemu when linking (!318)
Cross linker (e.g. ld from binutils-armhf) does not support any method
of setting additional link paths, and this causes problems when building
various packages. Work around this problem by calling the qemu binary
instead of the cross binary from the native chroot, whenever we are
linking.

I have tested that this allows successfully building hello-world,
coreinfo, libhybris for armhf. So this fixes #227 and fixes #228.

Regarding performance, this is the same way as distcc does it. We would
get a performance gain if we were able to use the cross-linker. But so
far I could not figure out how to patch the binutils source to make it
work like we want to have it. Maybe I'll ask on some binutils mailing
list for advice. In the meantime, this workaround should make
crossdirect work for all use-cases, and it is still faster than the
previous distcc setup, because we can avoid the overhead of setting up
and running a ssh server locally to work around missing authentication
in distcc (see pmbootstrap!1649). Let's test this for some more time,
and then make a pmbootstrap release that rolls out crossdirect for
everyone.
2019-04-14 04:03:21 +02:00
Oliver Smith
958f597a6c cross/crossdirect: use ccache, execve, -Werror (!299)
Instead of running compilers directly, let them go through the native
ccache binary. Note that it will still use the foreign arches cache dir
because the native cache dir would be at /native/home/pmos/.ccache.

Use execve instead of setenv and execv, because that didn't work with
LD_LIBRARY_PATH (ccache was complaining that it couldn't load zlib).

Enable -Werror, because we are maintaining this program and it helps
us catching bugs early.
2019-04-03 21:26:12 +02:00
Zhuowei Zhang
68c1d5d2bd cross: add crossdirect package (!222)
A set of wrapper executables that launch native cross compilers inside
foreign chroots. Speeds up cross compilation a lot, compared to the
distcc-sshd method.
2019-03-23 01:05:40 +01:00