Re: clang-built NetBSD and rust

2023-03-27 Thread Greg Troxel
Havard Eidnes  writes:

> I've looked at
>
>   ftp://nyftp.netbsd.org/pub/NetBSD-daily/HEAD-llvm/latest/amd64/binary/sets/
>
> and specifically the base.tar.xz file, and it doesn't look like it has
> libgcc_s at all, but apparently MKGCC=yes will build it, but that
> doesn't appear to be the default (which is probably intentional).
>
> So ... what should I/we do about this?  Do we need a separate rust
> bootstrap kit built with clang and built with a clang-built "target
> root"?  It looks like there's no netbsd-9 nor netbsd-10 built with
> clang, only HEAD?

Basically binary packages are built for some environment, and you then
can't change the environment and expect them to work.

So yes, for NetBSD with LLVM and not GCC, I think we need different
bootstraps, and that's work to generate and awkward to implement.   I
don't think you should feel any duty to accomodate this, which I say
even if I'm a clang fan.

The big question to me is if a system with HAVE_LLVM can also build with
MKGCC.  The wiki says no:
  https://wiki.netbsd.org/tutorials/clang/
but that was likely adopted by me from list traffic and may be wrong.

I am unclear on whether NetBSD which 1) builds clang and 2) uses clang
to build the system can sanely also have GCC available, and whether we
should turn that on in public builds.  That's a bigger question than
rust, surely.

The real issue is that it's a bug that rust needs binary bootstraps, and
that there's no path from source with a base system.  This is
exacerbated by the rust.org implementation's practice of reuquiring the
previous rust version.  But other than the eventual gcc, and maybe
mrustc, I don't see that getting fixed, since they seem to view the
current situation as ok.


Re: clang-built NetBSD and rust

2023-03-27 Thread Tobias Nygren
On Mon, 27 Mar 2023 14:18:30 +0200 (CEST)
Havard Eidnes  wrote:

> a user contacted me about having a freshly installed version of
> NetBSD-current for amd64 built with clang, and a failure to run
> the provided "bootstrap kit" for rust, with the following error:
> 
> /usr/lib/libgcc_s.so.1: version GCC_3.3 required by 
> /tmp/pkgsrc/wip/rust/work/rust-bootstrap/bin/cargo not found

NetBSD from HEAD-llvm does not ship with libgcc_s.so.1, so one has to
manually provide it in order to run foreign binaries built with GCC.
Where did the user get libgcc_s.so.1 from?
I have rust-1.66.1 (not the latest) on my HEAD-llvm amd64 system.
Base is 9.99.107 (again not the latest) and libgcc_so.so.1 is from
9.99.99. So if this broke it did so fairly recently.

> So ... what should I/we do about this?  Do we need a separate rust
> bootstrap kit built with clang and built with a clang-built "target
> root"?  It looks like there's no netbsd-9 nor netbsd-10 built with
> clang, only HEAD?

Until clang ships as part of a formal release (with NetBSD release
binaries) I think it is OK to require users to manually provide
libgcc_s.so.1.


clang-built NetBSD and rust

2023-03-27 Thread Havard Eidnes
Hi,

a user contacted me about having a freshly installed version of
NetBSD-current for amd64 built with clang, and a failure to run
the provided "bootstrap kit" for rust, with the following error:

/usr/lib/libgcc_s.so.1: version GCC_3.3 required by 
/tmp/pkgsrc/wip/rust/work/rust-bootstrap/bin/cargo not found

Now, the NetBSD/amd64 bootstrap is built "upstream", i.e. it is
not one of the kits I maintain for NetBSD, and I'm pretty certain
that bootstrap kit is built on NetBSD 8.x:

: {115} pwd
/usr/pkgsrc/wip/rust/work/rust-bootstrap/bin
: {116} file cargo
: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, 
interpreter /usr/libexec/ld.elf_so, for NetBSD 8.0, with debug_info, not 
stripped
: {117} ldd cargo
cargo:
-lpthread.1 => /usr/lib/libpthread.so.1
-lc.12 => /usr/lib/libc.so.12
-lgcc_s.1 => /usr/lib/libgcc_s.so.1
-lm.0 => /usr/lib/libm.so.0
: {118} uname -ps
NetBSD x86_64
: {119}

(That's the 1.67.1 bootstrap kit, used for 1.68.*.)

Now, I'm pretty sure this "bootstrap kit" has already been built with
the equivalent of "CONFIGURE_ARGS+= --enable-cargo-native-static"
(which is in our options.mk), which links nghttp2 and curl statically,
but this does not eliminate the dynamic reference to libgcc_s.so.1.

I've looked at

  ftp://nyftp.netbsd.org/pub/NetBSD-daily/HEAD-llvm/latest/amd64/binary/sets/

and specifically the base.tar.xz file, and it doesn't look like it has
libgcc_s at all, but apparently MKGCC=yes will build it, but that
doesn't appear to be the default (which is probably intentional).

So ... what should I/we do about this?  Do we need a separate rust
bootstrap kit built with clang and built with a clang-built "target
root"?  It looks like there's no netbsd-9 nor netbsd-10 built with
clang, only HEAD?

Regards,

- HÃ¥vard