2

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

Jonny
  • 15,955
  • 18
  • 111
  • 232

5 Answers5

7

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.

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
  • 1
    Now with Apple requiring 64 bit updates for existing apps as well from February 1, 2015, I have a bunch of old v2 apps that I will either have to stop supporting (delete from app store maybe) or somehow fix 64 bit support within the v2 line. Updating all to v3 would just take too much time resources I'm afraid. Official 64 bit support for v2 line would be sweet. – Jonny Oct 23 '14 at 06:30
  • Sweet but unless someone volunteers ... I wouldn't wait for it. – CodeSmile Oct 23 '14 at 08:58
3

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.

EDUsta
  • 1,932
  • 2
  • 21
  • 30
2

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)

David DUTOUR
  • 151
  • 1
  • 3
  • 7
2

Cocos2D 2.2 now has 64 bit support!

You can download version 2.2 form here.

Luca Angeletti
  • 58,465
  • 13
  • 121
  • 148
  • Correct - I did help try it out on one of my games and it seems to work. Although I haven't had time to try it out much since, I guess it works pretty well? – Jonny Dec 24 '14 at 08:26
  • I haven't tried yet but I am going to port my game from Cocos2D 2.0 to 2.2 ASAP. I will provide more details once the porting is done! – Luca Angeletti Dec 24 '14 at 13:47
  • That announcement link is incorrect. I am about to convert another old Cocos2D v2 project and finding that thread would be useful. – Jonny Oct 02 '15 at 07:35
  • @Jonny: Thank you, the URL has changed since I posted my answer. I just updated the link in my answer. – Luca Angeletti Oct 02 '15 at 08:46
0

I solved in this way:

  1. Downloading Cocos2D 2.2 here as suggested by @appzYourLife
  2. Replaced folders cocos2d and CocosDenshion inside xcode project folder with folders of version 2.2
  3. 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)
P.O.W.
  • 1,895
  • 1
  • 16
  • 14