Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Should I live with bleeding-edge LLVM?
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
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2112

PostPosted: Fri Aug 02, 2024 7:30 pm    Post subject: Should I live with bleeding-edge LLVM? Reply with quote

I suspect the answer is no, but first some background:
My system is configured to use the LLVM/Clang toolchain (except where either the ebuilds override, or where I've hit a problem and reverted to gcc), and it's all OK.
I compile my kernels using the latest stable source from kernel.org, rather than using gentoo-sources or any of the newer Gentoo options.
And to add excitement, I compile the kernels with "KCFLAGS='-march=native'". Still (mostly) OK.

The bit that's now not OK is that the kernel compilation fails with Clang:18, and produces a nice message asking me to report a bug to the LLVM developers, which I did. They tell me the cure (I bet you were expecting this) is to upgrade to version 19. That's in portage, but keyworded out of visibility unless you add a file overrides to portage.accept_keywords and edit it to replace 18-foo with 19-bah.
Installing that, and then remembering to "source /etc/profile" meant that I could now build my kernel OK. So I'm a happy bunny, except with two issues:

1) Am I correct in thinking portage just uses the current toolchain, so if I were to run "emerge --update", I'd now be compiling with LLVM:19, and this might be brave, or exciting, or other synonyms for stupid :-)
2) While I note there are now three 60llvm-foo files in /etc/env.d, which select slot 17, 18 and 19 versions, there seems to be neither "eselect llvm" nor "llvm-config" (or rather not one that's equivalent to gcc-config) to manage them. Am I missing a switch?

Of course, I could just trust the LLVM guys and run 19.1.0.
_________________
Greybeard
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2164

PostPosted: Fri Aug 02, 2024 7:38 pm    Post subject: Re: Should I live with bleeding-edge LLVM? Reply with quote

Goverp wrote:

1) Am I correct in thinking portage just uses the current toolchain, so if I were to run "emerge --update", I'd now be compiling with LLVM:19, and this might be brave, or exciting, or other synonyms for stupid :-)


AFAIK some packages will check for and use specific slot.

Goverp wrote:
2) While I note there are now three 60llvm-foo files in /etc/env.d, which select slot 17, 18 and 19 versions, there seems to be neither "eselect llvm" nor "llvm-config" (or rather not one that's equivalent to gcc-config) to manage them. Am I missing a switch?


No, you're not. But keep the older versions. You might need them.

Having said that I have no idea if there are other implications. This is just out of my general knowledge. In fact I have less experience than you with llvm/clang because I run standard setup.

p.s. bleeding edge would be 9999 which I personally would do anything to avoid.

Best Regards,
Georgi
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3605
Location: Rasi, Finland

PostPosted: Fri Aug 02, 2024 8:35 pm    Post subject: Reply with quote

I feel like there's a need for llvm eselect module...
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2164

PostPosted: Sat Aug 03, 2024 6:28 am    Post subject: Reply with quote

Zucca wrote:
I feel like there's a need for llvm eselect module...


I there was, the devs would have done it already. There isn't.

Best Regards,
Georgi
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3605
Location: Rasi, Finland

PostPosted: Sat Aug 03, 2024 7:16 am    Post subject: Reply with quote

It would look like modifying llvm related files under /etc/env.d/ and then running env-update you could possibly change the default llvm being used.
I've only played around with one llvm toolchain system... So, I have very little experience on this.
Goverp wrote:
While I note there are now three 60llvm-foo files in /etc/env.d
Three sounds like one after another overrides what the previous set. Sounds odd.

EDIT: Of course you can tell portage to use different version of llvm by other means.

logrusx wrote:
I there was, the devs would have done it already. There isn't.

Best Regards,
Georgi
Well at least for now there's not that much need. But people (only three I can quickly count now. :P) have been asking where the eselect module is.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2164

PostPosted: Sat Aug 03, 2024 8:38 am    Post subject: Reply with quote

Zucca wrote:


logrusx wrote:
I there was, the devs would have done it already. There isn't.

Best Regards,
Georgi
Well at least for now there's not that much need. But people (only three I can quickly count now. :P) have been asking where the eselect module is.


Maybe because they are drawing false analogy with gcc...
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2112

PostPosted: Sat Aug 03, 2024 10:53 am    Post subject: Reply with quote

You're right, bleeding-edge is 9999, and 19 is mainstream. And presumably there's no "eselect llvm" because there's no need, as it's a pretty solid toolchain.
Though :19 has yet to reach even ~amd86, I may just leave it, or maybe write my own "eselect llvm", which probably create a private /etc/env,d/65llvm-bloody, run env-update and issue a large reminder to restart terminal windows/reboot to taste.
_________________
Greybeard
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2164

PostPosted: Sat Aug 03, 2024 11:41 am    Post subject: Reply with quote

I guess if eselect llvm clang appears, then the should be eselect compiler or something and it'll be a huge mess.
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3605
Location: Rasi, Finland

PostPosted: Sat Aug 03, 2024 1:36 pm    Post subject: Reply with quote

logrusx wrote:
...and it'll be a huge mess.
I have my own experience on that. gcc-config totally messed up my llvm toolchain. (That Issue is probably already fixed.) That's another story then...
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
Ralphred
Guru
Guru


Joined: 31 Dec 2013
Posts: 554

PostPosted: Sat Aug 03, 2024 6:30 pm    Post subject: Reply with quote

Goverp wrote:
You're right, bleeding-edge is 9999, and 19 is mainstream.

Personally, I'd qpkg 19 (just in case I need to compile another kernel before it's sans ~), remove 19, leave as many of the deps as practicable in situ (no depcleans for a bit) and revert to 18 for "normal emerge stuff".
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2112

PostPosted: Sat Aug 03, 2024 11:20 pm    Post subject: Reply with quote

As I use a binpkg server, I have both :18 and :19 on the shelf. :smug:
_________________
Greybeard
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2112

PostPosted: Fri Aug 23, 2024 4:31 pm    Post subject: Reply with quote

<edit>Whoops, "llvm-config" already exists, and does complex stuff, and is part of llvm.
So I'll rename my script to "config-llvm", though maybe it ought to be a "llvm.eselect" module.
</edit>

For anyone who wants an alpha-release config-llvm, here's my quick-and-dirty version.
It manages a symlink "60llvm-0000", which will sort before any of the other "60llvm-<foo>" profiles.

It ought to issue "env-update" and a warning saying to ". /etc/profile' when necessary, but it doesn't.


Comparing it with gcc-config just makes me feel well inadequate :-)
Code:
#!/bin/sh

action="${1:--h}"
desired="$2"

cd /etc/env.d || exit 1

symlink="60llvm-0000"

[ -f "$symlink" ] && current=$(realpath "$symlink")
current="${current##*/}"

grep -E -o '^PATH=.*/llvm/[0-9]+' 60llvm-99* | \
while read -r prof
do
        file="${prof%:*}"
        version="${prof#*:}"
        level="${version##*/}"
        case "$current" in
        '')
                current="$file"
                selected='(default)'
                ;;
        "$file")
                selected='*'
                ;;
        *)
                selected=''
                ;;
        esac
        case "$action" in
        -l)     printf '[%s] %s %s\n' "$level" "$file" "$selected" ;;
        -c)     [ "$selected" ] && printf '[%s] %s %s\n' "$level" "$file" "$selected" ;;
        -s)     if [ "$level" = "$desired" ]
                then
                        rm -f "$symlink"
                        ln -s "$file" "$symlink"
                        exit
                fi
                ;;
        -u)     rm -f "$symlink"
                exit
                ;;
        -h)
                cat << EOF
Syntax:
        config-llvm [action] [desired level]
Where action is:
        -l      list profiles
        -c      list current profile
        -s      set profile
        -u      unset profile (revert to default, latest version)
        -h      help - print this list
EOF
                exit
                ;;
        *)      printf 'Error: options -l, -c, -s, -u, -h\n'
                exit
                ;;
        esac
done

_________________
Greybeard
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