Rustdoc error when building rust 1.23.0

Hi,

I am trying to build rust 1.23.0 on a build server for sailfishos. The error I get is:

[41622s] /home/abuild/.../stage2/bin/rustdoc: error while loading shared libraries: librustc_driver-776fea242aeb0ff0.so: cannot open shared object file: No such file or directory
[41622s] error: Could not document core.

What can I do to fix the error or skip generating the docs?

More of the log can be found here: Live Build Log - SailfishOS Open Build Service

The build files can be found here: Show home:wdehoog:rust / rust-1.23 - SailfishOS Open Build Service

The spec file is based on previous work done by someone else and the package maintainer of rust for the fedoraproject.

Sorry for the offtopic, but 1.23.0 is pretty outdated. Any reason not to use the latest version (1.33.0)?

Since only 1.22 is available. I thought (hope 'm wrong) I need to build all versions one by one to end up with a recent version.

With https://rustup.rs/ you can install any version, and update easily with rustup update.

Rust that ships with Linux distros is usually old and not very usable, so it's better to install from Rustup.

Thanks . Problem is the processes running on the buildserver I use have no internet connection. Everything must be available in archives.

I am said package maintainer for Fedora. I keep our rust.spec such that it's always possible to re-bootstrap from recent upstream binaries, but it looks like your source has stripped that logic. Here are Fedora's sources, if you'd like to see how I do it:

https://src.fedoraproject.org/rpms/rust/tree/master

Setting bootstrap_arches near the top will make it add additional Source files for bootstrap binaries.

So in theory I could build the latest version using 'bootstrapping' ? Do they have an arm binary available for bootstrapping? Can this binary be added as an archive (the build process has no network)?

Aha I see there is armv7-unknown-linux-gnueabihf in Tier 2. Now how can this be added to the build process?

(Have to confess this is all exotic to me. rpm spec stuff and building rust, all very complicated. And I only want to package Librespot...)

The bootstrap flag adds the additional Source, but this has to be downloaded at some point, just as you must for the plain source tarball in the first place. I use spectool -g rust.spec for this.

I don't know about your build system, but in Fedora we use fedpkg to upload all sources to a lookaside cache. Then the actual build always pulls from there instead of downloading from the original URL.

Hi,

I made some progress. Now building stops with LLVM ERROR: out of memory during Building stage0 codegen artifacts.

See Live Build Log - SailfishOS Open Build Service.

Any idea what is going wrong?

It's likely exactly what it says — needs more memory. Building of LLVM and the compiler needs many many gigabytes of RAM.

Yeah, it's a problem for 32-bit architectures. Even if the system has a ton of ram, individual processes are still limited to a 32-bit address space -- 4GB max, but often only 2GB or 3GB depending on how the kernel memory is split. If you scan Fedora's rust.spec for debuginfo, you'll see that I've disabled most debuginfo for the 32-bit arches, which is enough for the build to get by.

See also:
https://github.com/rust-lang/rust/issues/45854

1 Like

When using:

%define enable_debuginfo --disable-debuginfo --disable-debuginfo-only-std --disable-debuginfo-tools --disable-debuginfo-lines

unfortunately the same thing happens (LLVM ERROR: out of memory).

It looks like you were letting rust use its bundled LLVM, rather than linking an existing libLLVM.so from the system. That generates a ton of code and debuginfo too, if your build system sets -g in CFLAGS and CXXFLAGS. You may need to filter that out, or append -g0, something like that.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.