Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
hyprland-0.43.0 does not build with clang-18.1.8
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
oneone
Tux's lil' helper
Tux's lil' helper


Joined: 20 Sep 2017
Posts: 103

PostPosted: Wed Sep 18, 2024 6:30 am    Post subject: hyprland-0.43.0 does not build with clang-18.1.8 Reply with quote

Hi there!

I've been happily using hyprland as a wayland compositor for a while, but with the recent update from 0.42.0 to 0.43.0, I ran into an issue. Hyprland 0.43.0 requires C++26 to build and hence gcc-14 or clang-18 or greater will be required to compile hyprland (see https://github.com/hyprwm/Hyprland/releases/tag/v0.43.0).
I usually build everything with gcc and since gcc-14 is still not stable on my platform (amd64), I tried to build hyprland with clang (with the lastest stable version 18.1.8 on amd64).

I created the file /etc/portage/env/compiler-clang with the following contents:
Code:
# Normal settings here
COMMON_FLAGS="-O2 -march=native"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"

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


I also added the following line to a file in /etc/portage/package.env/ in order to compile hyprland with clang as defined in the file above:
Code:
gui-wm/hyprland compiler-clang


However, when trying to build hyprland-0.43.0, the file src/Hyprland.p/debug_Log.cpp.o fails to compile with the following error:
Code:
../hyprland-source/src/debug/Log.cpp:13:26: error: no member named 'native_handle' in 'std::basic_ofstream<char>'


I am not sure, what to make of this. According to https://en.cppreference.com/w/cpp/io/basic_ofstream/native_handle, native_handle() should be defined in the C++26 standard and according to line 364 in the build log, I indeed tried to compile Log.cpp using this standard:
Code:
clang++ -Isrc/Hyprland.p -Isrc -I../hyprland-source/src -Isubprojects/udis86 -I../hyprland-source/subprojects/udis86 -I../hyprland-source/subprojects/udis86/libudis86 -Isubprojects/udis86/__CMake_build -I../hyprland-source/subprojects/udis86/__CMake_build -Iprotocols -I/usr/lib64/libffi/include -I/usr/include/cairo -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/uuid -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c++26 -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-narrowing -Wno-pointer-arith '-DDATAROOTDIR="/usr/share"' -DHAS_EXECINFO -O2 -march=native -pthread -MD -MQ src/Hyprland.p/debug_Log.cpp.o -MF src/Hyprland.p/debug_Log.cpp.o.d -o src/Hyprland.p/debug_Log.cpp.o -c ../hyprland-source/src/debug/Log.cpp


I compiled all the dependencies with gcc, but I believe that clang should be compatible with that and I don't see how that could play any role here. In any case I do not feel like recompiling all dependencies with clang.
Does anybody here have an idea as to what the problem could be?

(Full build log here: https://pastebin.com/GXGCnVDS)


Last edited by oneone on Fri Sep 20, 2024 2:49 pm; edited 2 times in total
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 31267
Location: here

PostPosted: Wed Sep 18, 2024 8:13 am    Post subject: Reply with quote

Upstream issue.
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 31267
Location: here

PostPosted: Wed Sep 18, 2024 8:13 am    Post subject: Reply with quote

Moved from Desktop Environments to Portage & Programming.
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
oneone
Tux's lil' helper
Tux's lil' helper


Joined: 20 Sep 2017
Posts: 103

PostPosted: Wed Sep 18, 2024 8:38 am    Post subject: Reply with quote

Great, thank you! I missed that.
Back to top
View user's profile Send private message
oneone
Tux's lil' helper
Tux's lil' helper


Joined: 20 Sep 2017
Posts: 103

PostPosted: Fri Sep 20, 2024 2:53 pm    Post subject: Reply with quote

Hmm .. I have tried the fix suggested as response to the GitHub issue, i.e. rebuilding clang-runtime with all USE flags set (see https://github.com/hyprwm/Hyprland/issues/7508#issuecomment-2311750591), but I still get the exact same error.

Did anybody else here manage to find a fix / workaround?
Back to top
View user's profile Send private message
oneone
Tux's lil' helper
Tux's lil' helper


Joined: 20 Sep 2017
Posts: 103

PostPosted: Tue Sep 24, 2024 1:25 pm    Post subject: Reply with quote

Ok, I managed to build hyprland-0.43.0 with clang-18 by reverting the changes in https://github.com/hyprwm/Hyprland/pull/7219 with a user patch (see: https://pastebin.com/fyaVL4Az). I think it would be good if these changes could be turned on and off with a compile flag that could then be enabled and disabled with a use flag for those people having issues building by the C++26 standard. I have asked upstream whether that is a possibility.

Those interested can follow the discussion here: https://github.com/hyprwm/Hyprland/issues/7508
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