我在XCode中尝试为iOS 7.0构建OSG时遇到错误 . 我按照这些说明操作:

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

通过在CMakeLists.txt文件中将框架版本更改为7.0的附加步骤,因为使用默认值6.0导致XCode抱怨未知框架 . 我选择了IPHONE_SIMULATOR选项 .

当我使用CMake生成项目后尝试构建项目时,我在osgDB中抱怨stat64有三个错误,一个关于缺少 Headers 的错误(可能相关但我感觉还有其他事情发生):

/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版本为2.8-12,OSG 3.2.0,XCode 5.0.2 .

我试过的各种各样的事情:

  • iphone而不是iphone_simulator设置; iphone抱怨openthreads是一个动态库,即使我在cmake中取消选中DYNAMIC_OPENTHREADS . 但是,它确实会使其他错误消失 .

  • 多次吹掉构建目录并重新执行配置步骤

  • 配置后在xcode中手动设置ios的框架设置

我之前做过的OSX OSG版本没有问题,因为它的 Value .