You are not logged in.

#1 2021-04-14 18:02:32

icar
Member
From: Catalunya
Registered: 2020-07-31
Posts: 505

[Solved] Can't link any Rust program

I have tried installing:
- spot-client-git ( https://aur.archlinux.org/packages/spot-client-git/ )
- shortwave-git ( https://aur.archlinux.org/packages/shortwave-git/ )
- zellij-git ( https://aur.archlinux.org/packages/zellij-git/ )
- fractal-git ( https://aur.archlinux.org/packages/fractal-git/ )
- ...

they fail with the following issue when linking:
- http://ix.io/2W3X (manual `makepkg -s`)
- http://ix.io/2W3R (using AUR helper "paru")
- http://ix.io/2WKN
- ...

I have Rust installed through RustUp:

$ rustup show                   
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/icar/.rustup

stable-x86_64-unknown-linux-gnu (default)
rustc 1.51.0 (2fd73fabe 2021-03-23)

I have tried with "rust" package from the official repositories, same exact result.

I have pacman-git (6.0.0alpha1.r86.gc294b7cb)

and I have the following makepkg.conf: http://ix.io/2WKO

Last edited by icar (2021-04-20 17:49:37)

Offline

#2 2021-04-14 19:00:17

Stefan Husmann
Member
From: Germany
Registered: 2007-08-07
Posts: 1,391

Re: [Solved] Can't link any Rust program

I guess most AUR packages are to be built with rust, not rustup. spot-client-git builds fine here. shortwave-git' s build takes very long on my machine, so I cannot confirm or unconfirm your problem yet.

Offline

#3 2021-04-14 19:03:13

icar
Member
From: Catalunya
Registered: 2020-07-31
Posts: 505

Re: [Solved] Can't link any Rust program

Package "rust" in repos is at version 1.51.0. As you can see in the first post, rustup installed rustc 1.51.0 aswell.

I don't understand how that would make any difference.

Offline

#4 2021-04-14 19:15:23

Stefan Husmann
Member
From: Germany
Registered: 2007-08-07
Posts: 1,391

Re: [Solved] Can't link any Rust program

Try it. rust comes with a bunch of libraries, rustup pulls them from third party repos.

Edit: also shortwave-git builds fine here using rust.

Last edited by Stefan Husmann (2021-04-14 19:17:42)

Offline

#5 2021-04-14 20:33:20

icar
Member
From: Catalunya
Registered: 2020-07-31
Posts: 505

Re: [Solved] Can't link any Rust program

http://ix.io/2W5n

With "rust" installed I get the same linking error.

Last edited by icar (2021-04-14 20:33:28)

Offline

#6 2021-04-14 23:44:58

loqs
Member
Registered: 2014-03-06
Posts: 18,042

Re: [Solved] Can't link any Rust program

Remove -flto from CFLAGS and the issue should be resolved.

Offline

#7 2021-04-15 11:41:32

icar
Member
From: Catalunya
Registered: 2020-07-31
Posts: 505

Re: [Solved] Can't link any Rust program

loqs wrote:

Remove -flto from CFLAGS and the issue should be resolved.

Thanks, loqs.

EDIT: It did not resolve the issue. I still have the same issue. My new makepkg.conf:
http://ix.io/2Waj

Last edited by icar (2021-04-15 11:54:43)

Offline

#8 2021-04-15 14:05:13

loqs
Member
Registered: 2014-03-06
Posts: 18,042

Re: [Solved] Can't link any Rust program

I reproduced the issue with:

# Maintainer: Daniel Peukert <daniel@peukert.cc>
_projectname='spot'
pkgname="$_projectname-client-git"
pkgver=0.1.13.r5.g02613db
pkgrel=1
pkgdesc='Gtk/Rust native Spotify client - git version'
arch=('x86_64' 'i686' 'arm' 'armv6h' 'armv7h' 'aarch64')
url="https://github.com/xou816/$_projectname"
license=('MIT')
depends=('alsa-lib' 'glib2' 'gtk3' 'libhandy' 'libpulse' 'openssl')
optdepends=('org.freedesktop.secrets')
makedepends=('cargo' 'git' 'meson>=0.50.0')
checkdepends=('appstream-glib')
provides=("$_projectname-client")
conflicts=("$_projectname-client")
source=("$pkgname::git+$url")
sha256sums=('SKIP')

_sourcedirectory="$pkgname"
_builddirectory='build'

pkgver() {
	cd "$srcdir/$_sourcedirectory/"
	git describe --long --tags | sed -e 's/^v//' -e 's/-\([^-]*-g[^-]*\)$/-r\1/' -e 's/-/./g'
}

build() {
CPPFLAGS=""
CFLAGS="-march=native -O3 -pipe -flto -fexceptions \
        -Wp,-D_FORTIFY_SOURCE=2,-D_GLIBCXX_ASSERTIONS \
        -Wformat -Werror=format-security \
        -fstack-clash-protection -fcf-protection"
CXXFLAGS="$CFLAGS"
LDFLAGS="-Wl,-O3,--sort-common,--as-needed,-z,relro,-z,now"
RUSTFLAGS="-C opt-level=2 -C target-cpu=native"
#-- Make Flags: change this for DistCC/SMP systems
MAKEFLAGS="-j8"
#-- Debugging flags
DEBUG_CFLAGS="-g -fvar-tracking-assignments"
DEBUG_CXXFLAGS="-g -fvar-tracking-assignments"
DEBUG_RUSTFLAGS="-C debuginfo=2"
	cd "$srcdir/"
	meson setup --prefix '/usr' --libexecdir 'lib' --sbindir 'bin' --buildtype 'release' --wrap-mode 'nodownload' \
		-Db_lto='true' -Db_pie='true' -Doffline='false' -Dfeatures='warn-cache' "$_sourcedirectory" "$_builddirectory"
	meson compile -C "$_builddirectory"
}

check() {
	cd "$srcdir/"
	meson test -C "$_builddirectory"
}

package() {
	cd "$srcdir/"
	DESTDIR="$pkgdir" meson install -C "$_builddirectory"
	install -Dm644 "$_sourcedirectory/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

Removing -flto and the build succeeded.

Offline

#9 2021-04-20 16:46:34

icar
Member
From: Catalunya
Registered: 2020-07-31
Posts: 505

Re: [Solved] Can't link any Rust program

I've updated the OP with new makepkg.conf and some other packages I tried and more info.

EDIT:
Removing -flto, adding !lto and clearing all caches worked.

Maybe related to packages assuming -no-pie when -flto (I was told ArchLinux uses -fPIE )

Last edited by icar (2021-04-20 17:49:21)

Offline

Board footer

Powered by FluxBB