Building on macOS broken after upgrade to macOS 12 Monterey

Questions, problems and discussion about compiling FreeOrion.

Moderator: Oberlus

Post Reply
Message
Author
User avatar
Vezzra
Release Manager, Design
Posts: 6090
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Building on macOS broken after upgrade to macOS 12 Monterey

#1 Post by Vezzra »

I've updated my Mac from macOS 10.14 (Mojave) to macOS 12 (Monterey). Xcode also has been upgraded to Xcode 14.

That completely broke my dev environment. I was able to iron out a few issues, but now I'm stuck. The build process already fails during the cmake configuration phase. Apparently the GLEW library cannot be found anymore (although a version "2.2.0" actually has been found? - is that one not sufficient?):

Code: Select all

CMake Error at /Applications/CMake.app/Contents/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find GLEW (missing: GLEW_LIBRARIES) (found version "2.2.0")
Call Stack (most recent call first):
  /Applications/CMake.app/Contents/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /Applications/CMake.app/Contents/share/cmake-3.24/Modules/FindGLEW.cmake:215 (find_package_handle_standard_args)
  GG/CMakeLists.txt:69 (find_package)
Anyone any idea how I can fix that...?

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Building on macOS broken after upgrade to macOS 12 Monterey

#2 Post by o01eg »

Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

User avatar
Vezzra
Release Manager, Design
Posts: 6090
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Building on macOS broken after upgrade to macOS 12 Monterey

#3 Post by Vezzra »

Thanks for setting that up. I also looked at the results of your PR#4156. In both cases cmake found the GLEW libraries in the "dep" folder just fine. On my system, however, it does not. The GLEW libs are there, I checked (of course they are, why wouldn't they be, they are included in the SDK after all).

My impression is, that cmake actually does find the header files (hence the "(found version "2.2.0")" in my cmake logs), but fails to find the "libGLEW.a" (in "dep/lib/") on my system (hence the "(missing: GLEW_LIBRARIES)" in my cmake logs).

Unfortunately I do not have the faintest idea why, and consequently no idea how to fix this.

So I'd really appreciate any insight or any idea anyone might have.

o01eg, in case I'm not able to get building FO on my Mac working again anytime soon, is it possible to set up CI on Github so that the resulting FO DMG build artifact can be downloaded? Or even automatically deployed to SourceForge like the binary only archives for Windows for the weekly test builds?

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Building on macOS broken after upgrade to macOS 12 Monterey

#4 Post by o01eg »

Vezzra wrote: Wed Sep 28, 2022 8:22 am o01eg, in case I'm not able to get building FO on my Mac working again anytime soon, is it possible to set up CI on Github so that the resulting FO DMG build artifact can be downloaded? Or even automatically deployed to SourceForge like the binary only archives for Windows for the weekly test builds?
I think it should be possible. What command you use to produce DMG file?
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

User avatar
Vezzra
Release Manager, Design
Posts: 6090
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Building on macOS broken after upgrade to macOS 12 Monterey

#5 Post by Vezzra »

o01eg wrote: Wed Sep 28, 2022 8:24 amWhat command you use to produce DMG file?
No command required - the cmake scripts are set up so cmake takes care of creating the final DMG. After your recent changes even the file name of the DMG should already be correct (for the weekly test builds at least), so there is even no need to rename the DMG file.

User avatar
Vezzra
Release Manager, Design
Posts: 6090
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Building on macOS broken after upgrade to macOS 12 Monterey

#6 Post by Vezzra »

Ok, slight correction: The shell script used to build FO looks like this:

Code: Select all

cmake -G Xcode -Bbuild -Hsrc
xcodebuild -project build/FreeOrion.xcodeproj -target package -configuration Release
This is run in my FO dev folder, with the FO sources in the "src" subfolder. So it's actually xcodebuild which creates the final DMG, but cmake sets up the Xcode project used by the xcodebuild command. I don't know how the build process is invoked in the CI macOS VMs...

User avatar
Vezzra
Release Manager, Design
Posts: 6090
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Building on macOS broken after upgrade to macOS 12 Monterey

#7 Post by Vezzra »

Ok, in a stroke of luck I found out what the problem is: Apparently, on macOS 12 the option "-DGLEW_USE_STATIC_LIBS=ON" needs to be specified when doing cmake configure. This wasn't necessary on macOS 10.14, but apparently became necessary with one of the subsequent macOS versions. Meaning, cmake was looking for glew dylibs, which of course it couldn't find, since the SDK ships the static lib.

I found out when I took a look at the CI YAML configuration files to see if there were any differences on how cmake was invoked for the CI builds, as building FO with the CI worked.

I've now been able to successfully build and run FO on my Mac again.

Thanks, o01eg, for the help!

Post Reply