ubuntu20.04手动编译opencv 4.9.0遇到的问题汇总

ubuntu20.04手动编译opencv 4.9.0遇到的问题汇总

编译流程

以4.9.0版本为例,可参考:

  • https://docs.opencv.org/4.9.0/d2/de6/tutorial_py_setup_in_ubuntu.html
  • https://linuxize.com/post/how-to-install-opencv-on-ubuntu-20-04/
  • https://blog.csdn.net/weixin_44003563/article/details/90404745
  • https://www.mintimate.cn/2021/11/07/installOpenCV/#%E5%AF%BC%E5%85%A5Python
  • https://blog.csdn.net/qq_25005909/article/details/78554469(主要参考)

分享下我的命令:

git clone https://github.com/opencv/opencv.git
git clone https://github.com/opencv/opencv_contrib.git

cd opencv
mkdir build
cd build


sudo cmake -D CMAKE_BUILD_TYPE=RELEASE -D  CMAKE_INSTALL_PREFIX=/usr/local/opencv -D CUDA_GENERATION=Auto OPENCV_EXTRA_MODULES_PATH=/home/user/yuanjinmin/opencv_contrib/modules/ -D BUILD_opencv_python3=ON -D PYTHON_DEFAULT_EXECUTABLE=/home/user/anaconda3/envs/yjm_slowfast/bin/python3.9  -D PYTHON3_LIBRARIES=/home/user/anaconda3/lib/libpython3.9.so -D PYTHON3_NUMPY_INCLUDE_DIRS=/home/user/anaconda3/envs/yjm_slowfast/lib/python3.9/site-packages/numpy/core/include -D PYTHON3_EXECUTABLE=/home/user/anaconda3/envs/yjm_slowfast/bin/python3.9 ..

sudo make -j8 # 结合自己服务器线程

sudo make install

sudo ldconfig

export PYTHONPATH="$PYTHONPATH:/usr/local/opencv/lib/python3.9/site-packages"

python3 -c "import cv2; print(cv2.__version__)"

编译加速

https://blog.csdn.net/tfb760/article/details/104030841

ippicv_2021.10.0_lnx_intel64_20230919_general.tgz下载慢

可参考:https://blog.csdn.net/orDream/article/details/84311697

face_landmark_model.dat下载

可参考:https://blog.csdn.net/pzb19841116/article/details/115519158#comments_32285782

ubuntu20.04下编译opencv4.9.0时报错

/usr/bin/ld: /lib/x86_64-linux-gnu/libwayland-client.so.0: undefined reference to ffi_type_uint32@LIBFFI_BASE_7.0' /usr/bin/ld: /lib/x86_64-linux-gnu/libwayland-client.so.0: undefined reference to ffi_type_sint32@LIBFFI_BASE_7.0’
/usr/bin/ld: /lib/x86_64-linux-gnu/libwayland-client.so.0: undefined reference to ffi_type_pointer@LIBFFI_BASE_7.0' /usr/bin/ld: /lib/x86_64-linux-gnu/libwayland-client.so.0: undefined reference to ffi_type_void@LIBFFI_BASE_7.0’
/usr/bin/ld: /lib/x86_64-linux-gnu/libwayland-client.so.0: undefined reference to ffi_prep_cif@LIBFFI_BASE_7.0' /usr/bin/ld: /lib/x86_64-linux-gnu/libwayland-client.so.0: undefined reference to ffi_call@LIBFFI_BASE_7.0’

可参考:https://blog.csdn.net/special00/article/details/135100639
2.

Cannot generate a safe runtime search path for target opencv_imgcodecs
because files in some directories may conflict with libraries in implicit

参考:https://blog.csdn.net/cunyizhang/article/details/124968204

ImportError:libgobject-2.0.so.0: undefined symbol: ffi_type_uint32, version

使用export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libffi.so.7之后在此窗口运行python项目可以解决(每次都要设置,除非放入.bashrc中)

The imported target “openjp2_static” references the file “/usr/lib/x86_64-linux-gnu/libopenjp2.a” but this file does not exist. Possible reasons include: …

报类似于https://github.com/opencv/opencv/issues/18090这样的错误,不用管

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

qq_33843237

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值