View previous topic :: View next topic |
Author |
Message |
Thymelizabeth n00b
Joined: 12 Jan 2023 Posts: 6 Location: Aotearoa
|
Posted: Wed Oct 18, 2023 9:34 am Post subject: [SOLVED] How to select Clang version for use with portage |
|
|
I'm trying to install gui-apps/waybar-9999 using the clang profile, with sys-devel/clang:17 and 16 installed. As discussed in this issue, clang 17 cannot currently be used to compile waybar, so I want to switch back to clang 16, preferably just for this package.
I know that gcc has `eselect gcc`, does clang have anything similar?
Last edited by Thymelizabeth on Thu Oct 19, 2023 3:11 am; edited 1 time in total |
|
Back to top |
|
|
alamahant Advocate
Joined: 23 Mar 2019 Posts: 3911
|
Posted: Wed Oct 18, 2023 11:10 am Post subject: |
|
|
Would this
Code: |
CC="/usr/lib/llvm/16/bin/clang"
CXX="/usr/lib/llvm/16/bin/clang++"
|
work?
Maybe create
Code: |
/etc/portage/env/clang16.conf ----->>
CC="/usr/lib/llvm/16/bin/clang"
CXX="/usr/lib/llvm/16/bin/clang++"
AR="llvm-ar"
NM="llvm-nm"
RANLIB="llvm-ranlib"
|
and then in
/etc/portage/package.env
Code: |
=gui-apps/waybar-9999 clang16.conf
|
I hope it will work.
Plz check it out. _________________
|
|
Back to top |
|
|
Thymelizabeth n00b
Joined: 12 Jan 2023 Posts: 6 Location: Aotearoa
|
Posted: Thu Oct 19, 2023 3:09 am Post subject: |
|
|
I created Code: | COMMON_FLAGS="-O2 -march=native -pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
CC="/usr/lib/llvm/16/bin/clang"
CXX="/usr/lib/llvm/16/bin/clang++"
AR="/usr/lib/llvm/16/bin/llvm-ar"
NM="/usr/lib/llvm/16/bin/llvm-nm"
RANLIB="/usr/lib/llvm/16/bin/llvm-ranlib"
| in /etc/portage/env/clang16, and
Code: | =gui-apps/waybar-9999 clang16 | in /etc/portage/package.env,
and emerge seemed to use clang 16, but Waybar is still not compiling.
Therefore, this thread's goal is a success, and it doesn't solve my specific problem.
Thanks for your help. |
|
Back to top |
|
|
Pipeartist n00b
Joined: 12 Feb 2023 Posts: 12
|
Posted: Sat Oct 28, 2023 1:21 pm Post subject: |
|
|
If you're trying to use ebuild from the Gentoo tree, you'll need to edit the ebuild on your local machine or use a Waybar ebuild from a "clang friendly" repository. There is a libcxx meson_use in meson_options.txt but it's disabled by default. The build is failing because the build by default is trying to use libstdc++ which doesn't exist on a clang only system unless you explicitly installed gcc. You need to edit ebuild to add libcxx meson_use. You could do it with a libcxx use flag but it's better to do it with a check for libc++ itself.
For example:
Code: | src_configure() {
local emesonargs=(
-Dman-pages=enabled
-Dcava=disabled
$(meson_feature evdev libevdev)
$(meson_feature jack)
$(meson_feature libinput)
$(meson_feature logind)
$(meson_feature mpd)
$(meson_feature mpris)
$(meson_feature network libnl)
$(meson_feature popups gtk-layer-shell)
$(meson_feature pulseaudio)
$(meson_feature pipewire wireplumber)
$(meson_feature sndio)
$(meson_feature systemd)
$(meson_feature test tests)
$(meson_feature tray dbusmenu-gtk)
$(meson_feature udev libudev)
$(meson_feature upower upower_glib)
$(meson_feature wifi rfkill)
$(meson_use experimental)
)
if [[ $(tc-get-cxx-stdlib) == libc++ ]]; then
emesonargs+=( -Dlibcxx=true )
fi
meson_src_configure
}
|
If you add the libc++ check, don't forget to add <toolchain-funcs> eclass to the inherit of the ebuild:
Code: | inherit meson toolchain-funcs |
|
|
Back to top |
|
|
Thymelizabeth n00b
Joined: 12 Jan 2023 Posts: 6 Location: Aotearoa
|
Posted: Tue Oct 31, 2023 7:45 am Post subject: |
|
|
I already had gcc installed, but I recently installed clang 17, and that combined with dev-libs/date to stop waybar from compiling. I eventually solved it by editing the ebuild and removing date from the dependencies list. |
|
Back to top |
|
|
|