#Cant use clang LTO

1 messages · Page 1 of 1 (latest)

jolly drift
#

I followed https://wiki.gentoo.org/wiki/Clang#Advanced_examples

/etc/portage/env/compiler-clang-lto

CXXFLAGS="${CXXFLAGS} -flto=thin"
# -O2 in LDFLAGS refers to binary size optimization during linking, it is NOT related to the -O levels of the compiler             
LDFLAGS="${LDFLAGS} -Wl,-O2 -Wl,--as-needed"

CC="clang"
CXX="clang++"
CPP="clang-cpp" # necessary for xorg-server and possibly other packages
AR="llvm-ar"
NM="llvm-nm"
RANLIB="llvm-ranlib"```

and have added

```/etc/portage/package.env
sys-apps/less compiler-clang-lto```

When I try to emerge it I get this

`clang: error: linker command failed with exit code 1 (use -v to see invocation)`
(Build log) https://paste.gentoo.zip/tTOdJgbS

This happens on any pakage Ive tried adding to /etc/portage/package.env

Any help would be greatly appreciated
jolly drift
#

Thanks alot I tried everything you posted but getting the same error everytime...

jolly drift
#

turns out I had to set USE default-lld on clang-common now it works

#

it might be -fuse-ld=lld

#

Thanks Arni you rock!

junior frigate
#

rustlang obv superior 🤷‍♂️

junior frigate
#

nuthin