Open chenrui333 opened 2 months ago
I'm running into the same issue (undefined references to CGL APIs), although with another project. And I suspect it's a CMake / Homebrew issue on Mac, because the same CMake code worked correctly before.
What I discovered is that a Homebrew build with CMake 3.30.3 discovers the location of the OpenGL library as /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries/libGL.tbd
, while another build, outside of Homebrew, using CMake 3.26, finds it as /Applications/Xcode-13.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/OpenGL.framework
.
So far I don't know whether it's a regression in CMake, or whether this regression happens only when CMake is running from within Homebrew, or whether it's a combination of both. I'm not a Mac user, and I don't know Homebrew internals very well either, so I don't know what the above means. My last data point is from 2023, where the exact same CMake code worked well when building the exact same Homebrew package.
What I spotted was that Homebrew overrides the C++ compiler to something else than what gets found when running CMake directly, which might or might not be related (as CMake then may find OpenGL.framework
in a different location as a consequence). Another possibly related change is https://gitlab.kitware.com/cmake/cmake/-/commit/6b01a27f901b5eb392955fea322cde44a1b782a3, which went into CMake 3.30.3.
Just for the record, for the Bullet Homebrew package itself it was "fixed" by passing -DCMAKE_FIND_FRAMEWORK=FIRST
to CMake (https://github.com/Homebrew/homebrew-core/pull/189186), and the same was what resolved the problem in my case.
Nevertheless, I still think this is a problem specific to Homebrew, and the fix is thus specific to Homebrew as well.
👋 trying to build 3.25 release for macos sequoia, but ran into the following build failure.
full build log in here, https://github.com/Homebrew/homebrew-core/actions/runs/10798628921/job/29952539530