Closed noraj closed 9 months ago
Thanks for the issue, I don't have an active Arch installation so I used the Arch Docker image under Distrobox (running in Fedora) instead.
I couldn't replicate this issue on rustup 1.76.0
too and the compilation works fine.
Are you using Rust tools installed in local repositories from Pacman?
➜ tlrc git:(main) cargo build
Updating crates.io index
Downloaded clap_lex v0.6.0
Downloaded clap_derive v4.4.7
Downloaded once_cell v1.19.0
Downloaded serde_spanned v0.6.5
Downloaded toml_datetime v0.6.5
Downloaded percent-encoding v2.3.1
Downloaded form_urlencoded v1.2.1
Downloaded getrandom v0.2.11
Downloaded quote v1.0.35
Downloaded sct v0.7.1
Downloaded clap v4.4.18
Downloaded proc-macro2 v1.0.78
Downloaded serde_derive v1.0.196
Downloaded toml v0.8.9
Downloaded indexmap v2.1.0
Downloaded anstream v0.6.11
Downloaded base64 v0.21.5
Downloaded serde v1.0.196
Downloaded url v2.5.0
Downloaded toml_edit v0.21.1
Downloaded winnow v0.5.19
Downloaded ureq v2.9.1
Downloaded hashbrown v0.14.3
Downloaded rustls-webpki v0.101.7
Downloaded clap_builder v4.4.18
Downloaded syn v2.0.48
Downloaded webpki-roots v0.25.3
Downloaded rustls v0.21.9
Downloaded idna v0.5.0
Downloaded libc v0.2.150
Downloaded ring v0.17.7
Downloaded 31 crates (7.5 MB) in 3.28s (largest was `ring` at 4.1 MB)
Compiling libc v0.2.150
Compiling proc-macro2 v1.0.78
Compiling unicode-ident v1.0.12
Compiling cfg-if v1.0.0
Compiling serde v1.0.196
Compiling tinyvec_macros v0.1.1
Compiling untrusted v0.9.0
Compiling spin v0.9.8
Compiling utf8parse v0.2.1
Compiling crc32fast v1.3.2
Compiling colorchoice v1.0.0
Compiling tinyvec v1.6.0
Compiling percent-encoding v2.3.1
Compiling anstyle-parse v0.2.2
Compiling hashbrown v0.14.3
Compiling anstyle v1.0.4
Compiling adler v1.0.2
Compiling unicode-bidi v0.3.13
Compiling anstyle-query v1.0.0
Compiling equivalent v1.0.1
Compiling rustls v0.21.9
Compiling miniz_oxide v0.7.1
Compiling form_urlencoded v1.2.1
Compiling anstream v0.6.11
Compiling heck v0.4.1
Compiling clap_lex v0.6.0
Compiling strsim v0.10.0
Compiling log v0.4.20
Compiling winnow v0.5.19
Compiling option-ext v0.2.0
Compiling clap_builder v4.4.18
Compiling byteorder v1.5.0
Compiling tlrc v1.8.0 (/home/kbdharunkrishna/Downloads/tlrc)
Compiling indexmap v2.1.0
Compiling quote v1.0.35
Compiling cc v1.0.83
Compiling syn v2.0.48
Compiling getrandom v0.2.11
Compiling unicode-normalization v0.1.22
Compiling dirs-sys v0.4.1
Compiling flate2 v1.0.28
Compiling once_cell v1.19.0
Compiling webpki-roots v0.25.3
Compiling base64 v0.21.5
Compiling dirs v5.0.1
Compiling yansi v0.5.1
Compiling zip v0.6.6
Compiling idna v0.5.0
Compiling ring v0.17.7
Compiling url v2.5.0
Compiling serde_derive v1.0.196
Compiling clap_derive v4.4.7
Compiling clap v4.4.18
Compiling sct v0.7.1
Compiling rustls-webpki v0.101.7
Compiling ureq v2.9.1
Compiling toml_datetime v0.6.5
Compiling serde_spanned v0.6.5
Compiling toml_edit v0.21.1
Compiling toml v0.8.9
Finished dev [unoptimized + debuginfo] target(s) in 39.72s
➜ tlrc git:(main) cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.07s
Running `target/debug/tldr`
tlrc v1.8.0 (implementing the tldr client specification v2.1) - debug build (2a197f2)
Official tldr client written in Rust
Usage: tldr [OPTIONS] <PAGE>...
Arguments:
<PAGE>... The tldr page to show
Options:
-u, --update Update the cache
-l, --list List all pages in the current platform
-a, --list-all List all pages
--list-platforms List available platforms
--list-languages List installed languages
-i, --info Show cache information (path, age, installed languages and the number of pages)
-r, --render <FILE> Render the specified markdown file
--clean-cache Clean the cache
--gen-config Print the default config
--config-path Print the default config path and create the config directory
-p, --platform <PLATFORM> Specify the platform to use (linux, osx, windows, etc.) [default: linux]
-L, --language <LANGUAGE_CODE> Specify the languages to use
-o, --offline Do not update the cache, even if it is stale
-c, --compact Strip empty lines from output
--no-compact Do not strip empty lines from output (overrides --compact)
-R, --raw Print pages in raw markdown instead of rendering them
--no-raw Render pages instead of printing raw file contents (overrides --raw)
-q, --quiet Suppress status messages and warnings
--color <WHEN> Specify when to enable color [default: auto] [possible values: auto, always, never]
--config <FILE> Specify an alternative path to the config file
-v, --version Print version
-h, --help Print help
See 'man tldr' or https://tldr.sh/tlrc for more information.
Update: Tried installing rust
from the native repositories too (i.e. sudo pacman -Syu rust
) and tlrc
compiles and runs fine. I think it is possible an external dependency or some config is affecting compilation for you locally.
Directly from the repository seeams to work:
git clone https://github.com/tldr-pages/tlrc.git && cd tlrc
git checkout v1.8.0
cargo build # ✅
rm -r target
cargo build --release --locked # ✅
rm -r target
COMPLETION_DIR=completions cargo build --release --frozen # ✅
But when using the AUR package with any pacman wrapper or directly with makepkg, it doesn't work while it's using the same rust and same build arguments.
git clone https://aur.archlinux.org/tlrc.git tlrc-aur && cd tlrc-aur
makepkg -srf # ❌
This is very weird. I always test if the package builds correctly, and it has always worked. I can reproduce this error on pacman v6.0.2-9, and downgrading to 6.0.2-8 fixes the issue.
Specifically, 6.0.2-9 for some reason changes OPTIONS=(!lto)
to OPTIONS=(lto)
in /etc/makepkg.conf
. Adding the !
back fixes the issue. I have no idea why though.
Also, it's ring that fails to compile, not tlrc.
Ok I found the root cause. It's because LTO (link time optimization) is enabled by default https://gitlab.archlinux.org/archlinux/rfcs/-/blob/master/rfcs/0004-lto-by-default.rst. That why it would work with cargo directly but no through makepkg. A similar issue in ring: https://github.com/briansmith/ring/issues/1444
Note: I made a tlrc-git where I disabled LTO, yo umay want to disable that flag for tlrc package as well.
I tried building https://aur.archlinux.org/packages/tlrc on ArchLinux both choosing rust 1.76.0 or rustup 1.76.0.
I tried with rust 1.75.0 from asdf.
I tried in a minimalist nspawn environment to be sure it was not something messing up from my system or PATH.
I tried building from last git commit instead of release 1.80.0.
In all cases I ended up with that error: