hyprlock icon indicating copy to clipboard operation
hyprlock copied to clipboard

Building Hyprlock States opengl Dependency Not Met, But Library is Found Before Check.

Open andar1an opened this issue 1 year ago • 17 comments

Regression?

Not Sure

Hyprlock Info and Version

n/a

Compositor Info and Version

n/a

Description

While trying to build for Alpine Linux, I run into an error in CMakeLists.txt where it states it does not pass dependency check from https://github.com/hyprwm/hyprlock/blob/main/CMakeLists.txt#L41, even though the Library is found prior.

-- Found Threads: TRUE
-- Found PkgConfig: /usr/bin/pkg-config (found version "2.3.0")
-- Found OpenGL: /usr/lib/libGL.so
-- Checking for modules 'wayland-client;wayland-protocols;wayland-egl;hyprlang>=0.4.0;egl;opengl;xkbcommon;libjpeg;libwebp;libmagic;cairo;pangocairo;libdrm;gbm;hyprutils>=0.2.0'
--   Package 'opengl' not found
CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:645 (message):
  The following required packages were not found:

   - opengl

Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPkgConfig.cmake:873 (_pkg_check_modules_internal)
  CMakeLists.txt:40 (pkg_check_modules)

How to reproduce

See: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/73090/diffs

Crash reports, logs, images, videos

No response

andar1an avatar Oct 09 '24 18:10 andar1an

This issue also occurs for hyprpaper

andar1an avatar Oct 09 '24 18:10 andar1an

You are missing libOpenGL.so and you even try to patch it to use libGL.so. Why doesn't alpine package libglvnd?

PointerDilemma avatar Oct 09 '24 19:10 PointerDilemma

I am not a maintainer of Alpine, so I don't know. I did not patch anything, the build pipeline may have. I can ask though, I was looking at that dependency the other day, but opengl library selection should definitely not be required to use libglvnd lol.

andar1an avatar Oct 09 '24 19:10 andar1an

also: The CMakeLists file references GL, not OpenGL like Aquamarine. target_link_libraries(hyprlock PRIVATE pam rt Threads::Threads PkgConfig::deps OpenGL::EGL OpenGL::GL)

andar1an avatar Oct 09 '24 19:10 andar1an

 use-legacy-libgl.patch

I just saw that one. And your cmake log shows -- Found OpenGL: /usr/lib/libGL.so.

but opengl library selection should definitely not be required to use libglvnd lol.

that might be true, idk

PointerDilemma avatar Oct 09 '24 19:10 PointerDilemma

That was from a previous attempt because someone suggested trying a patch. It should not be necessary because of the line I mentioned above for Open::GL and EGL. I made this issue in case there was a tweak that could be done in cmakelists file.

I am only trying to test this out, not skin of my back if I can't use it.

andar1an avatar Oct 09 '24 19:10 andar1an

@andar1an

This patch makes it build fine after adding linux-pam-dev to your APKBUILD

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c2dfd6c..5fa29d3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,7 +36,7 @@ message(STATUS "Checking deps...")
 
 find_package(Threads REQUIRED)
 find_package(PkgConfig REQUIRED)
-find_package(OpenGL REQUIRED)
+find_package(OpenGL REQUIRED COMPONENTS "GLES2")
 pkg_check_modules(
   deps
   REQUIRED
@@ -46,7 +46,6 @@ pkg_check_modules(
   wayland-egl
   hyprlang>=0.4.0
   egl
-  opengl
   xkbcommon
   libjpeg
   libwebp

@vaxerski Do we want to include this patch in hyprlock?

PointerDilemma avatar Oct 10 '24 09:10 PointerDilemma

@PaideiaDilemma, thank you. I already have linux-pam, This patch will likely work for hyprpaper and other hypr ecosystem packages requiring opengl (except aquamarine, I think that uses legacy opengl lib). This is not just related to hyprlock.

Why would you include a patch at your end instead of just updating cmakelists?

I get it is temporary fix, but will you update cmakelists for future builds?

andar1an avatar Oct 10 '24 10:10 andar1an

Why would you include a patch at your end instead of just updating cmakelists?

Obviously that is what i mean with include the patch in hyprlock.

PointerDilemma avatar Oct 10 '24 10:10 PointerDilemma

except aquamarine

This comes from aquamarine basically.

This patch will likely work for hyprpaper

Idk hyprpaper does not include a find_package(OpenGL ...) line at all

PointerDilemma avatar Oct 10 '24 10:10 PointerDilemma

except aquamarine

This comes from aquamarine basically.

This patch will likely work for hyprpaper

Idk hyprpaper does not include a find_package(OpenGL ...) line at all

The find package line doesn't seem to be the problem. It finds the package.

The pkg_check_modules() line seems to be, and hyprpaper fails to build for same opengl reason.

I can verify that line is there, maybe unrelated.

andar1an avatar Oct 10 '24 10:10 andar1an

For hyprpaper seems to be a different issue I will dig into later, maybe related to https://github.com/hyprwm/hyprpaper/blob/main/CMakeLists.txt#L124. i have been more focussed on hypridle to learn packaging in alpine.

andar1an avatar Oct 10 '24 10:10 andar1an

Update: Patch confirmed. Feel free to close issue whenever.

andar1an avatar Oct 10 '24 11:10 andar1an

patch appears to be malformed

what? then create it yourself, it is clearly visible what I changed.

Also don't think the initial find package line needs to be change

Did you test it? without it I get

CMake Error at CMakeLists.txt:61 (target_link_libraries):
 Target "hyprlock" links to:

   OpenGL::EGL

 but the target was not found.  Possible reasons include:

   * There is a typo in the target name.
   * A find_package call is missing for an IMPORTED target.
   * An ALIAS target is missing.

it is pkg_check_modules that fails.

That as well, but I consider this to be a alpine problem. Works on every other system i tried, including Freebsd. Even tough technically we probably don't need to include opengl in pkg_check_modules.

PointerDilemma avatar Oct 10 '24 11:10 PointerDilemma

Was an incorrect statement on my part, the patch appears to work for x86_84 and riscv at least. Not so much other archs.

I don't really care so much, I am not a hypr or alpine maintainer. Just wanted to see if hypr ecosystem lives up to hype which means getting the remaining packages in that are not there yet so I can test.

Alpine is one of the only minimalist distros where you don't get a bunch of crap you don't need that I have tested. PostmarketOS is based on Alpine. I imagine Alpine may be a nice distro for hypr to consider testing against in the future. The minimalism goes a long way.

andar1an avatar Oct 10 '24 12:10 andar1an

None of the maintainers use Alpine, thus no alpine testing. If there's anyone maintaining an Alpine build, they can report issues here.

As for the CMakeLists.txt, we could do the same thing Hyprland does https://github.com/hyprwm/Hyprland/blob/main/CMakeLists.txt#L99.

fufexan avatar Oct 10 '24 12:10 fufexan

As a Note:

This patch seemed to do it for hyprpaper as a riff off of above.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 882b66b..8ba72fc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -123,7 +123,8 @@ target_link_libraries(hyprpaper PkgConfig::deps)

+find_package(OpenGL REQUIRED COMPONENTS "GLES2")
 target_link_libraries(
   hyprpaper
-  OpenGL
+  OpenGL::GL
   GLESv2
   pthread
   magic

andar1an avatar Oct 10 '24 13:10 andar1an