Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling cocos2d-iphone v2.x including arm64

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

like image 940
Jonny Avatar asked Dec 03 '25 09:12

Jonny


2 Answers

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.

like image 194
LearnCocos2D Avatar answered Dec 05 '25 02:12

LearnCocos2D


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.

like image 28
EDUsta Avatar answered Dec 05 '25 02:12

EDUsta



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!