Closed JohnRTitor closed 2 days ago
CC @fufexan
sounds like std version is not propagating properly
@JohnRTitor can you pull again and check the logs for any occurrence of -std=c++26
?
FYI:
I guess Clang is using the Libcxx provided by GCC, instead of the one from LLVM...
This should be a platform-specific issue. I had the same issue before in Gentoo. Changing the USE flag of clang-runtime
fixed this issue:
➤ ~/.dot-files/shell/.zshrc.d [master] $ equery u clang-runtime
[ Legend : U - final flag setting for installation]
[ : I - package is installed with flag ]
[ Colors : set, unset ]
* Found these USE flags for sys-devel/clang-runtime-18.1.8:
U I
+ + abi_x86_32 : 32-bit (x86) libraries
+ + compiler-rt : Install sys-libs/compiler-rt for -rtlib=compiler-rt
+ + libcxx : Install sys-libs/libcxx for -stdlib=libc++
+ + openmp : Install sys-libs/libomp for -fopenmp support
+ + sanitize : Enable compiler-rt sanitizer (-fsanitize*) support
should this be closed then...?
I can build it with a ton of warnings, but it builds fine. clangBuild.log
It seems @yangyingchao is correct. His standard lib is messed up.
Vax any specific reason why hyperpm still has set(CMAKE_CXX_STANDARD 23)?
should this be closed then...?
I think so.
@JohnRTitor can you pull again and check the logs for any occurrence of
-std=c++26
?
❯ nix log /nix/store/qs5bzckc4r2blibl668xw1nyf90vclxc-hyprland-0.42.0+date=2024-08-27_17ed4fc.drv | grep c++26
warning: The interpretation of store paths arguments ending in `.drv` recently changed. If this command is now failing try again with '/nix/store/qs5bzckc4r2blibl668xw1nyf90vclxc-hyprland-0.42.0+date=2024-08-27_17ed4fc.drv^*'
/nix/store/k4l2mg07nyd7flfkxgbz63j63hnwfvnw-clang-wrapper-18.1.8/bin/clang++ -DDATAROOTDIR=\"/nix/store/lf87khzkc5nq088ngzc1vckc7g74cfwp-hyprland-0.42.0+date=2024-08-27_17ed4fc/share\" -DHAS_EXECINFO -DHyprland_EXPORTS -DUSES_SYSTEMD -I/build/source/. -I/build/source/src -I/build/source/subprojects/udis86 -I/build/source/protocols -I/build/source/subprojects/udis86/libudis86 -isystem /nix/store/3v10x1zfcd17wlkd87rl1q8gk3d878vw-cairo-1.18.0-dev/include/cairo -isystem /nix/store/sa2vr5rkh19pvy9j4hkb4lk95nlhqpix-glib-2.80.4-dev/include/glib-2.0 -isystem /nix/store/7lr9qdizm42pf6clysg7syrky0si8aab-glib-2.80.4/lib/glib-2.0/include -isystem /nix/store/7c6z1pgh5s0sxc8i75qdm1qs02ihmh7j-libdrm-2.4.122-dev/include/libdrm -isystem /nix/store/b9609cffnpms4vqsyxa0f1ixc7prffdp-util-linux-minimal-2.39.4-dev/include/uuid -isystem /nix/store/f6a81f3wnj3xrr06x0yydz6q5z5h81rw-pango-1.52.2-dev/include/pango-1.0 -isystem /nix/store/72ddhqsm72lbzdv1izi97fdxbc7215i8-harfbuzz-9.0.0-dev/include/harfbuzz -O2 -g -DNDEBUG -std=gnu++26 -O3 -std=c++26 -Wall -Wextra -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-narrowing -Wno-pointer-arith -fmacro-prefix-map=/build/source/= -Winvalid-pch -Xclang -include-pch -Xclang /build/source/build/CMakeFiles/Hyprland.dir/cmake_pch.hxx.pch -Xclang -include -Xclang /build/source/build/CMakeFiles/Hyprland.dir/cmake_pch.hxx -MD -MT CMakeFiles/Hyprland.dir/src/debug/Log.cpp.o -MF CMakeFiles/Hyprland.dir/src/debug/Log.cpp.o.d -o CMakeFiles/Hyprland.dir/src/debug/Log.cpp.o -c /build/source/src/debug/Log.cpp
Vax any specific reason why hyperpm still has set(CMAKE_CXX_STANDARD 23)?
I just haven't changed it and hyprpm doesn't need 26 unlike hyprland
@JohnRTitor can you pull again and check the logs for any occurrence of
-std=c++26
?❯ nix log /nix/store/qs5bzckc4r2blibl668xw1nyf90vclxc-hyprland-0.42.0+date=2024-08-27_17ed4fc.drv | grep c++26 warning: The interpretation of store paths arguments ending in `.drv` recently changed. If this command is now failing try again with '/nix/store/qs5bzckc4r2blibl668xw1nyf90vclxc-hyprland-0.42.0+date=2024-08-27_17ed4fc.drv^*' /nix/store/k4l2mg07nyd7flfkxgbz63j63hnwfvnw-clang-wrapper-18.1.8/bin/clang++ -DDATAROOTDIR=\"/nix/store/lf87khzkc5nq088ngzc1vckc7g74cfwp-hyprland-0.42.0+date=2024-08-27_17ed4fc/share\" -DHAS_EXECINFO -DHyprland_EXPORTS -DUSES_SYSTEMD -I/build/source/. -I/build/source/src -I/build/source/subprojects/udis86 -I/build/source/protocols -I/build/source/subprojects/udis86/libudis86 -isystem /nix/store/3v10x1zfcd17wlkd87rl1q8gk3d878vw-cairo-1.18.0-dev/include/cairo -isystem /nix/store/sa2vr5rkh19pvy9j4hkb4lk95nlhqpix-glib-2.80.4-dev/include/glib-2.0 -isystem /nix/store/7lr9qdizm42pf6clysg7syrky0si8aab-glib-2.80.4/lib/glib-2.0/include -isystem /nix/store/7c6z1pgh5s0sxc8i75qdm1qs02ihmh7j-libdrm-2.4.122-dev/include/libdrm -isystem /nix/store/b9609cffnpms4vqsyxa0f1ixc7prffdp-util-linux-minimal-2.39.4-dev/include/uuid -isystem /nix/store/f6a81f3wnj3xrr06x0yydz6q5z5h81rw-pango-1.52.2-dev/include/pango-1.0 -isystem /nix/store/72ddhqsm72lbzdv1izi97fdxbc7215i8-harfbuzz-9.0.0-dev/include/harfbuzz -O2 -g -DNDEBUG -std=gnu++26 -O3 -std=c++26 -Wall -Wextra -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-narrowing -Wno-pointer-arith -fmacro-prefix-map=/build/source/= -Winvalid-pch -Xclang -include-pch -Xclang /build/source/build/CMakeFiles/Hyprland.dir/cmake_pch.hxx.pch -Xclang -include -Xclang /build/source/build/CMakeFiles/Hyprland.dir/cmake_pch.hxx -MD -MT CMakeFiles/Hyprland.dir/src/debug/Log.cpp.o -MF CMakeFiles/Hyprland.dir/src/debug/Log.cpp.o.d -o CMakeFiles/Hyprland.dir/src/debug/Log.cpp.o -c /build/source/src/debug/Log.cpp
So it looks like CMake is finally passing a good flag (-std=gnu++26
). Could you try removing the patch from the derivation and checking if it builds?
This is that nixos moment.
I still haven't figured out how I can make sure wrappers aren't appending -std=gnu++23 in the dev shell.
Works fine with nix build .\?submodules=1#hyprland-debug
, but not with using cmake
in the dev shell. But the nix build
variant denies me incremental builds, so if someone has a solution for me please let me know <3.
Edit: I missed ./nix/stdcxx.patch using that fixes it :)
This was caused by #7219, src/debug/Log.cpp
needs native_handle
which isn't implemented until C++26. If we replace std::ofstream
with just int
and use open
, write
, and other POSIX methods for fd's then we can change the stdlib requirement back to C++23.
This is probably the best option since many distro's will likely not support C++26 for quite some time. Being one of the maintainers for LLVM in Nixpkgs, I can't guarantee that we will actually support C++26 with LLVM in Nixpkgs.
I guess C++26 might not be ready for widespread adoption for lots of distors in several years...
So I'm afraid that this might block some people from upgrading to 0.43...
cmake dep bumped, so this can be closed. clang and gcc will build hyprland provided they are up to date (and so is cmake)
I guess C++26 might not be ready for widespread adoption for lots of distors in several years...
Spec won't be finalized until January 2026 (https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p1000r6.pdf). This means that the earliest which LLVM could implement support is July 2026. That is essentially two years from now.
clang and gcc will build hyprland provided they are up to date (and so is cmake)
That's for Nix, what should other distros do that don't have a new enough LLVM or GCC. Should everyone just compile the compiler just for this one package?
Spec won't be finalized until January 2026 (https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p1000r6.pdf). This means that the earliest which LLVM could implement support is July 2026. That is essentially two years from now.
This is plain wrong.
what should other distros do that don't have a new enough LLVM or GCC
update their llvm/gcc before updating hyprland.
This is plain wrong.
2026.1 – tbd CD ballot comment resolution C++26 technically finalized, start DIS ballot
No, the wrong part is "This means that the earliest which LLVM could implement support is July 2026"
Easily disproven by the fact clang18 supports the C++26 method we use.
Easily disproven by the fact clang18 supports the C++26 method we use.
That is true however, not everyone is going to use the same C++ implementation. Most people do use libstdc++ and libc++ but not everyone might not. Plus versions which aren't finalized are not stable. Using a non stable version is a concern of mine because of possible side effects which could cause unwanted behavior during runtime.
Another concern is people might not want to mix compiler versions, especially if it's an unstable version.
once a paper is approved for C++26, it's approved. It won't be "un-approved".
This is still an issue by the way @fufexan
Tried to nix-build
but failing to build the drv?
❯ nix-build b08dk0zmaxyi73z4m1gb201h7lznql5c-hyprland-0.43.0+date=2024-09-10_155d440.drv
error: syntax error, expecting ')'
at /home/masum/b08dk0zmaxyi73z4m1gb201h7lznql5c-hyprland-0.43.0+date=2024-09-10_155d440.drv:1:15:
1| Derive([("dev","/nix/store/3w2620zjd9ndafblf11i59bfib01fapy-hyprland-0.43.0+date=2024-09-10_155d440-dev","",""),("man","/nix/store/6pcid89czq1dvmyd7s7d9887li5zfcgc-hyprland-0.43.0+date=2024-09-10_155d440-man","",""),("out","/nix/store/xv7gmh12ir7xxgippq9y8pigm9j22pal-hyprland-0.43.0+date=2024-09-10_155d440","","")],[("/
(vaxry: just use rust ;)
@JohnRTitor clang18Stdenv
is not configured to use the correct stdlib from what I've seen, and it has to be forced. We could add a patch for it and enable it only for clang builds (which means we will introduce separate *-clang packages).
Here's a command that worked for me for a simple test of using std::basic_ofstream<char>
's native_handle
:
$ c++ -std=c++26 -stdlib=libc++ -nostdinc++ -I /nix/store/c55xcry32njvs6q3b40qnsw283c4jdx2-libcxx-18.1.8-dev/include/c++/v1 -L /nix/store/pfdygjng4hdnwmnll4qmxnycxkkbbwla-libcxx-18.1.8/lib -Wl,-rpath,/nix/store/pfdygjng4hdnwmnll4qmxnycxkkbbwla-libcxx-18.1.8/lib native_handle_test.cpp
I got the syntax above from https://stackoverflow.com/a/65004156.
clang18Stdenv
is not configured to use the correct stdlib from what I've seen
If we could patch on the nixpkgs side, that would be great, this likely affects other packages as well.
which means we will introduce separate *-clang packages
I am not sure if there's a need to introduce seperate packages.
clang18Stdenv
is not configured to use the correct stdlib from what I've seen, and it has to be forced.
That is kinda true, it's designed to use the main stdenv's C++ implement. You'll have to override it to use libc++ if you want to use that.
Looks like libcxxStdenv
almost does the trick, except I get a few linking failures.
hyprland> [233/250] Linking CXX executable hyprctl/hyprctl
hyprland> FAILED: hyprctl/hyprctl
hyprland> : && /nix/store/4wphwqdc7jz18nl9z2sda5ryafl4fm1y-clang-wrapper-18.1.8/bin/clang++ -O2 -g -DNDEBUG -Wl,--export-dynamic -rdynamic hyprctl/CMakeFiles/hyprctl.dir/main.cpp.o -o hyprctl/hyprctl /nix/store/gf5bjfck5c7sl4mdkbw8qawb3vw5xmyl-hyprutils-0.2.1+date=2024-08-29_8976e3f/lib/libhyprutils.so && :
hyprland> /nix/store/d828ccvc2148g7m49hh3mzvyzwpipy46-binutils-2.42/bin/ld: hyprctl/CMakeFiles/hyprctl.dir/main.cpp.o: in function `main':
hyprland> /build/source/hyprctl/main.cpp:343:(.text+0x3f43): undefined reference to `Hyprutils::String::isNumber(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)'
hyprland> /nix/store/d828ccvc2148g7m49hh3mzvyzwpipy46-binutils-2.42/bin/ld: /build/source/hyprctl/main.cpp:424:(.text+0x4c2c): undefined reference to `Hyprutils::String::isNumber(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)'
hyprland> clang++: error: linker command failed with exit code 1 (use -v to see invocation)
hyprland> [234/250] Building CXX object CMakeFiles/Hyprland.dir/protocols/ext-session-lock-v1.cpp.o
hyprland> [235/250] Building CXX object CMakeFiles/Hyprland.dir/protocols/presentation-time.cpp.o
hyprland> [236/250] Building CXX object CMakeFiles/Hyprland.dir/protocols/xwayland-shell-v1.cpp.o
hyprland> [237/250] Building CXX object CMakeFiles/Hyprland.dir/protocols/primary-selection-unstable-v1.cpp.o
hyprland> [238/250] Building CXX object CMakeFiles/Hyprland.dir/protocols/tablet-v2.cpp.o
hyprland> [239/250] Building CXX object CMakeFiles/Hyprland.dir/protocols/viewporter.cpp.o
hyprland> [240/250] Linking CXX executable hyprpm/hyprpm
hyprland> FAILED: hyprpm/hyprpm
hyprland> : && /nix/store/4wphwqdc7jz18nl9z2sda5ryafl4fm1y-clang-wrapper-18.1.8/bin/clang++ -O2 -g -DNDEBUG -Wl,--export-dynamic -rdynamic hyprpm/CMakeFiles/hyprpm.dir/src/core/DataState.cpp.o hyprpm/CMakeFiles/hyprpm.dir/src/core/Manifest.cpp.o hyprpm/CMakeFiles/hyprpm.dir/src/core/PluginManager.cpp.o hyprpm/CMakeFiles/hyprpm.dir/src/main.cpp.o hyprpm/CMakeFiles/hyprpm.dir/src/progress/CProgressBar.cpp.o -o hyprpm/hyprpm /nix/store/6n7mjzp32m0srz21s5n82cgly7pg1h00-aquamarine-0.3.3+date=2024-09-01_f8a687d/lib/libaquamarine.so /nix/store/rnlflxkgglrdiii7wl7k99893zr4iamc-libxkbcommon-1.7.0/lib/libxkbcommon.so /nix/store/5dwg0biim3ws7a2hyadmvfzsazqcgkk5-util-linux-minimal-2.39.4-lib/lib/libuuid.so /nix/store/0xxjgp8nqgdwfnqbvavp1g61n8vbvyh1-wayland-1.23.0/lib/libwayland-server.so /nix/store/17ligilsrswqnrfdvv0al2mvqpvlcr96-pango-1.52.2/lib/libpangocairo-1.0.so /nix/store/17ligilsrswqnrfdvv0al2mvqpvlcr96-pango-1.52.2/lib/libpango-1.0.so /nix/store/lsrix2cqck6rcsshjpn4y6j9dysni78f-harfbuzz-9.0.0/lib/libharfbuzz.so /nix/store/rflkfhqh794nw7vgdzrg0lhjii6v3w8r-cairo-1.18.0/lib/libcairo.so /nix/store/fbs3ykc63n06yczp4bq3pr53g5l4crwx-pixman-0.43.4/lib/libpixman-1.so /nix/store/j7pclr7nq518ld7fhl1g79w4amdb4p2l-libXcursor-1.2.2/lib/libXcursor.so /nix/store/n2aif1mg86whm5ls99w33558whkyh4za-libdrm-2.4.122/lib/libdrm.so /nix/store/4h5k8gvvx52cwm1hlqvlaj6k6gmnqllb-libinput-1.26.1/lib/libinput.so /nix/store/hykhzxanlm463wpcw2546rp9ba8hjcz6-mesa-24.2.1/lib/libgbm.so /nix/store/d1jna110cihfr8024bgb504r5pvamrnv-glib-2.80.4/lib/libgio-2.0.so /nix/store/d1jna110cihfr8024bgb504r5pvamrnv-glib-2.80.4/lib/libgobject-2.0.so /nix/store/d1jna110cihfr8024bgb504r5pvamrnv-glib-2.80.4/lib/libglib-2.0.so /nix/store/8a0xnfn0d6xd6hhwarqqaaa42bap96by-hyprlang-0.5.2+date=2024-09-01_c12ab78/lib/libhyprlang.so /nix/store/cj5d1x363hkl5g2z3vdw9yf9kp4a4yw7-hyprcursor-0.1.9+date=2024-08-02_912d560-lib/lib/libhyprcursor.so /nix/store/gf5bjfck5c7sl4mdkbw8qawb3vw5xmyl-hyprutils-0.2.1+date=2024-08-29_8976e3f/lib/libhyprutils.so && :
hyprland> /nix/store/d828ccvc2148g7m49hh3mzvyzwpipy46-binutils-2.42/bin/ld: hyprpm/CMakeFiles/hyprpm.dir/src/core/PluginManager.cpp.o: in function `CPluginManager::headersValid()':
hyprland> /build/source/hyprpm/src/core/PluginManager.cpp:371:(.text+0x7cfb): undefined reference to `Hyprutils::String::trim(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)'
hyprland> /nix/store/d828ccvc2148g7m49hh3mzvyzwpipy46-binutils-2.42/bin/ld: hyprpm/CMakeFiles/hyprpm.dir/src/core/PluginManager.cpp.o: in function `CPluginManager::updateHeaders(bool)':
hyprland> /build/source/hyprpm/src/core/PluginManager.cpp:444:(.text+0x97cf): undefined reference to `Hyprutils::String::trim(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)'
hyprland> clang++: error: linker command failed with exit code 1 (use -v to see invocation)
Regression?
Yes
System Info and Version
System/Version info
NixOS 24.11, but irrelevantDescription
Build fails with Clang. Happens on Clang 18, 19.
How to reproduce
Compile Hyprland on NixOS with clang.
On nix, you can just override
stdenv
, setpkgs.clangStdenv
orpkgs.llvmPackages.stdenv
.Crash reports, logs, images, videos