交叉编译ncnn

本文详细讲述了在配置NCNN时遇到的编译问题,涉及如何在CMakeLists.txt中调整NCNN_SSE2和NCNN_AVX2选项以解决因不支持的指令集导致的错误,包括-msse2、-mfma等。通过将ON状态改为OFF,解决了编译过程中的错误并给出了解决步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、配置参数,点击configure

2、 点击generate

3、在终端输入make

出现的错误:1

Scanning dependencies of target ncnn
[ 29%] Building CXX object src/CMakeFiles/ncnn.dir/allocator.cpp.obj
arm-linux-gnueabihf-g++: error: unrecognized command line option ‘-msse2’
arm-linux-gnueabihf-g++: error: unrecognized command line option ‘-msse’; did you mean ‘-fdse’?
src/CMakeFiles/ncnn.dir/build.make:334: recipe for target 'src/CMakeFiles/ncnn.dir/allocator.cpp.obj' failed
make[2]: *** [src/CMakeFiles/ncnn.dir/allocator.cpp.obj] Error 1
CMakeFiles/Makefile2:86: recipe for target 'src/CMakeFiles/ncnn.dir/all' failed
make[1]: *** [src/CMakeFiles/ncnn.dir/all] Error 2
Makefile:129: recipe for target 'all' failed

解决办法:

在CMakeLists.txt中

option(NCNN_SSE2 "optimize x86 platform with sse2" ON)

替换为

option(NCNN_SSE2 "optimize x86 platform with sse2" OFF)

出现的错误:2

[ 12%] Building CXX object src/CMakeFiles/ncnn.dir/layer/x86/batchnorm_x86_avx2.cpp.obj
arm-linux-gnueabihf-g++: error: unrecognized command line option ‘-mfma’
arm-linux-gnueabihf-g++: error: unrecognized command line option ‘-mf16c’
arm-linux-gnueabihf-g++: error: unrecognized command line option ‘-mavx2’
src/CMakeFiles/ncnn.dir/build.make:982: recipe for target 'src/CMakeFiles/ncnn.dir/layer/x86/batchnorm_x86_avx2.cpp.obj' failed
make[2]: *** [src/CMakeFiles/ncnn.dir/layer/x86/batchnorm_x86_avx2.cpp.obj] Error 1
CMakeFiles/Makefile2:86: recipe for target 'src/CMakeFiles/ncnn.dir/all' failed
make[1]: *** [src/CMakeFiles/ncnn.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

解决办法:

在CMakeLists.txt中

option(NCNN_AVX2 "optimize x86 platform with avx2" ON)

替换为

option(NCNN_AVX2 "optimize x86 platform with avx2" OFF)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值