Cocos2d-x 2.x on Mac OSX El Capitan

Hi All. I’ve just upgraded one of my macs to El Capitan to see if my game still works…it doesn’t. It crashed immediately after starting. Running it in the debugger (of XCode 6 not 7 yet) I see it crashes at:

void CCConfiguration::gatherGPUInfo()
{
	m_pValueDict->setObject( CCString::create( (const char*)glGetString(GL_VENDOR)), "gl.vendor");   <=
....
}

Application Specific Information:
terminating with uncaught exception of type std::logic_error: basic_string::_S_construct NULL not valid
abort() called

Commenting the lines results in a assert error : CCAssert(m_uProgram != 0, “Cannot link invalid program”);

Is there anything I can do to fix this problem? Will this problem also occur with Cocos2d-x 3.7 ?

Any help or tips would be welcome!

so, I upgraded to the latest El Capitan but I haven’t yet tried to compile a clean cocos2d-x. Let me see if I can get to this today and post results.

A clean Cocos2d-x 3.7 I just tried with Xcode 6 on El Capitan…it works… Now to find out why version 2.x fails (converting the project would take too much time).

Have you found a solution for this? I’m in the same boat.

If anyone is still stuck on this, I just fixed it in my game by calling this line: [glView lockOpenGLContext]; prior to calling cocos2d::CCApplication::sharedApplication()->run();

If anyone has any comment on this solution - let me know.

2 Likes

I’m in same boat. All of my games on the Mac App Store now crash and were based on v2.x of cocos. It will be a real pain to update all our games. Do we know what the real issue is?

Sounds like an issue. I’ll upgrade one of my macs to El Capitan and see what I can find. I also have all my games in v2 and won’t be upgrading so a solution must be found =)

That fixed it for me. Thank you. Any idea why this fix works?

I’m in the same boat.

I fixed in another way: calling [glView prepareOpenGL]; prior to calling cocos2d::CCApplication::sharedApplication()->run();
I guessed that the requirements are making context for OpenGL. Actually both lockOpenGLContext and prepareOpenGL called makeCurrentContext.

Thanks for sharing your sollution.