Skip to content

[baseline][osg] Prefer GLVND libraries#28089

Closed
dg0yt wants to merge 15 commits intomicrosoft:masterfrom
dg0yt:osg
Closed

[baseline][osg] Prefer GLVND libraries#28089
dg0yt wants to merge 15 commits intomicrosoft:masterfrom
dg0yt:osg

Conversation

@dg0yt
Copy link
Copy Markdown
Contributor

@dg0yt dg0yt commented Nov 30, 2022

Fixes an osg build error, occuring in vcpkg CI. Cf. #28087. (But this PR doesn't resolve the issue that "#include <GL/gl.h> is ambiguous on case-insensitve file systems".)

github-actions[bot]
github-actions bot previously approved these changes Nov 30, 2022
@MonicaLiu0311 MonicaLiu0311 added the category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist label Dec 1, 2022
@dg0yt
Copy link
Copy Markdown
Contributor Author

dg0yt commented Dec 1, 2022

Hm, now osg build step doesn't find GL/glext.h. Despite depending on opengl-registry which does install the file.

And the configure step probably also doesn't find the headers:

-- Found OpenGL: opengl32   
-- Could NOT find EGL (missing: EGL_LIBRARY) 
-- Performing Test GL_HEADER_HAS_GLINT64
-- Performing Test GL_HEADER_HAS_GLINT64 - Failed
-- Performing Test GL_HEADER_HAS_GLUINT64
-- Performing Test GL_HEADER_HAS_GLUINT64 - Failed

@dg0yt dg0yt changed the title [osg] Help with opengl includes [baseline][osg] Help with opengl includes Dec 1, 2022
@dg0yt
Copy link
Copy Markdown
Contributor Author

dg0yt commented Dec 1, 2022

Now tested with both opengl-registry and mesa installed before osg: It is just a matter of preferring GLVND libraries. osg is stuck at cmake_minimum_required(VERSION 2.8.0) but needs to use the new CMP0072 behaviour.
FTR there was a warning about CMP0072 in local linux logs but not x64-windows-static-md failure logs from CI.

github-actions[bot]
github-actions bot previously approved these changes Dec 1, 2022
@dg0yt dg0yt changed the title [baseline][osg] Help with opengl includes [baseline][osg] Prefer GLVND libraries Dec 1, 2022
@dg0yt dg0yt marked this pull request as ready for review December 1, 2022 06:36
@Neumann-A
Copy link
Copy Markdown
Contributor

Neumann-A commented Dec 1, 2022

Hmm that policy affects windows? Seems like a cmake bug to me since glvnd isn't available on windows.

@Neumann-A
Copy link
Copy Markdown
Contributor

https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/FindOpenGL.cmake#L157 doesn't even search for libs it also doesn't set OPENGL_INCLUDE_DIR.
And no the policy does not affect windows.

@dg0yt
Copy link
Copy Markdown
Contributor Author

dg0yt commented Dec 1, 2022

Yeah, I got the wrong port when I meant to test with mesa :-(
And now I will have to wait for a llvm rebuild :-(

@dg0yt dg0yt force-pushed the osg branch 3 times, most recently from 37c1c13 to 01dba92 Compare December 2, 2022 08:33
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

EGL user ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

At this point I'm only trying to reproduce the CI installation order, by comparing CI config and cache logs.
I still need to reproduce the original issue.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Looking closer again:

--- config.pr.txt
+++ config.ci.txt
@@ -x +x @@
 -- Found OpenGL: opengl32   
--- Could NOT find EGL (missing: EGL_LIBRARY) 
+-- Found ZLIB: optimized;D:/installed/x64-windows-static-md/lib/zlib.lib;debug;D:/installed/x64-windows-static-md/debug/lib/zlibd.lib (found version "1.2.13") 
+-- Found EGL: D:/installed/x64-windows-static-md/lib/libEGL.lib  
 -- Performing Test GL_HEADER_HAS_GLINT64
--- Performing Test GL_HEADER_HAS_GLINT64 - Failed
+-- Performing Test GL_HEADER_HAS_GLINT64 - Success
 -- Performing Test GL_HEADER_HAS_GLUINT64
--- Performing Test GL_HEADER_HAS_GLUINT64 - Failed

There is an extra ZLIB for the full CI, coming from the wrapper in port egl, not from osg's primitive FindEGL.cmake.

That wrapper changes CMAKE_REQUIRED_LIBRARIES before taking a backup. Is this intentional? This probably puts the vcpkg include dir into every following test, via ZLIB::ZLIB.

if(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
list(APPEND CMAKE_REQUIRED_LIBRARIES "${GLESv2_LIBRARY_DEBUG}" "${ANGLE_LIBRARY_DEBUG}" ZLIB::ZLIB D3d9.lib dxguid.lib DXGI.lib)
else()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${GLESv2_LIBRARY_RELEASE}" "${ANGLE_LIBRARY_RELEASE}" ZLIB::ZLIB D3d9.lib dxguid.lib DXGI.lib)
endif()
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-DKHRONOS_STATIC")
find_package(ZLIB REQUIRED)
set(VCPKG_BACKUP_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
set(VCPKG_BACKUP_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

before taking a backup.

that is probably an accident.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also you want to depend on egl instead of angle in this case then

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Also you want to depend on egl instead of angle in this case then

Doesn't matter ATM. Again, it is just for reproducing full CI context.

dg0yt added 3 commits December 2, 2022 21:06
osg is stuck at cmake_minimum_required(VERSION 2.8.0).
Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This is a new experimental fast check for PR issues. Please let us know if this bot is helpful!

PRs must add only one version and must not modify any published versions

When making any changes to a library, the version or port-version in vcpkg.json or CONTROL must be modified.

error: checked-in files for osg have changed but the version was not updated
version: 3.6.5#19
old SHA: bcc0ad3dac22833ea35fde8b207ec76d2838eabd
new SHA: 9fb8f8f9eb17b5ebd52dd267a170b7f9e59c41df
Did you remember to update the version or port version?
Use --overwrite-version to bypass this check
***No files were updated***

@Neumann-A
Copy link
Copy Markdown
Contributor

hmm have you tried /showIncludes in VCPKG_C(XX)_FLAGS ?

@dg0yt
Copy link
Copy Markdown
Contributor Author

dg0yt commented Dec 3, 2022

No, I'm still learning MSVC ;-) It is a pity that the include path is not logged.
And it is a shame that the llvm artifact still breaks caching.

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This is a new experimental fast check for PR issues. Please let us know if this bot is helpful!

PRs must add only one version and must not modify any published versions

When making any changes to a library, the version or port-version in vcpkg.json or CONTROL must be modified.

error: checked-in files for osg have changed but the version was not updated
version: 3.6.5#19
old SHA: bcc0ad3dac22833ea35fde8b207ec76d2838eabd
new SHA: 6da44a73ec56b8f85a8ac7a3fe29f0de5c52dbff
Did you remember to update the version or port version?
Use --overwrite-version to bypass this check
***No files were updated***
After committing all other changes, the version database must be updated
git add -u && git commit
git checkout 163fe7bd3d67c41200617caaa245b5ba2ba854e6 -- versions
./vcpkg x-add-version --all
Diff
diff --git a/versions/baseline.json b/versions/baseline.json
index 1e012bd..2f82011 100644
--- a/versions/baseline.json
+++ b/versions/baseline.json
@@ -4818,7 +4818,7 @@
     },
     "mesa": {
       "baseline": "22.1.7",
-      "port-version": 0
+      "port-version": 1
     },
     "meschach": {
       "baseline": "1.2b",
@@ -5498,7 +5498,7 @@
     },
     "opengl": {
       "baseline": "2022-10-08",
-      "port-version": 0
+      "port-version": 1
     },
     "opengl-registry": {
       "baseline": "2022-09-29",
diff --git a/versions/m-/mesa.json b/versions/m-/mesa.json
index 9151abe..5907cb7 100644
--- a/versions/m-/mesa.json
+++ b/versions/m-/mesa.json
@@ -1,5 +1,10 @@
 {
   "versions": [
+    {
+      "git-tree": "7e29ce205a462289948c62291e69076c8cbcdc08",
+      "version": "22.1.7",
+      "port-version": 1
+    },
     {
       "git-tree": "7febde5a35ffc0cc975e25219121f5dc7048e0ef",
       "version": "22.1.7",
diff --git a/versions/o-/opengl.json b/versions/o-/opengl.json
index baed0ae..40cfb45 100644
--- a/versions/o-/opengl.json
+++ b/versions/o-/opengl.json
@@ -1,5 +1,10 @@
 {
   "versions": [
+    {
+      "git-tree": "219274163ae6b1d5c5629cb77ded47d3e44632ad",
+      "version-date": "2022-10-08",
+      "port-version": 1
+    },
     {
       "git-tree": "ea1726ace2d45bcfda85af4b7ef80c579bbbccca",
       "version-date": "2022-10-08",

endif()

if(VCPKG_TARGET_IS_WINDOWS AND "opengl" IN_LIST FEATURES)
# Avoid collision with opengl32 lib from port opengl.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hmm consider comparing exported symbols for both. I think they should be identical.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can't look at the MSVC version.
But IIUC they even rely on mingw's import lib for linking their tests on mingw:
https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/gallium/targets/libgl-gdi/meson.build#L53-55
And the mingw and mesa symbols for lib opengl32 look very similar indeed.

@Neumann-A
Copy link
Copy Markdown
Contributor

#27279 has a libglvnd port if you need it.


Name: OpenGL
Description: OpenGL library and headers.
Name: gl
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

libGL != OpenGL . Historically libGL also contained GLX (GL on X) extensions on linux. https://gitlab.freedesktop.org/glvnd/libglvnd

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay.
It leaves some inconsistency because depending on this port provides opengl.pc and glu.pc for windows, but nothing similar is done for windows (not even printing a message to install some system package).
Are there any consumers for opengl.pc?

if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
vcpkg_get_windows_sdk(WINDOWS_SDK)

function(copy_from_windows_sdk WINDOWS_SDK)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Personally I think this port should install nothing. The WinSDK needs to be externally provided and be made part of the ABI hash

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Personally I think this port should install nothing.

I agree.

The WinSDK needs to be externally provided and be made part of the ABI hash

This either requires a general change to the tool, but a customization of the triplet such as an SDK version check would have the same effect. In that way, it is alreay possible now. So can't the copying to the vcpkg install tree be omitted already now?

The current copying doesn't make the SDK part of the ABI hash either. It probably solves a problem for consumers of pure exports, but not for users of any proper form of vcpkg integration which could switch from a cached artifact using one SDK version to a fresh rebuild using another SDK version as soon as any ABI hash input changes.

@Cheney-W Cheney-W added category:port-bug The issue is with a library, which is something the port should already support and removed category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist labels Dec 5, 2022
@dg0yt dg0yt closed this Dec 30, 2022
@dg0yt dg0yt deleted the osg branch July 1, 2023 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category:port-bug The issue is with a library, which is something the port should already support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants