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

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

Open
andar1an opened this issue Oct 9, 2024 · 17 comments
Labels
bug Something isn't working

Comments

@andar1an
Copy link

andar1an commented Oct 9, 2024

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 andar1an added the bug Something isn't working label Oct 9, 2024
@andar1an
Copy link
Author

andar1an commented Oct 9, 2024

This issue also occurs for hyprpaper

@PaideiaDilemma
Copy link
Contributor

PaideiaDilemma commented Oct 9, 2024

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

@andar1an
Copy link
Author

andar1an commented Oct 9, 2024

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
Copy link
Author

andar1an commented Oct 9, 2024

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)

@PaideiaDilemma
Copy link
Contributor

PaideiaDilemma commented Oct 9, 2024

 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

@andar1an
Copy link
Author

andar1an commented Oct 9, 2024

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.

@PaideiaDilemma
Copy link
Contributor

@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?

@andar1an
Copy link
Author

andar1an commented Oct 10, 2024

@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?

@PaideiaDilemma
Copy link
Contributor

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.

@PaideiaDilemma
Copy link
Contributor

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

@andar1an
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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

@PaideiaDilemma
Copy link
Contributor

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.

@andar1an
Copy link
Author

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.

@fufexan
Copy link
Member

fufexan commented Oct 10, 2024

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.

@andar1an
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants