Subject: RE: rust triples (WAS: Re: Planning for 3.12 feature freeze)

From: "Jean-Louis Fuchs" <[email-masked]>
Date: Fri, 3 Apr 2020 12:09:37 +0000

Hi

>
> Ok. I still think we should either use `*-unknown-linux` or `*-alpine-linux`
> consistenly only all arches.
>
> I don't know which is to prefer though.
>
> https://gitlab.alpinelinux.org/alpine/aports/issues/11349
>
> -nc
>

My 50 cents. I run x86_64-unknown-linux-musl from rustup. I still have

RUSTFLAGS="-C target-feature=-crt-static"

set. Packages like rocket (web framework) and diesel (ORM) work,
I haven't tried compiling firefox, though. It was planned to create
a triplet $arch-unknown-linux-dynmusl which is meant for hosts running
musl. [1] This hasn't happened yet and instead many bugs have been fixed so
$arch-unknown-linux-musl works as host and not only as a target. It was said,
that they never remove the requirement for -crt-static, because it will
break a lot of build-systems out there, that think $arch-unknown-linux-musl
is only a target for creating static binaries.

[1] https://github.com/rust-lang/rust/issues/59302

So my point is $arch-alpine-linux-musl feels correct. BUT could we just
introduce $arch-unknown-linux-dynmusl? Because if we patch crt-static away
on a rust-build using $arch-unknown-linux-musl, we might break things that
expect crt-static. If packages only look at the middle part *-unknown-linux-*
it might fix most problems. Either way it was a very bad idea to link
crt-static with the triplet.

Let me know if you think creating $arch-unknown-linux-dynmusl rust-build
is worth a try?

Best,
Jean-Louis

---

From: Shiz <[email-masked]>
Date: Fri, 3 Apr 2020 15:32:18 +0200

> On Apr 3, 2 Reiwa, at 14:09, Jean-Louis Fuchs <[email-masked]> wrote:
> 
> expect crt-static.

I think this is a worse solution than making $arch-alpine-linux-musl dynamically linked,
as the author fo said patch, and expect it to break more things than an -alpine- triple
would.

> Either way it was a very bad idea to link crt-static with the triplet.

+1, but that’s sadly how it is for the upstream. I propose we move to $arch-alpine-linux-musl
everywhere and fix any outstanding issues with it. I can help if needed.

- Shiz

---

From: Rasmus Thomsen <[email-masked]>
Date: Fri, 03 Apr 2020 17:09:03 +0200

> > +1, but that’s sadly how it is for the upstream. I propose we move
> to
> > $arch-alpine-linux-musl

That's be greatly appreciated, it didn't find rustc_macros for some
reason for me (I suppose it used crt-static in build for some reason).

Thanks,

Rasmus

---

From: Natanael Copa <[email-masked]>
Date: Fri, 3 Apr 2020 17:17:27 +0200

On Fri, 3 Apr 2020 15:32:18 +0200
Shiz <[email-masked]> wrote:

> I propose we move to $arch-alpine-linux-musl everywhere and fix any
> outstanding issues with it. I can help if needed.

I think this would be the cleanest thing to do, however, I don't have
much experience with rust, so help would be appreciated.

I tried to build it on armv7 as a test:

diff --git a/community/rust/APKBUILD b/community/rust/APKBUILD
index bcde30fbd3..3941803500 100644
--- a/community/rust/APKBUILD
+++ b/community/rust/APKBUILD
@@ -7,7 +7,7 @@ pkgname=rust
 pkgver=1.42.0
 _llvmver=10
 _bootver=1.41.1
-pkgrel=1
+pkgrel=2
 pkgdesc="The Rust Programming Language"
 url="https://www.rust-lang.org"
 arch="x86_64 armv7 armhf aarch64 x86 ppc64le"
@@ -88,10 +88,10 @@ case "$CARCH" in
                _build="i686-unknown-linux-musl"
                _target="$_build"
                ;;
-       armv7)
-               _build="armv7-unknown-linux-musleabihf"
-               _target="$_build"
-               ;;
+#      armv7)
+#              _build="armv7-unknown-linux-musleabihf"
+#              _target="$_build"
+#              ;;
        armhf)
                _build="arm-unknown-linux-musleabihf"
                _target="$_build"

It manages to build but during `abuild rootpkg` it fails. Apparently due to it needs uses cargo, but the installed cargo does not have an installed stdlib:

   Compiling quote v0.6.12
error[E0461]: couldn't find crate `core` with expected target triple armv7-alpine-linux-musleabihf
  |
  = note: the following crate versions were found:
          crate `core`, target triple armv7-unknown-linux-musleabihf: /usr/lib/rustlib/armv7-unknown-linux-musleabihf/lib/libcore-522d58512672202f.rlib

error[E0461]: couldn't find crate `core` with expected target triple armv7-alpine-linux-musleabihf
  |
  = note: the following crate versions were found:
          crate `core`, target triple armv7-unknown-linux-musleabihf:
          /usr/lib/rustlib/armv7-unknown-linux-musleabihf/lib/libcore-522d58512672202f.rlib

Is there a way to make cargo look into another directory? Or is it better to manually create bootstrap packages?

-nc

---

From: Rasmus Thomsen <[email-masked]>
Date: Fri, 03 Apr 2020 17:19:22 +0200

On Fri, 2020-04-03 at 17:17 +0200, Natanael Copa wrote:
> It manages to build but during `abuild rootpkg` it fails. Apparently
> due to it needs uses cargo, but the installed cargo does not have an
> installed stdlib:
> 
>    Compiling quote v0.6.12
>           /usr/lib/rustlib/armv7-unknown-linux-
> musleabihf/lib/libcore-522d58512672202f.rlib
> 
> Is there a way to make cargo look into another directory? Or is it
> better to manually create bootstrap packages?
> 
> -nc
> 

When you're switching triplets you would have to only adjust _target in
the first run since you're still building with the old triplet.