Building dependencies in XCode5

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.

Building dependencies in XCode5

Postby simedj » Tue Mar 04, 2014 12:30 am

Among other problems, after updating and firing off an iOS build with my shiny new XCode5 tool, zlib no longer builds. It gives me errors about stuff not being supported in C99. I thought it might be along similar lines to how the C++11 compilers were causing problems, but changing the "C language dialect" doesn't seem to help.

Implicit declaration of function 'read' is invalid in C99

So is there a fix?


Updated at bottom, please read...
Last edited by simedj on Thu Mar 06, 2014 1:59 pm, edited 3 times in total.
Looking to find experienced Ogre & shader developers/artists. PM me with a contact email address if interested.
simedj
Goblin
 
Posts: 260
Kudos: 3
Joined: 18 Nov 2011

Re: Cannot build dependencies in XCode5

Postby masterfalcon » Tue Mar 04, 2014 1:02 am

How did you configure the project with CMake? Also, which version of Xcode 5 is this?
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
 
Posts: 4265
Kudos: 129
Joined: 25 Feb 2007
Location: Bloomington, MN

Re: Cannot build dependencies in XCode5

Postby simedj » Tue Mar 04, 2014 1:54 am

I downloaded at the weekend, would have to check. But very recent.

Regarding cmake, I did a clean run with dependency repo inside source dir. Can you be more specific... Settings I can look up or files I can upload?
Looking to find experienced Ogre & shader developers/artists. PM me with a contact email address if interested.
simedj
Goblin
 
Posts: 260
Kudos: 3
Joined: 18 Nov 2011

Re: Cannot build dependencies in XCode5

Postby masterfalcon » Tue Mar 04, 2014 8:57 am

I build the dependencies with a script that I've put together but it could be done via the GUI as well.

Code: Select all
cmake -DOGRE_BUILD_PLATFORM_APPLE_IOS:BOOL=ON -G Xcode ..
# Build Debug for devices and simulator
xcodebuild -configuration Debug -target install -sdk iphonesimulator7.0
xcodebuild -configuration Debug -target install -sdk iphoneos7.0

# Build Release for devices and simulator
xcodebuild -configuration Release -target install -sdk iphonesimulator7.0
xcodebuild -configuration Release -target install -sdk iphoneos7.0


Then there are some additional steps to use lipo to make universal libs.
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
 
Posts: 4265
Kudos: 129
Joined: 25 Feb 2007
Location: Bloomington, MN

Re: Cannot build dependencies in XCode5

Postby simedj » Tue Mar 04, 2014 9:20 am

Yes, I've had it all working with XCode 4 - and in fact earlier in the day it built with XCode 5 without these problems. From the other thread it seemed like my working copy was a bit out of date but still, it built OK. The whole point for me of putting Dependencies in Ogre source dir is that Ogre CMake picks it all up automagically.

I suppose it's just possible the manual DOGRE_BUILD_PLATFORM_APPLE_IOS:BOOL flag could've got lost on my main CMake setup (I added it using the GUI tool)... since I cleaned out my build dir. But I tried to avoid this and I thought the flag was set. Another thing to check... can you confirm you're building your own dependencies in XCode5 without these issues?
Looking to find experienced Ogre & shader developers/artists. PM me with a contact email address if interested.
simedj
Goblin
 
Posts: 260
Kudos: 3
Joined: 18 Nov 2011

Re: Cannot build zlib dependency in XCode5

Postby simedj » Tue Mar 04, 2014 10:22 am

Update: This is just getting weird. I cleaned out my build-dir (again) and re-ran CMake (again); checking the APPLE_IOS flag is set. I get build/Ogre.xcodeproj which contains Ogre target as well as all the dependencies as separate targets. I also get build/Dependencies/OgreDeps.xcodeproj.

If I build target zlib in OgreDeps.xcodeproj, it succeeds with a few warnings:

/usr/local/ogre/ogre1.8/src/Dependencies/src/zlib/gzlib.c:250:24: Implicit declaration of function 'lseek' is invalid in C99
/usr/local/ogre/ogre1.8/src/Dependencies/src/zlib/gzlib.c:14:17: Implicit declaration of function 'lseek' is invalid in C99
/usr/local/ogre/ogre1.8/src/Dependencies/src/zlib/gzread.c
/usr/local/ogre/ogre1.8/src/Dependencies/src/zlib/gzread.c:30:15: Implicit declaration of function 'read' is invalid in C99
/usr/local/ogre/ogre1.8/src/Dependencies/src/zlib/gzread.c:586:11: Implicit declaration of function 'close' is invalid in C99
/usr/local/ogre/ogre1.8/src/Dependencies/src/zlib/gzwrite.c
/usr/local/ogre/ogre1.8/src/Dependencies/src/zlib/gzwrite.c:84:15: Implicit declaration of function 'write' is invalid in C99
/usr/local/ogre/ogre1.8/src/Dependencies/src/zlib/gzwrite.c:561:9: Implicit declaration of function 'close' is invalid in C99


If I build target zlib in Ogre.xcodeproj, it fails with the same issues as both errors AND warnings (color-coded):

/usr/local/ogre/ogre1.8/src/Dependencies/src/zlib/gzlib.c:250:24: Implicit declaration of function 'lseek' is invalid in C99
/usr/local/ogre/ogre1.8/src/Dependencies/src/zlib/gzlib.c:250:24: Implicit declaration of function 'lseek' is invalid in C99
/usr/local/ogre/ogre1.8/src/Dependencies/src/zlib/gzread.c:30:15: Implicit declaration of function 'read' is invalid in C99
/usr/local/ogre/ogre1.8/src/Dependencies/src/zlib/gzread.c:586:11: Implicit declaration of function 'close' is invalid in C99

/usr/local/ogre/ogre1.8/src/Dependencies/src/zlib/gzread.c:30:15: Implicit declaration of function 'read' is invalid in C99
/usr/local/ogre/ogre1.8/src/Dependencies/src/zlib/gzwrite.c:84:15: Implicit declaration of function 'write' is invalid in C99
/usr/local/ogre/ogre1.8/src/Dependencies/src/zlib/gzwrite.c:561:9: Implicit declaration of function 'close' is invalid in C99

/usr/local/ogre/ogre1.8/src/Dependencies/src/zlib/gzwrite.c:84:15: Implicit declaration of function 'write' is invalid in C99
Looking to find experienced Ogre & shader developers/artists. PM me with a contact email address if interested.
simedj
Goblin
 
Posts: 260
Kudos: 3
Joined: 18 Nov 2011

Re: Cannot build zlib dependency in XCode5

Postby simedj » Tue Mar 04, 2014 12:25 pm

I wanted to confirm this so I made sure XCode5 was set as default version, removed old 3.2.6 version, cleared the build-dir, and even updated CMake to newer version. Same result - the OgreDeps.xcodebuild version builds OK, the Ogre.xcodebuild version does not.

I wouldn't know where to start looking to see how the dependency projects get included as targets in the main Ogre project, but it seems some setting must be overriden/ignored - maybe if you're building dependencies separately that's why you haven't seen it?

I can see one setting is different - see screenshot - but I don't know these settings very well:

Screen Shot 2014-03-04 at 11.24.16.png
Screen Shot 2014-03-04 at 11.24.16.png (140.16 KiB) Viewed 1166 times
Looking to find experienced Ogre & shader developers/artists. PM me with a contact email address if interested.
simedj
Goblin
 
Posts: 260
Kudos: 3
Joined: 18 Nov 2011

Re: Cannot build zlib dependency in XCode5

Postby simedj » Tue Mar 04, 2014 1:05 pm

OK so hacking all targets to use $(ARCHS_STANDARD_32_64_BIT) fixed zlip and zziplib but others still fail...

Seems I also have to revert to C++ 98 and disable C++11 compiler/library features.

This is getting lots of stuff to build but still some problems.
Looking to find experienced Ogre & shader developers/artists. PM me with a contact email address if interested.
simedj
Goblin
 
Posts: 260
Kudos: 3
Joined: 18 Nov 2011

Re: Cannot build zlib dependency in XCode5

Postby masterfalcon » Tue Mar 04, 2014 5:14 pm

I don't know why you have two Xcode projects but something is definitely not set up right.

I would recommend cloning the repo to somewhere else, create a build dir, configure and build from scratch.
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
 
Posts: 4265
Kudos: 129
Joined: 25 Feb 2007
Location: Bloomington, MN

Re: Cannot build zlib dependency in XCode5

Postby simedj » Tue Mar 04, 2014 5:51 pm

Well OgreDeps is a whole separate repo with its own CMake so presumably that's where OgreDeps.xcodeproj comes from. I've been told putting OgreDeps working/checkout dir inside Ogre/src working dir is OK before and it's always worked OK until now :(

Since the OgreDeps project is building with less problems, which CMake setting do I use in Ogre to stop it adding dependency targets to the Ogre project?

After fixing the architecture flag and the C++11 stuff in the generated Ogre.xcodeproj (the work of moments once you know) I'm actually only getting one issue remaining, which is in OgreGLSLESProgramManagerCommon.cpp (line 90):

Code: Select all
#if !OGRE_NO_GLES2_GLSL_OPTIMISER
#if OGRE_NO_GLES3_SUPPORT == 0
        mGLSLOptimiserContext = glslopt_initialize(kGlslTargetOpenGLES30);
#else
        mGLSLOptimiserContext = glslopt_initialize(kGlslTargetOpenGLES20);
#endif
#endif


kGlslTargetOpenGLES20 isn't recognised as a symbol... I am deliberately building with Cg support and GLSL optimiser ON. I thought I was doing so previously (I was definitely using Cg), do you know what this is about? I could just build without the GLSL optimiser if it's a problem.

One side question - my simulator libs are now fat libs of i386 and x86_64, which broke my custom lipo scripts (it expected thin libs). I think it's fine to fix my scripts to create universal ARM/i386/x86_64 versions?
Looking to find experienced Ogre & shader developers/artists. PM me with a contact email address if interested.
simedj
Goblin
 
Posts: 260
Kudos: 3
Joined: 18 Nov 2011

Re: Cannot build zlib dependency in XCode5

Postby simedj » Tue Mar 04, 2014 11:21 pm

So... I now have Ogre building (I disabled GLSL optimiser). I got my project to build too. In iOS6 simulator it works.

In iOS7 sim it still crashes - but now in a different place. Before it crashed in rendersystem code; that does not happen now, it's in Cg shader processing. Which I think is a separate problem so I'll let this thread draw to a slightly confused close :?
Looking to find experienced Ogre & shader developers/artists. PM me with a contact email address if interested.
simedj
Goblin
 
Posts: 260
Kudos: 3
Joined: 18 Nov 2011

Re: [closed] Cannot build zlib dependency in XCode5

Postby simedj » Thu Mar 06, 2014 1:59 pm

Just a little update for my own memory when I break my build in 6 months and find this thread - or for anyone else.

I had two problems, and I think I now know what they were.

  • With ARCHS = ARCHS_STANDARD_INCLUDING_64_BIT, projects like zlip were failing. When I changed this to ARCHS_STANDARD_32_64_BIT, they built OK. I've discovered the former evaluates to "armv7 armv7s arm64" while the latter currently evaluates to "armv7 armv7s". So I think zlip won't build for arm64.
  • Other projects seemed to require to be build for C++98 not C++11. I've seen comments about this before; are Ogre and standard dependencies compatible with C++11 or should the CMake scripts explicitly set this for iOS?

Any input on this would be cool...
Looking to find experienced Ogre & shader developers/artists. PM me with a contact email address if interested.
simedj
Goblin
 
Posts: 260
Kudos: 3
Joined: 18 Nov 2011

Re: Building dependencies in XCode5

Postby masterfalcon » Thu Mar 06, 2014 4:57 pm

The solution is to not build zlib at all. It's not needed for iOS because zlib is already included in the SDK.
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
 
Posts: 4265
Kudos: 129
Joined: 25 Feb 2007
Location: Bloomington, MN


Return to Mobile Devices

Who is online

Users browsing this forum: No registered users and 1 guest