Xcode 4.2, ARC and the new compiler

1266 views
Skip to first unread message

SundialSoft

unread,
Nov 4, 2011, 11:18:10 AM11/4/11
to isgl3d
I downloaded isgl3d and I can build and run all the built-in samples
on xcode 4.2 as they stand out of the box.

Xcode 4.2 offers to update to recommended settings. If I take this
option the code then gives errors:-

In neon_matrix_impl.m there's a check on __thumb__ which causes one
error

#ifdef __thumb__
#error "This file should be compiled in ARM mode only."
// Note in Xcode, right click file, Get Info->Build, Other compiler
flags = "-marm"
#endif

And the other 2 errors state:- 'use of undeclared identifier _asm
void NEON_Matrix4Mul(const float* a, const float* b, float* output)
{
_asm volatile
(

void NEON_Matrix4Vector4Mul(const float* m, const float* v, float*
output)
{
_asm volatile
(

As I really only want to develop using the latest compiler & automatic
reference counting in my own code I need to know how to take this
forward. Also if the author/s of isgl3d read this I would like to know
your position re: future support for the new compiler. Having written
one app using 4.2 & ARC I find it very much easier to use & much
quicker to develop with.

ps: I currently have 2 apps on the app store & plan to convert my
windows mobile space trading game to OSX starting in the new year. The
next several weeks will determine which 3D setup I will use as I try
out what's available. I am a full time indi dev so my game will be
completed & published. I am happy with the concept of donating to
assist the progress of the project & would, once skilled in the tool,
be likely to produce some useful demos.

pps: Hello to everyone on here. isgl3d looks pretty smart & ticks all
the boxes for me so I hope it works out.

Ian
SundialSoft

SundialSoft

unread,
Nov 7, 2011, 4:36:06 AM11/7/11
to isgl3d
On investigation I found that this is to do with the Thumb
instructions in the Neon maths library. Cutting a long story short in
the source of the Neon maths there's a line // Note in Xcode, right
click file, Get Info->Build, Other compiler flags = "-marm"
As far as I can tell on Xcode 4.2 this is entered as follows: select
your project in the Project Navigator, select the relevant target,
then select the Build Phases tab. Expand the Compile Sources phase and
you can add a source file & a Compiler Flags column lets you set each
file’s flags for that target. However entering -MARM against the Neon
source file does not eliminate the errors.
The sample does build fine for the simulator, just won't build to the
device. Once the correct flag is figured out I still need to know what
happens on old devices, eg: iphone 3G

Ian
SundialSoft

SundialSoft

unread,
Nov 9, 2011, 3:44:34 AM11/9/11
to isgl3d
Seems to be an almost dead site. Not being able to progress with
isgl3d I have spent 2 days with Cocos3D. It's quite easy to install (a
couple of scripts need to be run) and the template it adds to XCode
creates a working hello world 3D app. The forum is well supported and
there seem to be plenty of demos to get started. Hopefully isgl3D will
get better support but for now I have no choice but to continue with
Cocos3D as it works & has lots of resources.

Holger Wiedemann

unread,
Nov 9, 2011, 5:58:58 PM11/9/11
to isg...@googlegroups.com
Hi Ian,

I'm pretty sure Stuart (the owner and main developer of iSGL3D) will
publish an official statement regarding the future of iSGL3D soon.

Regarding your problems:
the best and easiest solution for you would be to compile iSGL3D as a
static library or as a iOS framework. This way you may use new features
like ARC and the integration of iSGL3D into your project shouldn't be a
problem. Afaik thumb support needs to be disabled for iSGL3D otherwise
the math functions won't work properly on the devices. All math
functions are compatible with the iPhone 3G btw, the preprocessor
statements ensure that the correct features are being used. I.e. VFP for
older devices, NEON instructions for iPhone 3GS+newer and standard X86
instructions for the simulator.

I started to refactor the whole math implementation a while ago to make
it compatible with the new GLKit but unfortunately I never found the
time to complete the changes.

Even though you plan to use another framework I hope I was able help you
or other iSGL3D users and shed some light on this.

Cheers,
Holger


> Seems to be an almost dead site. Not being able to progress with
> isgl3d I have spent 2 days with Cocos3D. It's quite easy to install (a
> couple of scripts need to be run) and the template it adds to XCode
> creates a working hello world 3D app. The forum is well supported and
> there seem to be plenty of demos to get started. Hopefully isgl3D will
> get better support but for now I have no choice but to continue with

> Cocos3D as it works& has lots of resources.


>
> On Nov 7, 9:36 am, SundialSoft<i...@sundialsoft.co.uk> wrote:
>> On investigation I found that this is to do with the Thumb
>> instructions in the Neon maths library. Cutting a long story short in
>> the source of the Neon maths there's a line // Note in Xcode, right
>> click file, Get Info->Build, Other compiler flags = "-marm"
>> As far as I can tell on Xcode 4.2 this is entered as follows: select
>> your project in the Project Navigator, select the relevant target,
>> then select the Build Phases tab. Expand the Compile Sources phase and

>> you can add a source file& a Compiler Flags column lets you set each
>> file�s flags for that target. However entering -MARM against the Neon

>>> As I really only want to develop using the latest compiler& automatic


>>> reference counting in my own code I need to know how to take this
>>> forward. Also if the author/s of isgl3d read this I would like to know
>>> your position re: future support for the new compiler. Having written

>>> one app using 4.2& ARC I find it very much easier to use& much
>>> quicker to develop with.
>>> ps: I currently have 2 apps on the app store& plan to convert my


>>> windows mobile space trading game to OSX starting in the new year. The
>>> next several weeks will determine which 3D setup I will use as I try
>>> out what's available. I am a full time indi dev so my game will be

>>> completed& published. I am happy with the concept of donating to
>>> assist the progress of the project& would, once skilled in the tool,


>>> be likely to produce some useful demos.

>>> pps: Hello to everyone on here. isgl3d looks pretty smart& ticks all


>>> the boxes for me so I hope it works out.
>>> Ian
>>> SundialSoft


--
Holger Wiedemann
holger.w...@wirsind.info
Tel.: +49 721 9119988
Fax: +49 721 9119989
Mobil: +49 176 48866080

DoubleDanger

unread,
Nov 17, 2011, 10:17:49 PM11/17/11
to isgl3d
Having the same problem... In my case I open the project in a mac with
XCode 4.2, and then, when I return to a Mac with 4.0.2 and compiled to
a device, get this error.
GCC_THUMB_SUPPORT is seted in "NO" but still having same problem...
what I'm doing wrong?

Thanks!

On Nov 9, 7:58 pm, Holger Wiedemann <holger.wiedem...@wirsind.info>
wrote:
> >> file s flags for that target. However entering -MARM against the Neon
> holger.wiedem...@wirsind.info

magicrudi

unread,
Dec 5, 2011, 4:23:20 PM12/5/11
to isgl3d
I am also playing around with isgl3d and just got it running with
XCode4.2.
If you still have the problem with the _asm error change your
GCC_Version.
This framework is not the only one that has this problem.

@Stuart: Thanks for providing this framework!

Rudi

magicrudi

unread,
Dec 5, 2011, 4:24:53 PM12/5/11
to isgl3d
Change the GCC_Version from Apple LLVM Compile 3.0 to LLVM GCC 4.2.

Rudi

brojas

unread,
Dec 15, 2011, 5:19:10 AM12/15/11
to isgl3d
This worked for me, however I had to disable arc and thumb, works
great now, is there any way to use arc with isgl3d or is it not
possible with llvm gcc 4.2?

Holger Wiedemann

unread,
Dec 16, 2011, 11:47:45 AM12/16/11
to isg...@googlegroups.com
You may use ARC in your project but you explicitly have to disable it
for isgl3d. ARC is currently not supported by isgl3d due to the
necessary source code changes. However, direct ARC support is on the
TODO list for upcoming releases.

So it currently depends on how you integrate isgl3d in your project. If
you compile it inside your project then you have to disable ARC for all
isgl3d source files (ARC can be disabled per source file via compiler
options).
The easiest way would be if you put isgl3d into a separate static
library project and compile it without ARC. You then may use ARC / LLVM
in your project using the static library without any problem.

Cheers,
Holger

Donald Alan Morrison

unread,
Dec 30, 2011, 10:20:14 PM12/30/11
to isgl3d
On Dec 16, 8:47 am, Holger Wiedemann <holger.wiedem...@wirsind.info>
wrote:
> You may use ARC in your project but you explicitly have to disable it
> for isgl3d. ARC is currently not supported by isgl3d due to the
> necessary source code changes. However, direct ARC support is on the
> TODO list for upcoming releases.
>
> So it currently depends on how you integrate isgl3d in your project. If
> you compile it inside your project then you have to disable ARC for all
> isgl3d source files (ARC can be disabled per source file via compiler
> options).
> [...]

I know of two ways to compile with ARC:
1) Use the -fno-objc-arc option on each library file as described
here:

http://developer.apple.com/library/ios/#releasenotes/ObjectiveC/RN-TransitioningToARC/_index.html

(As described, also enable the Apple LLVM compiler, the ARC build
option, and change the main NSAutoreleasePool to an @autoreleasepool
block. If you've created autorelease pools elsewhere, convert them
too, of course. Also note, since lots of Apple code will still have
ARC disabled, in some places it's still correct to set nil an instance
variable to be dealloc'd; though in simple apps this probably won't be
an issue (because of scope teardown). You still have to match any C
malloc() with free() in a dealloc method as usual.)

2) Do everything above, except don't use the -fno-objc-arc option and
instead fork iSGL3D on github from the stable version and remove all
the retain/release/autorelease "messages" (the compiler will reinsert
them with ARC enabled). For property attributes, change retain to
strong, and assign to weak.

I haven't tried either, so don't get upset if it doesn't work. :-)
I'm going to attempt method 1 above. If it works, I'll post the
changes.

Donald Alan Morrison

unread,
Dec 31, 2011, 12:26:00 AM12/31/11
to isgl3d
Solution 1 seems to work fine for the template project, except the
Apple LLVM Compiler emits a few extra warnings (both when turned on,
and a few more after the modifications). I'm going to look at the
warnings, and see if they can be silenced or fixed.

Also, I haven't looked into how to get the template to auto-generate
the -fno-objc-arc option for the iSGL3D dot m files. Copy/Pasting it
in over 100 times is not preferable.

Here are the compiler warnings...

actions/Isgl3dActionParallel.m:
Incompatible pointer types assigning to 'NSMutableArray *' from
'NSArray *'

actions/Isgl3dActionSequence.m
Incompatible pointer types assigning to 'NSMutableArray *' from
'NSArray *'

core/Isgl3dDirector.m
Implicit conversion from enumeration type 'UIDeviceOrientation' to
different enumeration type 'UIInterfaceOrientation'
Implicit conversion from enumeration type 'UIDeviceOrientation' to
different enumeration type 'UIInterfaceOrientation'
Implicit conversion from enumeration type 'UIDeviceOrientation' to
different enumeration type 'UIInterfaceOrientation'

primitives/Isgl3dPlane.m
Assigning to 'Isgl3dUVMap *' from 'const Isgl3dUVMap *' discards
qualifiers
Assigning to 'Isgl3dUVMap *' from 'const Isgl3dUVMap *' discards
qualifiers

core/Isgl3dDirector.h
Type of property 'openGLView' does not match type of accessor
'setOpenGLView:'

cameras/Isgl3dFollowCamera.h
Type of property 'target' does not match type of accessor 'setTarget:'

cameras/Isgl3dSpringCamera.h
Type of property 'target' does not match type of accessor 'setTarget:'

On Dec 30, 7:20 pm, Donald Alan Morrison <donmorri...@gmail.com>
wrote:
> On Dec 16, 8:47 am, Holger Wiedemann <holger.wiedem...@wirsind.info>
> wrote:
>
> > You may use ARC in your project but you explicitly have to disable it
> > for isgl3d. ARC is currently not supported by isgl3d due to the
> > necessary source code changes. However, direct ARC support is on the
> > TODO list for upcoming releases.
>
> > So it currently depends on how you integrate isgl3d in your project. If
> > you compile it inside your project then you have to disable ARC for all
> > isgl3d source files (ARC can be disabled per source file via compiler
> > options).
> > [...]
>
> I know of two ways to compile with ARC:
> 1) Use the -fno-objc-arc option on each library file as described
> here:
>
> http://developer.apple.com/library/ios/#releasenotes/ObjectiveC/RN-Tr...

Donald Alan Morrison

unread,
Dec 31, 2011, 8:10:57 AM12/31/11
to isgl3d
I've fixed all but the last three warnings (the setTarget: and
setOpenGLView: ones). Maybe the compiler just needs to be silenced
for these...

Comments?


On Dec 30, 9:26 pm, Donald Alan Morrison <donmorri...@gmail.com>

Donald Alan Morrison

unread,
Jan 1, 2012, 12:15:17 AM1/1/12
to isgl3d

I've opened up a stackoverflow question for this:

http://stackoverflow.com/questions/8691921/can-a-custom-xcode-template-partially-and-selectively-enable-arc-automatic-refe

Until someone (or Apple) provides a solution I'll go with the manual
copy/paste solution.

I can at least try to fix/silence some of the compiler warnings. I've
posted a fix on github for the plain GCC warnings (still not sure yet
if the Apple LLVM warnings can be fixed or silenced).

Stuart: Do those diffs (pull request) I sent via github look ok?

Holger Wiedemann

unread,
Jan 1, 2012, 10:46:04 AM1/1/12
to isg...@googlegroups.com
Just silencing the compiler is generally spoken not a good idea unless
it's really a compiler bug.

But for this case I need to take a closer look at this and why the
compiler outputs this warning. For the time being you can ignore the
warning but it's sth that definitely should be fixed in the future.

Donald Alan Morrison

unread,
Jan 1, 2012, 10:19:55 PM1/1/12
to isgl3d


On Jan 1, 10:46 am, Holger Wiedemann <holger.wiedem...@wirsind.info>
wrote:
> Just silencing the compiler is generally spoken not a good idea unless
> it's really a compiler bug.

+1 (I Agree)

buyin brian

unread,
Jul 18, 2012, 4:14:16 PM7/18/12
to isg...@googlegroups.com
I was able to fix this by simple changing _asm to asm. 
Reply all
Reply to author
Forward
0 new messages