Build failed for Mac using latest XCode 12.3

Now we have 4 old projects and we are developing 1 project with the cocos2d-x CPP , so I am worried about we are abandoned :anguished: :anguished: :anguished:

1 Like

You mean a merge between cocos2d-x v4 and cocos2d-x-lite (the one used by Creator on native deployments)? Iā€™m 100% on board if thatā€™s the case!

True. Thatā€™s the plan.

1 Like

Is there a roadmap or a release date in sight?

1 Like

Not yet. Once Creator v3 is out we will have a better plan.

Hello @slackmoehrle ,
Creator v3 is now out. Do you have a roadmap you could share? Will it be a v3.18?
We have a few projects that depend fully on cocos so the information would be extremely welcome.
Best regards,

We donā€™t have any plans to release v3.18 at this time. Make sure you are using the latest from GitHub to stay up to date on fixes.

@smitpatel88 @slackmoehrle were you able to find a fix? I donā€™t have the option to downgrade.

Hi @bilalmirza
This is what i do for Mac

  1. Goto /Project/cocos2d/cocos/audio/mac/CDAudioManager.m Comment line no 408 & 409
//        AVAudioSession* session = [AVAudioSession sharedInstance];
//        session.delegate = self;
  1. Add this line below it at line no 410
[[AVAudioSession sharedInstance] setActive:YES error:nil];
  1. In same file CDAudioManager.m comment line no 328 & 329
 //    UInt32 varSize = sizeof(isPlaying);
//    AudioSessionGetProperty (kAudioSessionProperty_OtherAudioIsPlaying, &varSize, &isPlaying);
  1. Add this line below it at line no 330
isPlaying = [[AVAudioSession sharedInstance] isOtherAudioPlaying]; 
  1. In same file CDAudioManager.m goto line no 485 in isDeviceMuted
    replace below code
 -(BOOL) isDeviceMuted {

	#if TARGET_IPHONE_SIMULATOR
	    //Calling audio route stuff on the simulator causes problems
	    return NO;
	#else
	    return NO;
	#endif
	}
  1. Goto /Project/cocos2d/cocos/audio/mac/CDXMacOSXSupport.h
    Comment line no from 43 to 46
	 //enum AudioSessionProperties {
	//	kAudioSessionProperty_OtherAudioIsPlaying,
	//	kAudioSessionProperty_AudioRoute
	//};
  1. /Project/cocos2d/external/bullet/include/bullet/LinearMath/btVector3.h
    replace below line at 42
    Old line :
    #define BT_SHUFFLE(x,y,z,w) ((w)<<6 | (z)<<4 | (y)<<2 | (x))
    with new one:
    #define BT_SHUFFLE(x, y, z, w) (((w) << 6 | (z) << 4 | (y) << 2 | (x)) & 0xff)

  2. macOS Deployment target increase to 10.11
    For main project as well as for libcocos2dMac

  3. If required do clean project and run

I hope this help you.

5 Likes

@smitpatel88 Thanks, This works great! :smiley:

Thanks @smitpatel88, Iā€™m going to give this a try. I can now build and run the Mac version in xcode 11, but if this works, it would be great to run in xcode 12.4.

I have a dumb question. Iā€™ve been using the same project for several years, just updating the code, and I just noticed on the right side that I have ā€œProject Formatā€ set to ā€œXcode 3.2-compatibleā€ and I see there are much later options. Do you know anything about that option and whether it matters?

Iā€™d probably be smart to create a new project in January and pull my C++ code into it, but Iā€™m not even sure how to start that, to be honest.

Thanks again!

I did not get it. Can you post screenshot of it?
What i do generally for updating old project is generate 3.17.2 project, put old classes into it and fix some errors if encounter. And apply latest xcode changes to run properly.

Thatā€™s a great idea, Iā€™ll try that. Right now, though, Iā€™m able to get both iOS and Mac to launch using an older xcode, but the iOS simulator crashes when trying to play a sound through AudioEngine. Out of curiosity, I tried last yearā€™s version of the game in the simulator and it does the same, so something has changed with either OpenAL or Appleā€™s simulators.

Thanks for all the help and suggestions.

experimental::AudioEngine with MP3 sounds is working fine for me in XCode 12.4 with Cocos2dx 3.17.2 But I remember other formats is not working properly.

Hi, smitpatel88, I have the Mac building and running in Xcode 11, but I finally had time to try your Mac suggestions with xcode 12, and I think itā€™s now building as well! I was running into problems, but I think theyā€™re now resolved!

So now Iā€™ll move on to see if I can get iOS to run. I just want to thank you again for sharing this with us.

Ok, sadly, Iā€™m stuck again. @smitpatel88, Iā€™m trying to move to xcode 12, and Iā€™ve just gotten the Mac version to build using your great directions. However, in the same project, iOS is now not even building. Even the test project I built is now failing to build the iOS version in xcode 12.

Iā€™m getting hundreds of undefined symbols, such as cocos2d::Node::convertToWorldSpace() etc (SpriteFrameCache, etc)

And maybe I messed something up moving back and forth between xcode 11 and 12, because when I expand the Frameworks folder in xcode, I see several red items and some duplicates. For example, these are red: CoreText.framework (two are red, plus one black), two libiconv.dylib, and more.

I will suggest you to do changes first on helloworld project, after success follow same steps for your project.
Between iOS & Mac project, make sure target is selected properly when you are making changes.

@dogwalker Please check latest V3, V4 version from GitHub. Mac build is green. For V3 I applied and committed changes from this thread.

V4:

V3:

Does any one known how to compile iOS simulator version for latest V3/V4?

I apologize for posting in multiple threads, my bad. I do now have it working. Check my comments in https://discuss.cocos2d-x.org/t/cocos2dx-4-0-vs-3-17-2/53228/37