Tencent / ncnn

ncnn is a high-performance neural network inference framework optimized for the mobile platform
Other
20.34k stars 4.16k forks source link

building error on mac arm series #5235

Open alirezarabiei7239 opened 10 months ago

alirezarabiei7239 commented 10 months ago

I have got this error when building with this command

mkdir -p build cd build

cmake -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \ -DVulkan_INCLUDE_DIR=pwd/../vulkansdk-macos-1.2.189.0/MoltenVK/include \ -DVulkan_LIBRARY=pwd/../vulkansdk-macos-1.2.189.0/MoltenVK/dylib/macOS/libMoltenVK.dylib \ -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=ON ..

cmake --build . -j 4 cmake --build . --target install

ERROR :

[ 90%] Linking CXX executable squeezenet ld: warning: ignoring file '/usr/local/Cellar/opencv/4.8.1_5/lib/libopencv_highgui.4.8.1.dylib': found architecture 'x86_64', required architecture 'arm64' ld: warning: ignoring file '/usr/local/Cellar/opencv/4.8.1_5/lib/libopencv_videoio.4.8.1.dylib': found architecture 'x86_64', required architecture 'arm64' ld: warning: ignoring file '/usr/local/Cellar/opencv/4.8.1_5/lib/libopencv_imgcodecs.4.8.1.dylib': found architecture 'x86_64', required architecture 'arm64' ld: warning: ignoring file '/usr/local/Cellar/opencv/4.8.1_5/lib/libopencv_imgproc.4.8.1.dylib': found architecture 'x86_64', required architecture 'arm64' ld: warning: ignoring file '/usr/local/Cellar/opencv/4.8.1_5/lib/libopencv_core.4.8.1.dylib': found architecture 'x86_64', required architecture 'arm64' ld: Undefined symbols: cv::Mat::~Mat(), referenced from: _main in squeezenet.cpp.o _main in squeezenet.cpp.o cv::imread(std::1::basic_string<char, std::__1::char_traits, std::1::allocator> const&, int), referenced from: _main in squeezenet.cpp.o cv::Mat::empty() const, referenced from: _main in squeezenet.cpp.o clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: [examples/squeezenet] Error 1 make[1]: [examples/CMakeFiles/squeezenet.dir/all] Error 2 make: *** [all] Error 2

mac M2 os Sonama

alirezarabiei7239 commented 10 months ago

I commente the line example in cmakelist file and the problem solved but another error occured

clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: [tools/caffe/caffe2ncnn] Error 1 make[1]: [tools/caffe/CMakeFiles/caffe2ncnn.dir/all] Error 2 make: *** [all] Error 2

any help will be appreciated

nihui commented 10 months ago

It looks like there is a problem with your opencv installation It is recommended to reinstall opencv For example brew install

pedrozarin2024 commented 9 months ago

It looks like there is a problem with your opencv installation It is recommended to reinstall opencv For example brew install

Hi and thanks for reply i have build opencv manually can i user brew install instead ?