MNN icon indicating copy to clipboard operation
MNN copied to clipboard

求助!MNN编译错误

Open Schrobine opened this issue 1 year ago • 9 comments

平台(如果交叉编译请再附上交叉编译目标平台):

Platform(Include target platform as well if cross-compiling):

cmake version 3.16.3 libprotoc 3.17.3 gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0

执行 cmake -DMNN_BUILD_DEMO=ON -DMNN_BUILD_CONVERTER=true .. make -j4 后报错

请在这里粘贴cmake参数或使用的cmake脚本路径以及完整输出 -- The C compiler identification is GNU 9.4.0 -- The CXX compiler identification is GNU 9.4.0 -- The ASM compiler identification is GNU -- Found assembler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done

-- 3.19.0.0 -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE
-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS -- Performing Test protobuf_HAVE_BUILTIN_ATOMICS - Success -- Use Threadpool, forbid openmp -- >>>>>>>>>>>>> -- MNN BUILD INFO: -- System: Linux -- Processor: armv7l -- Version: 2.7.2 -- Metal: OFF -- OpenCL: OFF -- OpenGL: OFF -- Vulkan: OFF -- ARM82: OFF -- oneDNN: OFF -- TensorRT: OFF -- CoreML: OFF -- NNAPI: OFF -- CUDA: OFF -- OpenMP: OFF -- BF16: OFF -- ThreadPool: ON -- Hidden: TRUE -- Build Path: /home/orangepi/MNN/build -- CUDA PROFILE: OFF -- WIN_USE_ASM: -- Enabling AArch32 Assemblies -- Onnx: -- MNN Depends:MNNMNN_Express -- Configuring done -- Generating done -- Build files have been written to: /home/orangepi/MNN/build

编译日志:

In file included from /home/orangepi/MNN/source/backend/cpu/CPUBinary.cpp:18: /home/orangepi/MNN/source/math/Vec.hpp: In static member function ‘static void MNN::Math::Vec<int, 4>::transpose4(MNN::Math::Vec<int, 4>::VecType&, MNN::Math::Vec<int, 4>::VecType&, MNN::Math::Vec<int, 4>::VecType&, MNN::Math::Vec<int, 4>::VecType&)’: /home/orangepi/MNN/source/math/Vec.hpp:300:66: note: use ‘-flax-vector-conversions’ to permit conversions between vectors with differing element types or numbers of subparts 300 | vec0.value = vsetq_lane_s64(vgetq_lane_s64(m2m3.val[0], 0), vec0.value, 1); | ^ /home/orangepi/MNN/source/math/Vec.hpp:300:62: error: cannot convert ‘int32x4_t’ {aka ‘__vector(4) int’} to ‘int64x2_t’ {aka ‘__vector(2) long long int’} 300 | vec0.value = vsetq_lane_s64(vgetq_lane_s64(m2m3.val[0], 0), vec0.value, 1); | ~~~~~~~~~~^ | | | int32x4_t {aka __vector(4) int} In file included from /home/orangepi/MNN/source/math/Vec.hpp:16, from /home/orangepi/MNN/source/backend/cpu/CPUBinary.cpp:18: /usr/lib/gcc/arm-linux-gnueabihf/9/include/arm_neon.h:6307:27: note: initializing argument 1 of ‘int64_t vgetq_lane_s64(int64x2_t, int)’ 6307 | vgetq_lane_s64 (int64x2_t __a, const int __b) | ~~~~~~~~~~^~~ In file included from /home/orangepi/MNN/source/backend/cpu/CPUBinary.cpp:18: /home/orangepi/MNN/source/math/Vec.hpp:301:62: error: cannot convert ‘int32x4_t’ {aka ‘__vector(4) int’} to ‘int64x2_t’ {aka ‘__vector(2) long long int’} 301 | vec1.value = vsetq_lane_s64(vgetq_lane_s64(m2m3.val[1], 0), vec1.value, 1); | ~~~~~~~~~~^ | | | int32x4_t {aka __vector(4) int} In file included from /home/orangepi/MNN/source/math/Vec.hpp:16, from /home/orangepi/MNN/source/backend/cpu/CPUBinary.cpp:18: /usr/lib/gcc/arm-linux-gnueabihf/9/include/arm_neon.h:6307:27: note: initializing argument 1 of ‘int64_t vgetq_lane_s64(int64x2_t, int)’ 6307 | vgetq_lane_s64 (int64x2_t __a, const int __b) | ~~~~~~~~~~^~~ In file included from /home/orangepi/MNN/source/backend/cpu/CPUBinary.cpp:18: /home/orangepi/MNN/source/math/Vec.hpp:302:62: error: cannot convert ‘int32x4_t’ {aka ‘__vector(4) int’} to ‘int64x2_t’ {aka ‘__vector(2) long long int’} 302 | vec2.value = vsetq_lane_s64(vgetq_lane_s64(m0m1.val[0], 1), vec2.value, 0); | ~~~~~~~~~~^ | | | int32x4_t {aka __vector(4) int} In file included from /home/orangepi/MNN/source/math/Vec.hpp:16, from /home/orangepi/MNN/source/backend/cpu/CPUBinary.cpp:18: /usr/lib/gcc/arm-linux-gnueabihf/9/include/arm_neon.h:6307:27: note: initializing argument 1 of ‘int64_t vgetq_lane_s64(int64x2_t, int)’ 6307 | vgetq_lane_s64 (int64x2_t __a, const int __b) | ~~~~~~~~~~^~~ In file included from /home/orangepi/MNN/source/backend/cpu/CPUBinary.cpp:18: /home/orangepi/MNN/source/math/Vec.hpp:303:62: error: cannot convert ‘int32x4_t’ {aka ‘__vector(4) int’} to ‘int64x2_t’ {aka ‘__vector(2) long long int’} 303 | vec3.value = vsetq_lane_s64(vgetq_lane_s64(m0m1.val[1], 1), vec3.value, 0); | ~~~~~~~~~~^ | | | int32x4_t {aka __vector(4) int} In file included from /home/orangepi/MNN/source/math/Vec.hpp:16, from /home/orangepi/MNN/source/backend/cpu/CPUBinary.cpp:18: /usr/lib/gcc/arm-linux-gnueabihf/9/include/arm_neon.h:6307:27: note: initializing argument 1 of ‘int64_t vgetq_lane_s64(int64x2_t, int)’ 6307 | vgetq_lane_s64 (int64x2_t __a, const int __b) | ~~~~~~~~~~^~~ In file included from /home/orangepi/MNN/source/backend/cpu/CPUBinary.cpp:18: /home/orangepi/MNN/source/math/Vec.hpp: In member function ‘MNN::Math::Vec<float, 4>::VecType MNN::Math::Vec<float, 4>::operator<(const VecType&) const’: /home/orangepi/MNN/source/math/Vec.hpp:508:51: error: could not convert ‘{vbslq_s32(res, ((int32x4_t)((const MNN::Math::Vec<float, 4>)this)->MNN::Math::Vec<float, 4>::one), ((int32x4_t)((const MNN::Math::Vec<float, 4>)this)->MNN::Math::Vec<float, 4>::zero))}’ from ‘’ to ‘MNN::Math::Vec<float, 4>::VecType’ {aka ‘MNN::Math::Vec<float, 4>’} 508 | VecType dst = { vbslq_s32(res, one, zero) }; | ^ | | | /home/orangepi/MNN/source/math/Vec.hpp: In member function ‘MNN::Math::Vec<float, 4>::VecType MNN::Math::Vec<float, 4>::operator>(const VecType&) const’: /home/orangepi/MNN/source/math/Vec.hpp:513:51: error: could not convert ‘{vbslq_s32(res, ((int32x4_t)((const MNN::Math::Vec<float, 4>)this)->MNN::Math::Vec<float, 4>::one), ((int32x4_t)((const MNN::Math::Vec<float, 4>)this)->MNN::Math::Vec<float, 4>::zero))}’ from ‘’ to ‘MNN::Math::Vec<float, 4>::VecType’ {aka ‘MNN::Math::Vec<float, 4>’} 513 | VecType dst = { vbslq_s32(res, one, zero) }; | ^ | | | /home/orangepi/MNN/source/math/Vec.hpp: In member function ‘MNN::Math::Vec<float, 4>::VecType MNN::Math::Vec<float, 4>::operator<=(const VecType&) const’: /home/orangepi/MNN/source/math/Vec.hpp:518:51: error: could not convert ‘{vbslq_s32(res, ((int32x4_t)((const MNN::Math::Vec<float, 4>)this)->MNN::Math::Vec<float, 4>::one), ((int32x4_t)((const MNN::Math::Vec<float, 4>)this)->MNN::Math::Vec<float, 4>::zero))}’ from ‘’ to ‘MNN::Math::Vec<float, 4>::VecType’ {aka ‘MNN::Math::Vec<float, 4>’} 518 | VecType dst = { vbslq_s32(res, one, zero) }; | ^ | | | /home/orangepi/MNN/source/math/Vec.hpp: In member function ‘MNN::Math::Vec<float, 4>::VecType MNN::Math::Vec<float, 4>::operator>=(const VecType&) const’: /home/orangepi/MNN/source/math/Vec.hpp:523:51: error: could not convert ‘{vbslq_s32(res, ((int32x4_t)((const MNN::Math::Vec<float, 4>)this)->MNN::Math::Vec<float, 4>::one), ((int32x4_t)((const MNN::Math::Vec<float, 4>)this)->MNN::Math::Vec<float, 4>::zero))}’ from ‘’ to ‘MNN::Math::Vec<float, 4>::VecType’ {aka ‘MNN::Math::Vec<float, 4>’} 523 | VecType dst = { vbslq_s32(res, one, zero) }; | ^ | | | /home/orangepi/MNN/source/math/Vec.hpp: In member function ‘MNN::Math::Vec<float, 4>::VecType MNN::Math::Vec<float, 4>::operator==(const VecType&) const’: /home/orangepi/MNN/source/math/Vec.hpp:528:51: error: could not convert ‘{vbslq_s32(res, ((int32x4_t)((const MNN::Math::Vec<float, 4>)this)->MNN::Math::Vec<float, 4>::one), ((int32x4_t)((const MNN::Math::Vec<float, 4>)this)->MNN::Math::Vec<float, 4>::zero))}’ from ‘’ to ‘MNN::Math::Vec<float, 4>::VecType’ {aka ‘MNN::Math::Vec<float, 4>’} 528 | VecType dst = { vbslq_s32(res, one, zero) }; | ^ | | | make[2]: *** [CMakeFiles/MNNCPU.dir/build.make:89: CMakeFiles/MNNCPU.dir/source/backend/cpu/CPUBinary.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:535: CMakeFiles/MNNCPU.dir/all] Error 2 make: *** [Makefile:130: all] Error 2

粘贴在这里
Paste log here or pastebin

Schrobine avatar Oct 30 '23 02:10 Schrobine

我遇到同样的问题,请问如何解决,aarch64

wilway avatar Nov 02 '23 03:11 wilway

vec.hpp 506行开始修改为一下内容,编译通过 VecType operator<(const VecType& lr) const { uint32x4_t res = vcltq_f32(value, lr.value); VecType dst = {reinterpret_cast<float32x4_t>(vbslq_s32(res, one, zero)) }; return dst; } VecType operator>(const VecType& lr) const { uint32x4_t res = vcgtq_f32(value, lr.value); VecType dst = {reinterpret_cast<float32x4_t>(vbslq_s32(res, one, zero)) }; return dst; } VecType operator<=(const VecType& lr) const { uint32x4_t res = vcleq_f32(value, lr.value); VecType dst = {reinterpret_cast<float32x4_t>(vbslq_s32(res, one, zero)) }; return dst; } VecType operator>=(const VecType& lr) const { uint32x4_t res = vcgeq_f32(value, lr.value); VecType dst = {reinterpret_cast<float32x4_t>(vbslq_s32(res, one, zero)) }; return dst; } VecType operator==(const VecType& lr) const { uint32x4_t res = vceqq_f32(value, lr.value); VecType dst = {reinterpret_cast<float32x4_t>(vbslq_s32(res, one, zero)) }; return dst; }

wilway avatar Nov 02 '23 07:11 wilway

MNNGelu.S 48行修改为 fmov v30.4s, #5.0 fmov v31.4s, #-5.0

wilway avatar Nov 02 '23 07:11 wilway

MNNGelu.S 48行修改为 fmov v30.4s, #5.0 fmov v31.4s, #-5.0

image 把这个修改掉吗?

hfwanguanghui avatar Nov 03 '23 06:11 hfwanguanghui

我遇到同样的问题,请问如何解决,aarch64

Thank you for your reply. I tried the method you provided but did not solve the compilation failure issue. I am considering whether the CPU I am using is supported by MNN

Schrobine avatar Nov 06 '23 06:11 Schrobine

可能和你使用的MNN代码版本不同,我使用的git clone下来的master版本

 

该邮件从移动设备发送

 

------------------ 原始邮件 ------------------ 发件人: "Xiaolong @.>; 发送时间: 2023年11月6日(星期一) 下午2:43 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [alibaba/MNN] 求助!MNN编译错误 (Issue #2638)

我遇到同样的问题,请问如何解决,aarch64

Thank you for your reply. I tried the method you provided but did not solve the compilation failure issue. I am considering whether the CPU I am using is supported by MNN

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

wilway avatar Nov 06 '23 06:11 wilway

CMakeLists.txt 中加入这一条就行了 。add_compile_options(-flax-vector-conversions)

hfwanguanghui avatar Nov 06 '23 08:11 hfwanguanghui

CMakeLists.txt 中加入这一条就行了 。add_compile_options(-flax-vector-conversions)

请问这条是加在哪里呀?我尝试加入了这个,但是并没有起作用,是不是需要加入到全局变量里?

qtyandhasee avatar Nov 24 '23 12:11 qtyandhasee

在CMakeLists.txt文件末尾中添加以下内容: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flax-vector-conversions") 完美解决!

muyun777 avatar Dec 28 '23 14:12 muyun777

Marking as stale. No activity in 60 days.

github-actions[bot] avatar Feb 27 '24 09:02 github-actions[bot]