0

I'm getting errors in XCode attempting to build OSG for iOS 7.0. I've followed these instructions:

http://www.openscenegraph.org/index.php/documentation/platform-specifics/ios/23-configuring-cmake-for-ios

with the additional step of changing the framework version to 7.0 in the CMakeLists.txt file, as using the default of 6.0 caused XCode to complain about an unknown framework. I chose the IPHONE_SIMULATOR option.

When I attempt to build the project after generating it with CMake, I get three errors in osgDB complaining about stat64, and one about a missing header (perhaps related but I get the feeling something else is going on):

/Users/clay2/src/OpenSceneGraph-3.2.0/src/osgDB/FileUtils.cpp:153:9: error: call to unavailable function 'stat64': not available on iOS
    if( stat64( path.c_str(), &stbuf ) == 0 )
        ^~~~~~
In file included from /Users/clay2/src/OpenSceneGraph-3.2.0/src/osgDB/FileUtils.cpp:87:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/sys/stat.h:380:5: note: candidate function has been explicitly made unavailable
int     stat64(const char *, struct stat64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5,__MAC_10_6,__IPHONE_NA,__IPHONE_NA);
        ^
/Users/clay2/src/OpenSceneGraph-3.2.0/src/osgDB/FileUtils.cpp:176:13: error: call to unavailable function 'stat64': not available on iOS
        if( stat64( dir.c_str(), &stbuf ) < 0 )
            ^~~~~~
In file included from /Users/clay2/src/OpenSceneGraph-3.2.0/src/osgDB/FileUtils.cpp:87:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/sys/stat.h:380:5: note: candidate function has been explicitly made unavailable
int     stat64(const char *, struct stat64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5,__MAC_10_6,__IPHONE_NA,__IPHONE_NA);
        ^
/Users/clay2/src/OpenSceneGraph-3.2.0/src/osgDB/FileUtils.cpp:301:10: error: call to unavailable function 'stat64': not available on iOS
    if ( stat64(filename.c_str(), &fileStat) != 0 )
         ^~~~~~
In file included from /Users/clay2/src/OpenSceneGraph-3.2.0/src/osgDB/FileUtils.cpp:87:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/sys/stat.h:380:5: note: candidate function has been explicitly made unavailable
int     stat64(const char *, struct stat64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5,__MAC_10_6,__IPHONE_NA,__IPHONE_NA);
        ^
/Users/clay2/src/OpenSceneGraph-3.2.0/src/osgDB/FileUtils.cpp:881:18: fatal error: 'CoreServices/CoreServices.h' file not found
        #include <CoreServices/CoreServices.h>
                 ^
4 errors generated.

CMake version is 2.8-12, OSG 3.2.0, XCode 5.0.2.

Various things I've tried:

  • iphone instead of iphone_simulator setting; iphone complains about openthreads being a dynamic library, even though I unchecked DYNAMIC_OPENTHREADS in cmake. It does, however, appear to make the other errors go away.
  • Blowing away the build directory and re-doing the config step, several times
  • Manually setting the framework settings for ios in xcode after configuration

I did previously get an OSX build of OSG to work without issue, for what it's worth.

flatline
  • 42,083
  • 4
  • 31
  • 38
  • I got exactly the same problem. I tried with the iOS sdk 7.0 and 6.1, OSG 3.3.0 and XCode 5. I tried the OpenSceneGraph tutorial and [this tutorial that works for Android](http://www.digitalknob.com/forum/index.php?action=profile;u=1;area=showposts). I think it could be a problem with a macro defined somewhere because CoreServices is defined for Carbon version and not on Cocoa. Did you finally find a solution? – Alex Fernandez Jan 07 '14 at 08:56
  • @AlexFernandez no fix yet, unfortunately, I haven't spent much time on it since this post. Thanks for the info, good to know that it didn't work with the 6.1 sdk either. – flatline Jan 08 '14 at 22:30

0 Answers0