2016-12-07 13 views
2

と私はsysrootを使ってiOS用コンパイル渡ることができます。グラム++のXcode 8.0でのiOS SYSROOTとXcode 8.1

/Applications/Xcode.app/Contents/Developer/usr/bin/g++ \ 
    --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk \ 
    -miphoneos-version-min=10.0 -arch armv7s -stdlib=libc++ -std=gnu++11 \ 
    helloworld.cpp 

しかし、Xcodeの8.1でこれが倒れ:

/Applications/Xcode.app/Contents/Developer/usr/bin/g++ \ 
    --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.1.sdk \ 
    -miphoneos-version-min=10.1 -arch armv7s -stdlib=libc++ -std=gnu++11 \ 
    helloworld.cpp 
clang: warning: using sysroot for 'MacOSX' but targeting 'iPhone' 
In file included from helloworld.cpp:1: 
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iostream:38: 
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/ios:215: 
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:90: 
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/wchar.h:70: 
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/_types.h:27: 
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/sys/_types.h:32: 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/sys/cdefs.h:761:2: error: Unsupported architecture 
#error Unsupported architecture 

警告using sysroot for 'MacOSX' but targeting 'iPhone'は、sysroot引数が無視されていることを示しているようです(エラーでは、MacOSX10.12.sdkを使用していることがわかります)。

これらの引数を変更しましたか?どのようにしてsysrootを正しく指定できますか?

+0

私はAppleのデベロッパーフォーラムでこれをクロス投稿しました:https://forums.developer.apple.com/thread/69102 – paleozogt

答えて

1

アップルのgcc/g ++は単にclang/clang ++の上にありますので、clangを直接使うことはできますか?

それは働くことが判明:SYSROOTを変更するために逮捕されているように見える++

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ \ 
    --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.1.sdk \ 
    -miphoneos-version-min=10.1 -arch armv7s -stdlib=libc++ -std=gnu++11 \ 
    helloworld.cpp 

AppleのGCC/gです。しかし、gcc形式の--sysroot引数を使用できるようです。便利!私は接頭辞打ち鳴らすを使用しようと

不思議なことには、私が-isysrootを使用する必要があります。

clang++ \ 
    -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.1.sdk \ 
    -miphoneos-version-min=10.1 -arch armv7s -stdlib=libc++ -std=gnu++11 \ 
    helloworld.cpp 
0

使用-isysroot代わり--sysrootの新しいXcodeので、スペースの代わりに、等号を使用しています。

関連する問題