Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Cant use clang LTO
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
FilthyPitDog
Apprentice
Apprentice


Joined: 12 Jan 2021
Posts: 196
Location: South Pacific

PostPosted: Mon Dec 23, 2024 8:27 am    Post subject: [Solved] Cant use clang LTO Reply with quote

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

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

Code:
CFLAGS="${CFLAGS} -flto=thin"
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
Code:
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
_________________
Gentoo is a way of life...


Last edited by FilthyPitDog on Mon Dec 23, 2024 10:34 am; edited 1 time in total
Back to top
View user's profile Send private message
sam_
Developer
Developer


Joined: 14 Aug 2020
Posts: 2038

PostPosted: Mon Dec 23, 2024 10:28 am    Post subject: Reply with quote

You need -fuse-ld=lld in *FLAGS or to set default-lld on clang-common.
Back to top
View user's profile Send private message
FilthyPitDog
Apprentice
Apprentice


Joined: 12 Jan 2021
Posts: 196
Location: South Pacific

PostPosted: Mon Dec 23, 2024 10:33 am    Post subject: Reply with quote

sam_ wrote:
You need -fuse-ld=lld in *FLAGS or to set default-lld on clang-common.


Thanks alot setting default-lld on clang-common did the trick
_________________
Gentoo is a way of life...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum