iOS 在错误的平台上使用 Scons 链接器搜索构建静态库
iOS static library build with Scons linker search on wrong paltform
我正在尝试构建 jsoncpp(C++ 代码)作为 iPhone 模拟器和设备的静态库。模拟器编译成功但设备编译失败。
我认为原因是在 MacOSX10.11.sdk 中搜索包含的链接器而不是 iPhoneOS9.1.sdk。
我不清楚为什么链接器不在 iPhoneOS9 中搜索。1.sdk 以及为什么在模拟器编译中不存在这个问题。
我在下一个配置中使用 scons:
env = Environment(CXX = 'clang++', TARGET_OS = 'ios', toolpath = ['scons-tools'], tools=[] )
if platform == "ios_phone":
env['CXXFLAGS'] = '-std=c++11 -stdlib=libc++ -arch armv7 --sysroot %s' %(IOSROOT)
env['LINKFLAGS'] = '-stdlib=libc++ -arch armv7 -isysroot %s' %(IOSROOT)
env['TARGET_ARCH'] = 'armv7'
print env.Dump()
#IOS SIMULATOR COMPILATION
if platform == "ios_simulator":
env['CXXFLAGS'] = '-std=c++11 -stdlib=libc++ -arch i386 -arch x86_64 --sysroot %s' %(IOS_SIMULATOR_ROOT)
env['LINKFLAGS'] = '-stdlib=libc++ -arch i386 -arch x86_64 -isysroot %s' %(IOS_SIMULATOR_ROOT)
env['TARGET_ARCH'] = 'i386, x86_64'
print env.Dump()
并得到下一个错误:
scons: Building targets ... clang++ -o
buildscons/ios_phone/src/lib_json/json_reader.o -c -std=c++11
-stdlib=libc++ -arch armv7 --sysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk
-Iinclude src/lib_json/json_reader.cpp In file included from src/lib_json/json_reader.cpp:7: In file included from
include/json/reader.h:11: In file included from
include/json/value.h:12: In file included from
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:434:
In file included from
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:23:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/unistd.h:71:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/_types.h:27:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/_types.h:32:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/cdefs.h:707:2:
error: Unsupported architecture
error Unsupported architecture
我没有在环境参数中找到 MacOSX。
你知道如何强制链接器使用正确的平台吗?或者根本原因是什么?
问题是 Xcode 我必须手动更新的命令行通行费。更新的原因是我所做的新 Xcode (7) 更新。更新编译后完美运行
我正在尝试构建 jsoncpp(C++ 代码)作为 iPhone 模拟器和设备的静态库。模拟器编译成功但设备编译失败。 我认为原因是在 MacOSX10.11.sdk 中搜索包含的链接器而不是 iPhoneOS9.1.sdk。 我不清楚为什么链接器不在 iPhoneOS9 中搜索。1.sdk 以及为什么在模拟器编译中不存在这个问题。
我在下一个配置中使用 scons:
env = Environment(CXX = 'clang++', TARGET_OS = 'ios', toolpath = ['scons-tools'], tools=[] )
if platform == "ios_phone":
env['CXXFLAGS'] = '-std=c++11 -stdlib=libc++ -arch armv7 --sysroot %s' %(IOSROOT)
env['LINKFLAGS'] = '-stdlib=libc++ -arch armv7 -isysroot %s' %(IOSROOT)
env['TARGET_ARCH'] = 'armv7'
print env.Dump()
#IOS SIMULATOR COMPILATION
if platform == "ios_simulator":
env['CXXFLAGS'] = '-std=c++11 -stdlib=libc++ -arch i386 -arch x86_64 --sysroot %s' %(IOS_SIMULATOR_ROOT)
env['LINKFLAGS'] = '-stdlib=libc++ -arch i386 -arch x86_64 -isysroot %s' %(IOS_SIMULATOR_ROOT)
env['TARGET_ARCH'] = 'i386, x86_64'
print env.Dump()
并得到下一个错误:
scons: Building targets ... clang++ -o buildscons/ios_phone/src/lib_json/json_reader.o -c -std=c++11 -stdlib=libc++ -arch armv7 --sysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk -Iinclude src/lib_json/json_reader.cpp In file included from src/lib_json/json_reader.cpp:7: In file included from include/json/reader.h:11: In file included from include/json/value.h:12: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:434: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:23: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/unistd.h:71: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/_types.h:27: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/_types.h:32: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/cdefs.h:707:2: error: Unsupported architecture
error Unsupported architecture
我没有在环境参数中找到 MacOSX。
你知道如何强制链接器使用正确的平台吗?或者根本原因是什么?
问题是 Xcode 我必须手动更新的命令行通行费。更新的原因是我所做的新 Xcode (7) 更新。更新编译后完美运行