gpt4 book ai didi

c++ - 在错误的平台上使用 Scons 链接器搜索构建 iOS 静态库

转载 作者:太空宇宙 更新时间:2023-11-04 13:24:18 25 4
gpt4 key购买 nike

我正在尝试将 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++ -obuildscons/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 frominclude/json/reader.h:11: In file included frominclude/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) 更新。更新编译后完美运行。

关于c++ - 在错误的平台上使用 Scons 链接器搜索构建 iOS 静态库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33874167/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com