MacOS/X OpenGL linking errors (CMake, C++)

Hi,

while I can build my project locally on all three platforms (Win10, OSX 10.14 (and 10.15), and Ubuntu Linux), I struggle getting it tested via Github Actions on all three platforms. I can’t get around the following error wrt. MacOS/X platform.

[93%] Building CXX object src/contour/CMakeFiles/contour.dir/main.cpp.o

make[2]: *** No rule to make target <strong>/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework</strong>', needed by src/contour/contour.app/Contents/MacOS/contour’. Stop.

It seems it cannot find the folder OpenGL.framework. So I was trying to add some debug prints in the build job, where such a folder could be, but I wasn’t very successful in fixing this issue.

Does anyone have experience in building OpenGL-based apps via Github Actions?

The relevant CMake file entries look like this:

set(contour_LIBRARIES GLEW::GLEW OpenGL::GL glm glfw terminal_view ground yaml-cpp)
target_link_libraries(contour PRIVATE ${contour_LIBRARIES})

Many thanks in advance,
Christian.

I have the same issue, did you solve it or if there is someone else can help us

Hey, sadly I couldn’t fix that yet. I tried a lot with some debug shell statements in order to find out what I *could* do, but failed, that’s how I ended up here, to see if somebody could chime in and help me out. I’ll try again, but if you find something (or someone else), please share.

See you,

Christian.

I moved my xcode-beta.app to my /Applications forder then I did a ls command in it, the  MacOSX10.14.sdk was not there so I “copied” it manually from my xcode.app and checked if the OpenGL.platform was there, it is but I have a new error now :

ld: can't map file, errno=22 file '/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework' for architecture x86_64
clang: error: linker command failed with exit code 1

Fixed for me, I just did rm -r * on my build folder to clean all the cmake caches and I did a brew upgrade 

brew update && brew upgrade

then I make again my project and the error was gone :slight_smile: hope that can help you

Hey @rawiamhiri 

that would be awesome if that’s fixing it. Can you share me your project link, so I can inspect your Github Actions file?

sorry I can not share my project link for condidentiality reasons, but I can explain what I did to solve the problem more in details.
For me the problem was not with my cmake or my project it was with the xcode-beta version because it seems like some sdk was missing I just “copied” that sdk from my xcode to my xcode-beta
Here, w hat I did, you can try to do same:

  1. check if your xcode-beta.app is in your application folder, command line: 

    cd /Applications/
    ls

if your xcode-beta.app is there go to next step if not find it in your computer, maybe in Downloads, and copy paste it in your Applications folder

  1. Now your xcode-beta.app is in your “Applications” you should have the folder  OpenGL.framework in this path " /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework"
    check that using this command lines:

    cd /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/
    ls

if you can not “cd” the folder Frameworks, you should get it from your xcode.app (I suppose you have xcode.app already installed, if not you should install xcode from the appstore ) 
3. You should copy the " MacOSX10.14.sdk" :
i) open your xcode.app (click right and open the package) the go to the SDKs container “Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs” and copy the directory " MacOSX10.14.sdk" 

image.png

ii) open your xcode-beta.app (click right and open the package) the go to the SDKs container “Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs” and paste

Voilà :slight_smile:

At the end to be sure that every thing is ok, just upgrade your brew and clean your build directory

brew update && brew upgrade
cd yourBuildDirectory
rm -r *

then cmake your project again, it should fix the problem