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

Add pkgconfig data for libraries implemented so far #86

Closed
wants to merge 1 commit into from

Conversation

nwnk
Copy link
Contributor

@nwnk nwnk commented Apr 12, 2016

This preserves the names from Mesa's gl, glesv1_cm, and glesv2 pkgconfig
data, and for compatibility with that, gl.pc gives you libGL. If newer
applications want to explicitly depend on libGLX and the appropriate
rendering API they can ask for the new pkgconfig names.

This preserves the names from Mesa's gl, glesv1_cm, and glesv2 pkgconfig
data, and for compatibility with that, gl.pc gives you libGL. If newer
applications want to explicitly depend on libGLX and the appropriate
rendering API they can ask for the new pkgconfig names.
@tfogal
Copy link

tfogal commented Apr 12, 2016

should there be an egl.pc.in to match the glx one?

@kbrenneman
Copy link
Collaborator

should there be an egl.pc.in to match the glx one?

No, libglvnd doesn't implement EGL yet.

@nwnk
Copy link
Contributor Author

nwnk commented Apr 15, 2016

I think to really land this we need to also install include/GL/*.h and include/GLES/*.h. Or, I suppose, package them some other way and reference that from the Requires: line.

@kbrenneman
Copy link
Collaborator

That's a good question, actually: Should we install the normal GL/GLES/GLX headers from the libglvnd tree?

Installing the header files from the same place as the corresponding libraries kinda makes sense, but they're likely to become out of date pretty quickly.

Khronos's subversion repository is arguably the upstream version of those, but it doesn't include any packaging-related stuff. It's also missing gl.h, and I think there were a couple problems with the GLX headers last time I looked, but that's all fixable.

@cubanismo
Copy link

Agreed the headers should really come from Khronos somehow, and we really should solve the lack-of-a-canonical-gl.h issue there. We've been trying to assert that Khronos and/or distros are the right source for these rather than install our chronically out of date versions from our driver installer, and I doubt glvnd would be drastically better at staying in sync.

@evelikov
Copy link
Contributor

I tend to see GLVND as a bit more than just a frontend/loader/dispatch library. IMHO it comes as "the one and only thing you need to create GL applications against". Requiring one to have mesa, in order to get the headers (compile time deps.) and GLVND for the libraries (link time deps.) does sound a bit fishy.

And yes, distributions tend to ship mesa's headers as Khronos does not provide gl.h or glx.h, plus I believe there's been an occasion or two where the public headers were out of date wrt the internal copy.

Obviously if vendors have specific needs (for example mesa has eglmesaext.h) they will ship only them.

If there are any concerns about things going out of date, one can setup a script that fetches/updates things ;-)

@nwnk
Copy link
Contributor Author

nwnk commented Apr 25, 2016

And yes, distributions tend to ship mesa's headers as Khronos does not provide gl.h or glx.h, plus I believe there's been an occasion or two where the public headers were out of date wrt the internal copy.

The headers Khronos does provide are generated from public scripts and the registry xml at this point. It's straightforward to add a gl.h template at least (and I've opened a Khronos bug about it).

@evelikov
Copy link
Contributor

If Khronos can provide the full set of headers (just like they do for OpenCL) that'll be even better.

@vcunat
Copy link

vcunat commented Oct 2, 2016

From a packager's point of view, I would really like this to get integrated – is there something in particular blocking it? I believe almost all packages should be built against vendor-neutral files only, including headers, pkg-config and libs.

EDIT: BTW, there is EGL support on master already, apparently.

vcunat added a commit to vcunat/libglvnd that referenced this pull request Oct 2, 2016
@kbrenneman
Copy link
Collaborator

I'll need to update this to include the EGL headers, but other than that, I'd be fine with adding the pkgconfig files for the various OpenGL libraries to libglvnd. I think I've got a modified version of the header generation script somewhere that'll generate the old gl.h file.

The main question is whether there's a good way to keep the libglvnd files up-to-date with the upstream Khronos XML files. It's easy enough to go grab the updated XML files and check in copies to libglvnd, but remembering to do that periodically is the problem.

Also a more minor question, should we also add a configure option for whether or not to include the GL headers? If you're building and installing libglvnd manually on an existing system, then you might not want to overwrite the files that the package manager's installed.

@vcunat
Copy link

vcunat commented Oct 3, 2016

Isn't the overwriting situation similar for the libraries as well? I'd assume that "users" either use a custom prefix or they know what they're doing (even separate prefixes for headers, libs etc. are possible already, I think, as usual with auto-tools).

@parkerlreed
Copy link

I tried building wlroots with this and got a -lEGL undefined error. I need to get back to my machine to get the exact output.

Copy link

@fooishbar fooishbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few changes to the names and descriptions; I think the version numbers should also relate to the actual APIs being exposed, rather than just being the glvnd package version. Mesa has already gone down the route of exposing its package version, and that was definitely a mistake.

libdir=@libdir@
includedir=@includedir@

Name: gl

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Name: gl
Name: glesv1_cm

libdir=@libdir@
includedir=@includedir@

Name: openg

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Name: openg
Name: opengl

includedir=@includedir@

Name: openg
Description: libglvnd OpenGL library

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Description: libglvnd OpenGL library
Description: OpenGL (without GLX) headers and interface

includedir=@includedir@

Name: glx
Description: libglvnd GLX library

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Description: libglvnd GLX library
Description: GLX library and headers

includedir=@includedir@

Name: gles2
Description: libglvnd OpenGL ES v2+ library

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Description: libglvnd OpenGL ES v2+ library
Description: OpenGL ES v2/v3 library and headers

includedir=@includedir@

Name: gl
Description: libglvnd OpenGL ES v1 library

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Description: libglvnd OpenGL ES v1 library
Description: OpenGL ES-CM v1 library and headers

includedir=@includedir@

Name: gl
Description: libglvnd legacy OpenGL library

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Description: libglvnd legacy OpenGL library
Description: Legacy OpenGL and GLX library and headers

@1ace
Copy link
Contributor

1ace commented Mar 27, 2019

I think egl.pc should also be part of this PR

@Valmar33
Copy link

Seeing as the patch doesn't apply cleanly, and I wanted something that works so wlroots-git was happy, I rebased it:

Add-pkgconfig-data-for-libraries-implemented-so-far.tar.gz

@terencode
Copy link

@fooishbar if @nwnk doesn't answer, I can propose a new PR with your suggestions.

@ppaalanen
Copy link

What @evelikov and @fooishbar said here are what I want to see happening as well. The same package/project must provide all of library, headers, and pkg-config files together to allow building software against them. That is what people using them expect, and anything else is just confusing.

I also agree that pkg-config files for APIs (EGL, OpenGL, GL ES 1, GL ES 2, etc.) should be versioned by the API version they provide, not by the project version, because users are using e.g. GL ES 2, not libglvnd or Mesa per se. I'm just slightly worried that Mesa has set a precedent here for these .pc files specifically, making going for API version numbers potentially break some users, but I cannot name any user that would actually break, so maybe there is hope.

@kbrenneman
Copy link
Collaborator

I'd agree with @fooishbar's changes to make the pkg-config names match the library names. That also gives them the best chance to work as a drop-in replacement for Mesa's pkg-config files.

I'd also agree that the version number should match the API version that they expose, not the package version of libglvnd or Mesa itself. If you're building a program that uses GL/GLX/EGL, then you don't care about the build-time version of Mesa. You might care about what set of stuff is declared in the header files, but the OpenGL headers already use macros to indicate which versions and extensions are declared.

Changing the version number might require updating other projects that look for a specific version number, but I would suspect that those cases are very rare for the reasons above. Besides, if we're moving the pkg-config files to libglvnd, then it wouldn't be practical to track Mesa's version number in them, so we'd have to change the version number anyway.

@kbrenneman
Copy link
Collaborator

For reference, the version numbers that we'd want to use for each library are:

  • libGL.so -- version 1.2
  • libOpenGL.so -- version 4.5
  • libEGL.so -- version 1.5
  • libGLX.so -- version 1.4
  • libGLESv1_CM.so -- version 1.0
  • libGLESv2.so -- version 3.2

@Haxk20
Copy link

Haxk20 commented Jun 11, 2019

Hello, Is there any idea when this will get merged as when mesa dropped those files out of their packages we on Arch linux have been unable to build GNOME mutter.

@GrieverV
Copy link

Rebased and attempted to address comments and suggested changes:
https://gist.github.com/GrieverV/bdfe32e040a721046e0c9ec57d559123

This was just copy and pasting; I have no idea what I'm doing. I only rebased this PR so my packages would properly build again. Hopefully this is correct functionality-wise and can be useful to others that require it.

@tjaalton
Copy link

Rebased and attempted to address comments and suggested changes:
https://gist.github.com/GrieverV/bdfe32e040a721046e0c9ec57d559123

This was just copy and pasting; I have no idea what I'm doing. I only rebased this PR so my packages would properly build again. Hopefully this is correct functionality-wise and can be useful to others that require it.

you missed changes to src/GLX/Makefile.am and src/OpenGL/Makefile.am

@GrieverV
Copy link

you missed changes to src/GLX/Makefile.am and src/OpenGL/Makefile.am

Fixed. Must have forgotten to add them when generating the commit for diffing or simply overlooked.

@kbrenneman
Copy link
Collaborator

What about the header files, though? If packagers have to grab those from Mesa and/or Khronos, then just getting the pkg-config files from libglvnd instead of Mesa doesn't seem helpful.

@fooishbar
Copy link

What about the header files, though? If packagers have to grab those from Mesa and/or Khronos, then just getting the pkg-config files from libglvnd instead of Mesa doesn't seem helpful.

I think it would be helpful to ship the header files as well. If you're shipping libGL.so.1 which exposes the glUniform1f symbol, then why not ship the corresponding header file to allow you to use it?

Anyway, even without the headers, one of the things pkg-config does is to tell build systems where to find libraries to link to, without having to hardcode -L/prefix/foo/lib paths in every GL user. So this is definitely helpful regardless.

@terencode
Copy link

With https://gitlab.freedesktop.org/mesa/mesa/commit/1a25980c469b38d2c6456344fe538ad1bcb47f63 libglvnd will also need to provide egl.pc

@terencode
Copy link

terencode commented Jul 23, 2019

Updated patch to provide egl.pc :
Add-pkgconfig-data-for-libraries-implemented-so-far.txt

@goddessfreya
Copy link

goddessfreya commented Jul 24, 2019

Thank you @terencode, however that patch does not apply for me:

patching file configure.ac
patching file src/EGL/Makefile.am
patching file src/EGL/egl.pc.in
patching file src/GLESv1/Makefile.am
patching file src/GLESv1/glesv1_cm.pc.in
patching file src/GLESv2/Makefile.am
patching file src/GLESv2/glesv2.pc.in
patching file src/GLX/Makefile.am
patching file src/GLX/glx.pc.in
patching file src/OpenGL/Makefile.am
patching file src/OpenGL/opengl.pc.in
patch unexpectedly ends in middle of line
patch: **** malformed patch at line 151:  

Shuffling around the order of the diffs fixes stuff. Here is what worked for me: https://gentz.rocks/files/1563985448/Add-pkgconfig-data-for-libraries-implemented-so-far.patch

@terencode
Copy link

terencode commented Jul 24, 2019

@zegentzy Oups, I don't know what I'm did wrong with github gist so here is the actual file: https://github.com/NVIDIA/libglvnd/files/3428633/Add-pkgconfig-data-for-libraries-implemented-so-far.txt

@mattst88
Copy link
Contributor

mattst88 commented Aug 1, 2019

Kyle, can you please commit this? As far as I know, this is the only thing I need in Gentoo in order to ship libglvnd by default.

@terencode
Copy link

One thing to note is the version the pkgconfig files will provide will be the same as libglvnd with the current code, which will make them have a lower version than when it was shipped with mesa.

For example JHBuild expects egl.pc and glesv2.pc to be respectively at 10.1.3 and 9.2 but they are all at 1.1.1

@mattst88
Copy link
Contributor

mattst88 commented Aug 1, 2019

One thing to note is the version the pkgconfig files will provide will be the same as libglvnd with the current code, which will make them have a lower version than when it was shipped with mesa.

For example JHBuild expects egl.pc and glesv2.pc to be respectively at 10.1.3 and 9.2 but they are all at 1.1.1

Easily solvable once this pull request is finally committed. Those versions of Mesa are so old that the version check is next to useless.

@5schatten
Copy link

5schatten commented Aug 31, 2019

@kbrenneman @nwnk
Well since Mesa 19.2.0 dropped egl.pc with this commit https://github.com/mesa3d/mesa/commit/1a25980c469b38d2c6456344fe538ad1bcb47f63 if -D glvnd=true and the latest Nvidia drives https://www.nvidia.com/Download/driverResults.aspx/150803/en-us depends on GLVND & dropped non-GLVND libs it would IMHO great if this PR could be rebased on #86 (comment) and merged soon. Otherwise we were not able to use the latest MESA & Nvidia drivers without patching this package ourselves which is not really convenient. 🤔

@kbrenneman
Copy link
Collaborator

I've got the new .pc files in pull request #179.

The main difference from the patches here is that I changed the version numbers to match the API versions instead of the package version, and I added the header files to the installation.

@kbrenneman
Copy link
Collaborator

I've got the changes checked in now as #179, so closing this one.

@kbrenneman kbrenneman closed this Sep 4, 2019
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.