Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support clang in meson build #515

Merged
merged 1 commit into from
Aug 12, 2022
Merged

fix: support clang in meson build #515

merged 1 commit into from
Aug 12, 2022

Conversation

SignalWalker
Copy link
Contributor

Describe your PR, what does it fix/add?

Fixes an error when building with Clang, which doesn't yet support -std=c++23, and instead uses -std=c++2b.

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

Tested with Clang 14.0.6 and GCC 12.1.1.

Ideally, someone will replace this with default_options : [ ..., 'cpp_std=c++23' ] once Meson supports that.

Is it ready for merging, or does it need work?

👍

@SignalWalker SignalWalker changed the title fix: support clang in meson builds fix: support clang in meson build Aug 12, 2022
@viperML
Copy link
Contributor

viperML commented Aug 12, 2022

Maybe we could fix this warning instead:

meson.build:14: WARNING: Consider using the built-in option for language standard version instead of using "-std=c++23"

@vaxerski
Copy link
Member

Does clang actually compile Hyprland? it didnt want to iirc a while ago

@viperML
Copy link
Contributor

viperML commented Aug 12, 2022

https://github.com/viperML/Hyprland/actions/runs/2848249132

It doesn't seem like at first glance (standard builds failed when trying to push to cache)

@SignalWalker
Copy link
Contributor Author

SignalWalker commented Aug 12, 2022

Maybe we could fix this warning instead:

meson.build:14: WARNING: Consider using the built-in option for language standard version instead of using "-std=c++23"

Meson only supports that flag with C++ <= 20 right now, and Hyprland seems to require C++23. This is why I wrote it to use has_argument instead of project(default_options).

https://github.com/viperML/Hyprland/actions/runs/2848249132

It doesn't seem like at first glance (standard builds failed when trying to push to cache)

Clang uses libc++ by default (instead of libstdc++). std::unreachable() was added to libc++ in version 15. Nixpkgs's LLVM stdenv derivations clamp their libc++ versions to that of their corresponding Clang binary. The latest version of Clang available in Nixpkgs is v14.0.6, so the latest version of libc++ in Nixpkgs is v14.0.6.

Those builds failed because you ran them with llvmPackages_12 and llvmPackages_13, which don't provide versions of libc++ recent enough to have std::unreachable(). To get Clang to build Hyprland in Nix, you'd need something like llvmPackages_15, which doesn't yet exist in Nixpkgs.

@fufexan
Copy link
Member

fufexan commented Aug 12, 2022

If it does build in clang fine, I'd say this is ready to merge. We'll be using GCC in the Nix builds anyway. Not sure if there's a benefit to using Clang instead but I'll be happy to hear it out if there is.

@SignalWalker
Copy link
Contributor Author

SignalWalker commented Aug 12, 2022

If it does build in clang fine, I'd say this is ready to merge. We'll be using GCC in the Nix builds anyway. Not sure if there's a benefit to using Clang instead but I'll be happy to hear it out if there is.

Honestly it's mostly just because I have CC=clang and CXX=clang++ set and it was making yay -Syu fail when updating Hyprland. I just like Clang's UI more.

@vaxerski
Copy link
Member

ok

@vaxerski vaxerski merged commit 662b600 into hyprwm:main Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants