No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386)

今天在运行一个老ios项目的时候,突然报错:No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386)

网上搜了一下资料,有多种方法,但有些没有用,后来终于找到了一种方法,解决了这个问题,现把步骤记录一下:

1、在Project target里“Architectures”设置为“Standard (armv7,armv7s)” ;
2、修改在Project target里“Build Settings”的“Valid Architectures”添加“i386”和“armv7”(Xcode4.6 以上版本不再支持armv6,请去掉);
3、设置”Build Active Architecture Only”为“NO”。

这样你build你的项目的时候就能在iphoe5和iphoe4s里执行。

然后对于Architectures、armv7等是什么东东,不懂,再去查了写资料:

Architectures:这是指你想支持的指令集,比如:armv7,armv7s,或者可以用$(ARCHS_STANDARD_32_BIT)这样的参数

Valid Architectures:这是指你即将编译的指令集

Build Active Architecture Only:是否只编译当前设备适用的指令集(如果这个参数设为YES,那么如果你用iPhone 6调试,最终生成的一个支持arm64指令集的Binary;如果你用iPhone4编译,最终生成一个支持armv7指令集的Binary,所以一般在DEBUG模式下设为YES,RELEASE设为NO)

 

ARM是微处理器行业的一家知名企业,arm处理器以体积小和高性能的优势在嵌入式设备中广泛使用,几乎所有手机都是使用它的。

armv6, armv7, armv7s是ARM CPU的不同指令集,原则上是向下兼容的。如iPhone4S CPU支持armv7, 但它同时兼容armv6,只是使用armv6指令可能无法充分发挥它的特性。同理iPhone5 CPU支持armv7s,它虽然也兼容armv7,但是却无法进行相关的优化。

如果在工程Build Setting的Architectures 中的“Build Active Architecture Only”选择为YES,则即使你设置成armv7 , armv7s同时支持,也只会编译对应指令集的包;若选择NO,则编译器会整合两个指令集到一起,此时的包比较大,但是能在iPhone5上使用armv7s的优化,同时也能适配老的设备。一般都是Debug时“Build Active Architecture Only”选择YES,用当前的架构看代码逻辑是否有问题;而在Release时选择NO,来适配不同的设备。

模拟器并不运行arm代码,软件会被编译成x86可以运行的指令。所以生成静态库时都是会先生成两个.a,一个是i386的用于在模拟器运行,另一个是在真实设备上运行的,然后再用命令将两个.a合并成一个。

目前常见iOS设备的指令集:

ARMv8/ARM64: iPhone 6(Plus), iPhone 5s, iPad Air(2), Retina iPad Mini(2,3)
ARMv7s: iPhone 5, iPhone 5c, iPad 4 
ARMv7: iPhone 3GS, iPhone 4, iPhone 4S, iPod 3G/4G/5G, iPad, iPad 2, iPad 3, iPad Mini   
ARMv6: iPhone, iPhone 3G, iPod 1G/2G 

转载于:https://www.cnblogs.com/tandaxia/p/4443020.html

cat /usr/include/cudnn_version.h | grep CUDNN_MAJOR -A 2 #define CUDNN_MAJOR 8 #define CUDNN_MINOR 9 #define CUDNN_PATCHLEVEL 7 -- #define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL) /* cannot use constexpr here since this is a C-only file */ (base) whyerwang@whyerwang-Lenovo-ThinkBook-16p-Gen-5:~/cudnn_samples_v8/mnistCUDNN$ cp -r /usr/src/cudnn_samples_v8/ $HOME cd ~/cudnn_samples_v8/mnistCUDNN make clean && make ./mnistCUDNN # 显示"Test passed!"即成功[^2] rm -rf *o rm -rf mnistCUDNN CUDA_VERSION is 12090 Linking agains cublasLt = true CUDA VERSION: 12090 TARGET ARCH: x86_64 HOST_ARCH: x86_64 TARGET OS: linux SMS: 50 53 60 61 62 70 72 75 80 86 87 90 nvcc warning : Support for offline compilation for architectures prior to '<compute/sm/lto>_75' will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning). test.c:1:10: fatal error: FreeImage.h: 没有那个文件或目录 1 | #include "FreeImage.h" | ^~~~~~~~~~~~~ compilation terminated. >>> WARNING - FreeImage is not set up correctly. Please ensure FreeImage is set up correctly. <<< [@] /usr/local/cuda/bin/nvcc -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include -ccbin g++ -m64 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_72,code=sm_72 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_87,code=sm_87 -gencode arch=compute_90,code=sm_90 -gencode arch=compute_90,code=compute_90 -o fp16_dev.o -c fp16_dev.cu [@] g++ -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include -o fp16_emu.o -c fp16_emu.cpp [@] g++ -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include -o mnistCUDNN.o -c mnistCUDNN.cpp [@] /usr/local/cuda/bin/nvcc -ccbin g++ -m64 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_72,code=sm_72 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_87,code=sm_87 -gencode arch=compute_90,code=sm_90 -gencode arch=compute_90,code=compute_90 -o mnistCUDNN fp16_dev.o fp16_emu.o mnistCUDNN.o -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib64 -lcublasLt -LFreeImage/lib/linux/x86_64 -LFreeImage/lib/linux -lcudart -lcublas -lcudnn -lfreeimage -lstdc++ -lm bash: ./mnistCUDNN: 没有那个文件或目录
最新发布
05-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值