-
Notifications
You must be signed in to change notification settings - Fork 198
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
build error ubuntu: /usr/bin/ld: cannot find -lGL #103
Comments
I'm running into this as well, my understand that (at least for me) this is due to an issue with how OpenGL is accessed on Wayland and how you technically have to go through |
I took a brief look at this, it does seem to be platform specific. The GLFW build docs explain
That said, since I'm not able to reproduce this error, and am also not personally very familiar with the changes in the OpenGL context scenario, I think those docs are actually a little bit outdated.
The CMake docs on |
I'm not sure if I'm experiencing the same exact issue as the OP, as I am not on Ubuntu, but I am getting the same error, so I will try to continue this issue and answer @svenevs questions. If OP is on the latest Ubuntu, which is Wayland, then we might be experiencing the same issue - because this is the problem I am encountering when trying to compile on a Wayland-only machine.
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find OpenGL (missing: OPENGL_glx_LIBRARY) This issue makes sense in my context - as -- Found OpenGL: /usr/lib64/libOpenGL.so found components: OpenGL
-- NanoGUI: gl pref: GLVND
-- NanoGUI: using OpenGL::OpenGL Of course to actually have the next step, |
Now if OP is indeed running into the same issue as me due to being on Wayland, they will run into another error upon fixing the previous one.
Since obviously |
Hey all... I appreciate you all looking into the issue... will mess around with this at some point today and report back |
Hey svenevs...
I'm on Ubuntu 20.04.3 LTS (Focal Fossa) by the way |
FYI Had a friend build on Ubuntu 21.10 impish with success... he has some ideas on the issue will follow up... |
Hmmm, ok, thanks for the responses it's very helpful! So it seems like there's potentially two different things going on here, but the solution seems to also be related. # My understanding is this fixes the original issue on 20.04
find_package(OpenGL REQUIRED COMPONENTS OpenGL)
target_link_libraries(nanogui PUBLIC OpenGL::OpenGL)
# note, not the PR solution, will break superbuild consumers (see below) What's not clear to me is if this is supposed to be getting avoided on wayland altogether. Maybe the above gets guarded by checking I did some trial and error but am actually failing to obtain a wayland session on this rig (nvidia drivers, wasn't able to get around it...). I will be able to test off a live usb of ubuntu in february if you poke me (away next week). Some additional things worth trying for diagnosing wayland:
The TL;DR is it's part of "superbuilds", mitsuba-renderer and tev are some examples. There's also historical reasons, but basically dependency management with CXX has always been a nightmare so usually projects vendor their own. The way the glfw fork works is by patching glfw So for consuming projects doing superbuilds, linking against Hope that clarifies things a bit, sorry if it is not clear it's late but wanted to explain a bit of the different moving parts. |
Thank you for moving this forward so quickly!
Thanks for the explanation, this makes more sense now. Though I'm not convinced this is worth it, given how it becomes harder to stay up to date with the latest
Perhaps then this can be ameliorated by using the Cache variables FindOpenGL provides. |
Try building and using WaylandGUI that is a fork I started focusing only on ARM Linux but it doesn't force ARM on you. At least two of the examples should work for you. |
Hey all... just to followup here... it builds fine on Ubuntu 21.10 impish... so this is solved for me at least |
Sorry for joining the party very late -- are there any concrete suggestions on how to change the CMake build system so that it works for Wayland? I am still based on X11 and things are fine there. |
I left off with the work I did for WaylandGUI which is a fork of this. Had to drop all of the unnecessary platforms, MAC/Apple, Windows, etc. The Apple/Mac support is what screwed the pooch. I haven't touched it since this thread. My project used Elements for the final product. I used NanoGUI inside of a Docker container for the board verification software and everybody abandoned Wayland. Having said that. Another on this thread will be picking up some work on WaylandGUI shortly if they haven't already done so. They hit the same wall in their project and they don't have the option of using a Docker container. Both myself and Toradex advised them on finding the smallest Wayland compatible library they could and wedging it into their existing UI library. Sadly I don't have my test system set up anymore nor do I currently have the time to devote to WaylandGUI. That's a personal project that got pushed down the queue. As long as you continue to support Apple/MAC with that custom EGLS (or whatever custom that got added for the platform) you will never work on Wayland. That relies on an API that simply isn't there. If you want Wayland you have to abandon Apple or at least abandon everything currently in place for Apple because it wasn't well done. It's "worked for an application" code not "works for a project" code. If memory serves, I had at least two of the demo programs working under Wayland with WaylandGUI. |
[ 63%] Linking CXX shared library libnanogui.so
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/nanogui.dir/build.make:629: libnanogui.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:330: CMakeFiles/nanogui.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
The text was updated successfully, but these errors were encountered: