hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
20.98k stars 880 forks source link

Hyprland build error on Ubuntu #7246

Closed rydymth closed 2 months ago

rydymth commented 2 months ago

Regression?

No

System Info and Version

System/Version info ```sh Hyprland, built from branch main at commit ab0a3268e04f2295ec4455be90ce8d0c2b107b8d (xdg-shell: fixup unassigned wl surfaces to xdg surfaces). Date: Thu Aug 1 19:13:19 2024 Tag: v0.41.2-154-gab0a3268, commits: 5040 flags: (if any) System Information: System name: Linux Node name: rudraUbuntuBook Release: 6.10.0-1-t2-jammy Version: #1 SMP PREEMPT_DYNAMIC Wed Jul 24 05:39:53 IST 2024 GPU information: 00:02.0 VGA compatible controller [0300]: Intel Corporation Iris Plus Graphics G4 (Ice Lake) [8086:8a5c] (rev 07) (prog-if 00 [VGA controller]) 74:00.1 Non-VGA unclassified device [0000]: Apple Inc. T2 Bridge Controller [106b:1801] (rev 01) 74:00.2 Non-VGA unclassified device [0000]: Apple Inc. T2 Secure Enclave Processor [106b:1802] (rev 01) os-release: PRETTY_NAME="Ubuntu 24.04 LTS" NAME="Ubuntu" VERSION_ID="24.04" VERSION="24.04 LTS (Noble Numbat)" VERSION_CODENAME=noble ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=noble LOGO=ubuntu-logo plugins: ======Config-Start====== Config File: /home/rudy/.config/hypr/hyprland.conf: Read Succeeded source = ~/.config/hypr/EnvVars.conf source = ~/.config/hypr/Autostart.conf source = ~/.config/hypr/keybinds.conf source = ~/.config/hypr/windowRules.conf source = ~/.config/hypr/Config.conf monitor = eDP-1, preferred highrr,0x0, 1.6 monitor=DP-2,preferred highrr,auto-right,auto monitor=DP-3,preferred highrr,auto-right,auto Config File: /home/rudy/.config/hypr/EnvVars.conf: Read Succeeded env = MOZ_ENABLE_WAYLAND,1 env = _JAVA_AWT_WM_NONREPARENTING,1 env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1 Config File: /home/rudy/.config/hypr/Autostart.conf: Read Succeeded exec-once = systemctl --user import-environment & exec-once = hash dbus-update-activation-environment 2>/dev/null & exec-once = dbus-update-activation-environment --systemd & exec-once = xdg-desktop-portal-hyprland & exec-once = ln -s $XDG_RUNTIME_DIR/hypr /tmp/hypr exec-once = udiskie -a -n exec-once = /lib/x86_64-linux-gnu/libexec/polkit-kde-authentication-agent-1 exec-once = hyprpaper -n exec-once = ags -b rudy exec-once = hypridle & exec-once = hyprctl setcursor Bibata-Modern-Classic 30 Config File: /home/rudy/.config/hypr/keybinds.conf: Read Succeeded $mainMod = SUPER # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more bind = $mainMod, RETURN, exec, wezterm-gui bind = $mainMod, Q, killactive, bind = $mainMod, M, exec, wlogout bind = $mainMod, E, exec, nautilus bind = $mainMod SHIFT, V, togglefloating, bind = $mainMod, SPACE, exec, ags -b rudy -t spotlight bind = $mainMod SHIFT, P, pseudo, # dwindle bind = $mainMod, B, exec, killall -q ags; ags -b rudy bind = $mainMod, F, fullscreen bind = CTRL, L, exec, hyprlock bind = $mainMod, W, exec, killall -q hyprpaper; hyprpaper -n # Move focus with mainMod + arrow keys bind = $mainMod, H, movefocus, l bind = $mainMod, L, movefocus, r bind = $mainMod, K, movefocus, u bind = $mainMod, J, movefocus, d bind = $mainMod SHIFT, H, movewindow, l bind = $mainMod SHIFT, L, movewindow, r bind = $mainMod SHIFT, K, movewindow, u bind = $mainMod SHIFT, J, movewindow, d bind = $mainMod SHIFT, MINUS, movetoworkspace, special bind = $mainMod, MINUS, togglespecialworkspace # Resize bind=SUPER,R,submap,resize submap=resize binde=,L,resizeactive,10 0 binde=,H,resizeactive,-10 0 binde=,K,resizeactive,0 -10 binde=,J,resizeactive,0 10 bind=,escape,submap,reset submap=reset # Switch workspaces with mainMod + [0-9] bind = $mainMod, 1, workspace, 1 bind = $mainMod, 2, workspace, 2 bind = $mainMod, 3, workspace, 3 bind = $mainMod, 4, workspace, 4 bind = $mainMod, 5, workspace, 5 bind = $mainMod, 6, workspace, 6 bind = $mainMod, 7, workspace, 7 bind = $mainMod, 8, workspace, 8 bind = $mainMod, 9, workspace, 9 bind = $mainMod, 0, workspace, 10 # Move active window to a workspace with mainMod + SHIFT + [0-9] bind = $mainMod SHIFT, 1, movetoworkspace, 1 bind = $mainMod SHIFT, 2, movetoworkspace, 2 bind = $mainMod SHIFT, 3, movetoworkspace, 3 bind = $mainMod SHIFT, 4, movetoworkspace, 4 bind = $mainMod SHIFT, 5, movetoworkspace, 5 bind = $mainMod SHIFT, 6, movetoworkspace, 6 bind = $mainMod SHIFT, 7, movetoworkspace, 7 bind = $mainMod SHIFT, 8, movetoworkspace, 8 bind = $mainMod SHIFT, 9, movetoworkspace, 9 bind = $mainMod SHIFT, 0, movetoworkspace, 10 # Scroll through existing workspaces with mainMod + scroll bind = $mainMod, mouse_down, workspace, e+1 bind = $mainMod, mouse_up, workspace, e-1 binde = ,XF86AudioRaiseVolume, exec, pamixer -i 5 binde = ,XF86AudioLowerVolume, exec, pamixer -d 5 binde = ,XF86MonBrightnessUp, exec, brightnessctl set 500+ binde = ,XF86MonBrightnessDown, exec, brightnessctl set 500- binde = ,XF86KbdBrightnessDown, exec, brightnessctl --device=':white:kbd_backlight' set 587- binde = ,XF86KbdBrightnessUp, exec, brightnessctl --device=':white:kbd_backlight' set 587+ bind = $mainMod CTRL, 3, exec, grimshot --notify save screen /home/rudy/Pictures/Screenshots/SC-$(date +"%Y%m%d%H%M%S").png bind = $mainMod CTRL, 4, exec, grimshot --notify save area /home/rudy/Pictures/Screenshots/SC-$(date +"%Y%m%d%H%M%S").png # Move/resize windows with mainMod + LMB/RMB and dragging bindm = $mainMod, mouse:272, movewindow bindm = $mainMod, mouse:273, resizewindow # Switches # bindl=,switch:off:Lid Switch,exec,hyprctl keyword monitor "eDP-1, preferred highrr, 0x0, auto" # bindl=,switch:on:Lid Switch,exec,hyprctl keyword monitor "eDP-1, disable" Config File: /home/rudy/.config/hypr/windowRules.conf: Read Succeeded blurls = bar-0 blurls = Dock-0 blurls = notifications blurls = RNotif blurls = Volume blurls = ScreenBrightness blurls = controlPanel blurls = utilWindow layerrule = ignorezero, notifications layerrule = ignorezero, RNotif layerrule = ignorezero, Dock-0 layerrule = ignorezero, Volume layerrule = ignorezero, ScreenBrightness layerrule = ignorezero, bar-0 Config File: /home/rudy/.config/hypr/Config.conf: Read Succeeded input { kb_layout = us kb_variant = kb_model = kb_options = kb_rules = follow_mouse = 1 touchpad { natural_scroll = yes } natural_scroll = 1 sensitivity = 0.33 # -1.0 - 1.0, 0 means no modification. } general { # See https://wiki.hyprland.org/Configuring/Variables/ for more gaps_in = 2 gaps_out = 3 border_size = 3 col.active_border = rgb(6F9442) col.inactive_border = rgba(44475a00) layout = dwindle } decoration { # See https://wiki.hyprland.org/Configuring/Variables/ for more rounding = 7 blur { size = 3 passes = 4 new_optimizations = true ignore_opacity = true xray = false vibrancy = 1 } drop_shadow = no } animations { enabled = true # bezier = bounce, 0.55, 0.33, 0.07, 0.72 # animation = windowsIn, 1, 3, bounce # animation = windowsOut, 1, 3, bounce # animation = windowsMove, 1, 3, bounce # animation = workspaces, 1, 5, bounce # animation = specialWorkspace, 1, 5, default, fade # animation = border, 0, 1, default # animation = borderangle, 0, 1, default animation = windowsOut, 1, 7, default, slide animation = windowsIn, 1, 7, default, slide } dwindle { # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below preserve_split = yes # you probably want this } gestures { # See https://wiki.hyprland.org/Configuring/Variables/ for more workspace_swipe = on } misc { disable_hyprland_logo = true disable_splash_rendering = true animate_mouse_windowdragging = false } cursor { enable_hyprcursor = true hide_on_key_press = true persistent_warps = true } debug { disable_scale_checks = true } xwayland { force_zero_scaling = true } ======Config-End======== ```

Description

Build error in ubuntu

[58/246] Building CXX object CMakeFiles/Hyprland.dir/src/debug/Log.cpp.o
FAILED: CMakeFiles/Hyprland.dir/src/debug/Log.cpp.o
/usr/bin/c++ -DDATAROOTDIR=\"/usr/local/share\" -DHAS_EXECINFO -DHyprland_EXPORTS -DUSES_SYSTEMD -I/home/rudy/Downloads/Hyprland/. -I/home/rudy/Downloads/Hyprland/src -I/home/rudy/Downloads/Hyprland/subprojects/udis86 -I/home/rudy/Downloads/Hyprland/protocols -I/home/rudy/Downloads/Hyprland/subprojects/udis86/libudis86 -isystem /usr/include/uuid -isystem /usr/include/cairo -isystem /usr/include/libpng16 -isystem /usr/include/freetype2 -isystem /usr/include/pixman-1 -isystem /usr/include/pango-1.0 -isystem /usr/include/glib-2.0 -isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem /usr/include/harfbuzz -isystem /usr/include/libmount -isystem /usr/include/blkid -isystem /usr/include/fribidi -isystem /usr/include/libdrm -O3 -DNDEBUG -std=gnu++23 -O3 -Wall -Wextra -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-narrowing -Wno-pointer-arith -fmacro-prefix-map=/home/rudy/Downloads/Hyprland/= -pthread -Winvalid-pch -include /home/rudy/Downloads/Hyprland/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 /home/rudy/Downloads/Hyprland/src/debug/Log.cpp
/home/rudy/Downloads/Hyprland/src/debug/Log.cpp: In function ‘void Debug::init(const std::string&)’:
/home/rudy/Downloads/Hyprland/src/debug/Log.cpp:13:26: error: ‘std::ofstream’ {aka ‘class std::basic_ofstream<char>’} has no member named ‘native_handle’
   13 |     auto handle = logOfs.native_handle();
      |                          ^~~~~~~~~~~~~
[63/246] Building CXX object CMakeFiles/Hyprland.dir/src/Compositor.cpp.o
/home/rudy/Downloads/Hyprland/src/Compositor.cpp: In lambda function:
/home/rudy/Downloads/Hyprland/src/Compositor.cpp:66:14: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   66 |         write(2, msg, strlen(msg));
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
make[1]: *** [Makefile:15: release] Error 1
make[1]: Leaving directory '/home/rudy/Downloads/Hyprland'
make: *** [Makefile:33: all] Error 2

Do i need to update any dependencies? Already updated hyprutils and aquamarine to latest.

How to reproduce

On ubuntu system, clone recursively and make all.

Crash reports, logs, images, videos

No response

hdm9527 commented 2 months ago

https://github.com/hyprwm/Hyprland/commit/83a334f97df4389ca30cb63e50317a66a82562b9

cpiber commented 2 months ago

I've noticed that the build still shows -std=gnu++23, not sure where it's coming from, but native_handle is only available from C++26

rydymth commented 2 months ago

https://github.com/hyprwm/Hyprland/commit/83a334f97df4389ca30cb63e50317a66a82562b9

Thanks that solved my issue!!!

I've noticed that the build still shows -std=gnu++23, not sure where it's coming from, but native_handle is only available from C++26

Yupp had a similar issue Used the following and it worked just fine. export "CXX=/usr/bin/gcc-14 -std=gnu++26" Closing this issue. Thankyou everyone!

acheong08 commented 2 months ago
$ export "CXX=/usr/bin/gcc -std=gnu++26"

$ gcc --version
gcc (GCC) 14.1.1 20240701 (Red Hat 14.1.1-7)
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[50/247] Building CXX object hyprpm/CMakeFiles/hyprpm.dir/s[55/247] Linking CXX executable hyprctl/hyprctl
FAILED: hyprctl/hyprctl 
: && /usr/bin/gcc  -std=gnu++26 -O3 -DNDEBUG -Wl,--export-dynamic -rdynamic hyprctl/CMakeFiles/hyprctl.dir/main.cpp.o -o hyprctl/hyprctl  /usr/lib64/libhyprutils.so && :
/usr/bin/ld: hyprctl/CMakeFiles/hyprctl.dir/main.cpp.o: undefined reference to symbol '_ZNKSt6locale4nameB5cxx11Ev@@GLIBCXX_3.4.21'
/usr/bin/ld: /usr/lib64/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
[57/247] Building CXX object...prland.dir/cmake_pch.hxx.gc
ninja: build stopped: subcommand failed.
make[1]: *** [Makefile:15: release] Error 1
make[1]: Leaving directory '/home/acheong/dependencies/Hyprland'
make: *** [Makefile:33: all] Error 2
cpiber commented 2 months ago

@acheong08 the instructions aren't quite right, this is trying to build C++ with a C compiler, what worked for me was this:

export CXX=/usr/bin/g++-14
export CXXFLAGS=-std=gnu++26
export CC=/usr/bin/gcc-14

This tells cmake to use gcc 14 for C and C++, and sets the flags properly via their own variable

SdKay commented 2 weeks ago
$ export "CXX=/usr/bin/gcc -std=gnu++26"

$ gcc --version
gcc (GCC) 14.1.1 20240701 (Red Hat 14.1.1-7)
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[50/247] Building CXX object hyprpm/CMakeFiles/hyprpm.dir/s[55/247] Linking CXX executable hyprctl/hyprctl
FAILED: hyprctl/hyprctl 
: && /usr/bin/gcc  -std=gnu++26 -O3 -DNDEBUG -Wl,--export-dynamic -rdynamic hyprctl/CMakeFiles/hyprctl.dir/main.cpp.o -o hyprctl/hyprctl  /usr/lib64/libhyprutils.so && :
/usr/bin/ld: hyprctl/CMakeFiles/hyprctl.dir/main.cpp.o: undefined reference to symbol '_ZNKSt6locale4nameB5cxx11Ev@@GLIBCXX_3.4.21'
/usr/bin/ld: /usr/lib64/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
[57/247] Building CXX object...prland.dir/cmake_pch.hxx.gc
ninja: build stopped: subcommand failed.
make[1]: *** [Makefile:15: release] Error 1
make[1]: Leaving directory '/home/acheong/dependencies/Hyprland'
make: *** [Makefile:33: all] Error 2

I solved exactly same problem on Ubuntu24.04 by adding link library stdc++:

target_link_libraries(Hyprland stdc++ m)                               # CMakeLists.txt
target_link_libraries(hyprpm PUBLIC PkgConfig::deps stdc++ m)          # hyprpm/CMakeLists.txt
target_link_libraries(hyprctl PUBLIC PkgConfig::hyprctl_deps stdc++ m) # hyprctl/CMakeLists.txt