Re: The Case for Rust (in the base system)

From: Juraj Lutter <otis_at_FreeBSD.org>
Date: Sat, 20 Jan 2024 21:12:34 UTC

> On 20 Jan 2024, at 18:34, Dimitry Andric <dim@FreeBSD.org> wrote:
> 
> On 20 Jan 2024, at 18:13, Gleb Popov <arrowd@freebsd.org> wrote:
>> 
>> On Sat, Jan 20, 2024 at 7:51 PM Alan Somers <asomers@freebsd.org> wrote:
>>> To
>>> summarize, the cost is that it would double our build times.
>> 
>> Would it? From what I remember, a lot of rust's build time comes from
>> building its own LLVM. Can we reuse our base LLVM for Rust-in-base?
> 
> It used to be the case that the Rust port could not use an LLVM port,
> but had to use its own copy, but it seems that as of
> https://cgit.freebsd.org/ports/commit/?id=098de5bc2195 it is possible
> again.

Speaking of this:

I’ve now tried to build rust with llvm15 on releng/13.2 and all I’ve got was:

wn-freebsd/release/deps/cargo-daa18b6ffb5dc5da" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "-Wl,-z,origin" "-Wl,-rpath
,$ORIGIN/../lib"
  = note: ld: error: relocation R_X86_64_32 cannot be used against local symbol; recompile with -fPIC
          >>> defined in /wrkdirs/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/stage1-tools/x86_64-unknown-freebsd/release/deps/liblibssh2_sy
s-a60af3093adc87c9.rlib(agent.o)
          >>> referenced by agent.o:(libssh2_agent_init) in archive /wrkdirs/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/stage1-tools/x86_64
-unknown-freebsd/release/deps/liblibssh2_sys-a60af3093adc87c9.rlib


Is this something that can be fixed easily?

Thanks

—
Juraj Lutter
otis@FreeBSD.org