Compiling cocos2d-iphone v2.x including arm64 - ios

An error occurs when compiling cocos2d-iphone v2.x and including arm64 architecture. The error is in the assembly code for kazmath. Is there a fix for this? (other than removing arm64)
libs/kazmath/src/neon_matrix_impl.c:
Unknown register name 'q0' in asm
Well, maybe no big deal... would be nice to support iPhone 5s etc fully with existing code.
I guess this is fixed or will be fixed in the cocos2d 3.x line. https://github.com/cocos2d/cocos2d-iphone/issues/534

Correct, cocos2d-iphone v3 does build successfully for the arm64 architecture, v2.x does not.
Even though the compiler warnings/errors are relatively easy to fix, there are a number of 64-bit compatibility issues that remain in v2.x (like CGFloat vs float mismatches and others) which means it's not recommended to enable arm64 builds for v2.x unless you're prepared to debug and fix these issues yourself. More so if you use 3rd party extensions which haven't been tested with arm64 either, for example anything in the cocos2d-iphone-extensions project.
Since currently no one is assigned to work on the v2.x branch and I don't expect v2.x to receive any future updates at all it's probably best to not include arm64 code (not much to gain anyway). Then start your next project with cocos2d-iphone v3.

I also had this problem in my one of old projects with Cocos2d.
I've downloaded Cocos2d v3, and copied the "kazmath" folder only to my older project, and replaced them.
If you don't want to change all the files, change :
#if defined(__ARM_NEON__)
into
#if defined(_ARM_ARCH_7)
By the way, I'm trying to update fully to the Cocos2d v3, and I think that is the right solution for this. even though my problem is handled, it is still problematic in general.

Cocos2D 2.2 now has 64 bit support!
You can download version 2.2 form here.

Upgrade your karmath library with cocos2D v3 kazmath lib (https://github.com/cocos2d/cocos2d-iphone/tree/develop-v3/external/kazmath).
It works for me (on iPad Air)

I solved in this way:
Downloading Cocos2D 2.2 here as suggested by #appzYourLife
Replaced folders cocos2d and CocosDenshion inside xcode project folder with folders of version 2.2
In folder kazmath/src edit mad4.c and neon_matrix_impl.c and replace line:
#if defined(__ARM_NEON__)
with
#if defined(_ARM_ARCH_7)

Related

Can I use old frameworks when migrating to Swift 3?

I'm currently migrating my project to Swift3 as I know that there is one bug I have under iOS 10 that needs to be fixed.
So I installed iOS 10 on one of my devices.
Now I can't run my app on the device, getting the 'Could not find developer disk image' error.
So I downloaded the latest Xcode8-beta.
Now my code can't be compiled - I first have to convert it to the newest syntax.
So while fixing all the non auto-converted syntax issues, I'm getting errors for frameworks I'm importing, too:
"Module file was created by an older version of the compiler"
Which - to my understanding - means that this framework needs to be recompiled with the current version of XCode.
This would mean that I would have to cross my fingers that all the frameworks I use are up-to-date, or otherwise, fix those, too?
Is it not possible at all to use 'deprecated' frameworks?
Is this Apple being super strict to get rid of any Swift1/2 code as possible?
This would mean that I would have to cross my fingers that all the frameworks I use are up-to-date, or otherwise, fix those, too?
Is it not possible at all to use 'deprecated' frameworks?
Is this Apple being super strict to get rid of any Swift1/2 code as possible?
Yup. Swift 3 is it.
I feel bad for those that had to convert their C code to swift 2, and now swift 3 is coming xD
Hopefully they will make the transition easier with the final release version, and that shortly after that all of the major frameworks will have been updated (for you to recompile).
You need to recompile the frameworks. Even frameworks managed with dependency managers like Carthage (which recompile on each update command) are still having problems with XCode 8 Betas / Swift 3: https://github.com/Carthage/Carthage/issues/1440

Problems importing Cocos 3.0 class into Cocos 2.X project

I've had heaps of trouble importing OALSimpleAudio into my Cocos 2.X project.
The app is quite big.
What is the best way for me to import Cocos 3.0 into an existing project?
The final error looks like this:
This is what I've done so far:
The Cocos 3.0 Libraries stuff is brought into libs folder.
ARC flags are set for Cocos 3.0 files as this is a non-ARC project and Cocos 3.0 uses ARC.
Relevant frameworks used in Cocos 3.0 template put in for project.
Architecture problem appears when using simulator, complains for architecture i386. When I use an actual device (iPad) as opposed to simulator it complains for architecture armv7 in the exact same way as picture 3 above.
Using the official release and install instructions here kstenerud.github.io/ObjectAL-for-iPhone was sufficient.
Not using the whole Cocos 3.0 reduced the complexity of transition. However it was also necessary to make sure that all instances of the old audio engine were deleted - before then even though it ran without errors the audio didn't work.

XCode 5.1 force 32 bit compilation for a Cocos2d-iphone v3 project

I am using SpriteBuilderwith Cocos2d-iphone v3.
Ever since updating to XCode 5.1 my application crashes when I use CCButton actions defined directly in SpriteBuilder. This seems to be the cause
This is most likely a cast or pointer conversion, going bad on 64 bit.
as pointed out by #birkemose at the Cocos2d forums
How can I force XCode 5.1 to compile my project in 32 bit even for my 64 bit devices?
Update: Fix by updating Cocos2d to RC4
xCode 5.1 build crashes - SpriteBuilder
In your project's build settings, change Architectures from "Standard architectures" to "armv7, armv7s" (without the quotes).
Or as matt pointed out, you can use $(ARCHS_STANDARD_32_BIT) instead, which is arguably the better way to go. Thanks matt!

What is difference between libxml2.dylib and libxml2.2.dylib in iOS

Currently I am using libxml2.dylib to parse XML now I want to shift to libxml2.2.dylib. Then, what kind of changes I would do in configuration and coding?
Xcode 4.5 (and the iOS6 SDK for that matters, because the libraries available are dependent of the SDK, not the Xcode version) still has libxml2.2.dylib.
You should generally not link your application with a specific version of libraries like that, but better with a generic version like libxml2.dylib or libxml2.2.dylib.
but for the better result in ios6 libxml2.2.dylib. is used.Sometimes you will get linking errors or some unusual errors with lower version
If you want to know the difference
then follow this link-
iOS6 does not have libxml2.2.7.3.dylib.are there any substitutes?
if you are getting linking errors then you should add /usr/include/libxml2 is in your Header Search Paths in your Debug/Release configuration

Flex ANE, iOS and ARC

Good day
I have created a static library with Xcode. Then I compiled my ANE using adobe's ADT tool. Thereafter I've included the ANE in my FlashBuilder project. However, when attempting to package my project, I get the following error:
"Error occurred while packaging the application:
Undefined Symbols: "_obj_storeStrong", referenced from ...
.
"_obj_release", referenced from ...
.
"
My guess is that ARC is probably not supported for ANE's. I'm guessing that this is probably due to the fact that FlashBuilder is recompiling the entire AIR + the native libs into one iOS application, probably using their own compiler or something (which is why Air apps for iOS can be compiled on windows platforms as well), and this compiler is probably not 4.3 ready yet?
I have attempted adding the flag -fobjc-arc to my ios-platformoptions.xml as well (where this file is the parameter to the -platformoptions flag of adt), but still no joy. It results once again in an error when packaging. Perhaps any other flag I can try to use here?
Any corrections, suggestions, alternative ideas or comments will be most welcome. I am very new to Xcode, Objective C and ANE, so please excuse any incorrect statements or assumptions, and please correct me on these.
I would be glad if somebody can please confirm weather I am correct with my assumption that I cannot use ARC at this stage on ANE's.
Thanks
Christo
START EDIT:
Very late update, sorry.
You might be able to use ARC after all. There is a library called arc lite that I forgot to mention and it works. I created an ANE for MapKit on iOS targeting the 5.0.x SDK. When I tried to move to a device that only had 4.3.x ( could have been 4.3.3 or 4.3.5 ) the app crashed or would not compile. I found information on the arc lite library that is included in the newer sdks, followed the instructions on how to include this library and pow! A working ANE on a 4.3.x device without rewriting my code!
Hope all of this helps and half of my original comment :)
Markus
END EDIT
I don't think ARC is supported just yet. There isn't much to go on in terms of settings or examples of what the settings should be in Xcode. Take a look at any of the Xcode ANE projects you can get your hands on. You will see that most or all of the projects have:
Object-C Automatice Reference counting = NO
Objective-C++ Automatic Reference counting = NO
Take a look at the following:
Vibration ANE - On Adobe Devnet site
Liquid Photo - http://www.liquid-photo.com/2011/10/30/common-native-extension-issues/
Liquid Photo - http://www.liquid-photo.com/2011/10/28/native-extension-for-adobe-air-and-ios-101/
There are a lot of examples in Github but you have to find them via Google. Pull down the Xcode ANE projects and compare the settings.
Hope this helps!!!
Markus

Resources