Opened 5 years ago

Last modified 7 months ago

#58378 assigned defect

Qt5 CMake component fails under Xcode-10.2

Reported by: mouse07410 (Mouse) Owned by: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: majoc-at-astro (majoc-at-astro), Russell-Jones-OxPhys (Russell Jones), chrstphrchvz (Christopher Chavez), cooljeanius (Eric Gallager), nilason (Nicklas Larsson)
Port: qt5-qtbase

Description

MacOS Mojave 10.14.4, Xcode-10.2.1, current Macports and all the ports.

File /opt/local/libexec/qt5/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake lists paths to find gl.h file:

set(_GL_INCDIRS "/System/Library/Frameworks/OpenGL.framework/Headers" "/System/Library/Frameworks/AGL.framework/Headers")
find_path(_qt5gui_OPENGL_INCLUDE_DIR gl.h
    PATHS ${_GL_INCDIRS}
)
if (NOT _qt5gui_OPENGL_INCLUDE_DIR)
    message(FATAL_ERROR "Failed to find \"gl.h\" in \"${_GL_INCDIRS}\".")
endif()
unset(_GL_INCDIRS)

Under Xcode-10.2.1 this is not correct - the correct location is

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers

So, this line in question should be changed to:

set(_GL_INCDIRS "/System/Library/Frameworks/OpenGL.framework/Headers" "/System/Library/Frameworks/AGL.framework/Headers" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers")

Change History (13)

comment:1 Changed 5 years ago by jmroot (Joshua Root)

Cc: mcalhoun@… removed
Owner: set to MarcusCalhoun-Lopez
Status: newassigned

comment:2 Changed 5 years ago by majoc-at-astro (majoc-at-astro)

Cc: majoc-at-astro added

comment:3 Changed 5 years ago by Russell-Jones-OxPhys (Russell Jones)

Cc: Russell-Jones-OxPhys added

comment:4 Changed 5 years ago by Russell-Jones-OxPhys (Russell Jones)

Cc: Russell-Jones-OxPhys removed

comment:5 Changed 5 years ago by Russell-Jones-OxPhys (Russell Jones)

Cc: Russell-Jones-OxPhys added

comment:6 Changed 4 years ago by mouse07410 (Mouse)

This problem continues. Now on Catalina 10.15.3 with Xcode-11.3.1.

Here's the patch that fixes it for the current, and presumably the future versions of Xcode:

--- /opt/local/libexec/qt5/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake.orig	2020-02-11 21:30:23.000000000 -0500
+++ /opt/local/libexec/qt5/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake	2020-02-11 21:32:59.000000000 -0500
@@ -1,7 +1,7 @@
 
 
 
-set(_GL_INCDIRS "/System/Library/Frameworks/OpenGL.framework/Headers" "/System/Library/Frameworks/AGL.framework/Headers")
+set(_GL_INCDIRS "/System/Library/Frameworks/OpenGL.framework/Headers" "/System/Library/Frameworks/AGL.framework/Headers" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers")
 find_path(_qt5gui_OPENGL_INCLUDE_DIR gl.h
     PATHS ${_GL_INCDIRS}
 )

Could the port maintainers please apply it? I understand everybody is busy, but this seems to be a simple fix to evaluate in 10 months?

comment:7 Changed 4 years ago by chrstphrchvz (Christopher Chavez)

@mouse07410, in general, improvements to MacPorts will have much better luck of being handled quickly if they are submitted as pull requests on GitHub.

I don't think MacPorts can guarantee that the location of Xcode.app will be /Applications/Xcode.app, so I don't think paths to its contents can be hardcoded exactly as suggested. Maybe MacPorts has a variable for this purpose, and/or there is a path that will be guaranteed to exist regardless of where Xcode.app is (maybe something like /Library/Developer/CommandLineTools/SDKs/…).

comment:8 Changed 4 years ago by chrstphrchvz (Christopher Chavez)

Cc: chrstphrchvz added

comment:9 Changed 4 years ago by mouse07410 (Mouse)

Based on my experience of several years, the only guarantee about Xcode one can make is that it's located in /Applications/Xcode.app, and it's Command Line Tools counterpart (if installed or present - it may not be!) is in /Library/Developer/CommandLineTools.

comment:10 Changed 2 years ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added

comment:11 Changed 2 years ago by chrstphrchvz (Christopher Chavez)

Xcode being installed to /Applications/Xcode.app, although typical, is not universally the case. The user is free to place Xcode wherever and then select it with sudo xcode-select -s /path/to/Xcode.app. A common use case is to switch between multiple Xcode versions; GitHub Actions CI offers multiple Xcode versions located in /Applications, see e.g. https://github.com/actions/virtual-environments/blob/fcb51fb/images/macos/macos-10.15-Readme.md#xcode.

comment:12 Changed 7 months ago by nilason (Nicklas Larsson)

I just encountered this problem while trying to update orfeotoolbox, with macOS 12.6.6, Xcode 14.2 (and with qt5-qtbase @5.15.10_1 installed).

CMake Error at /opt/local/libexec/qt5/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:9 (message):
  Failed to find "gl.h" in
  "/System/Library/Frameworks/OpenGL.framework/Headers;/System/Library/Frameworks/AGL.framework/Headers".
Call Stack (most recent call first):
  /opt/local/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake:227 (include)
  Modules/ThirdParty/Qt/otb-module-init.cmake:23 (find_package)
  CMake/OTBModuleEnablement.cmake:273 (include)
  CMakeLists.txt:354 (include)

comment:13 Changed 7 months ago by nilason (Nicklas Larsson)

Cc: nilason added
Note: See TracTickets for help on using tickets.