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

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

编译流程

以4.9.0版本为例,可参考:

分享下我的命令:

bash 复制代码
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

text 复制代码
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这样的错误,不用管

相关推荐
qingyulee几秒前
python redis
开发语言·redis·python
互联网时光机1 小时前
我用 UniApp + 腾讯云 IAI 做了一个“明星脸比对“小程序,零后台延迟
经验分享·python·人脸识别
l1t1 小时前
DeepSeek总结的Python 3.14.5 发布候选版本
开发语言·python
Cyber4K1 小时前
【Python专项】进阶语法-日志分类与分析(2)
开发语言·前端·python
lbb 小魔仙1 小时前
Python + LangChain 环境搭建完全指南:从零构建本地 RAG 知识库(附 Ollama 本地模型集成)
开发语言·python·langchain
风落无尘1 小时前
Python 包发布全流程:从项目结构到 PyPI 上线,以及我踩过的那些坑
开发语言·python·pip
Lenyiin1 小时前
《LeetCode 顺序刷题》61 - 70
java·c++·python·算法·leetcode·lenyiin
岁岁的O泡奶1 小时前
NSSCTF_crypto_[LitCTF 2023]babyLCG
经验分享·python·算法·密码学·crypto·流密码
风落无尘1 小时前
我用 LangChain 写了一个带“定速巡航”的向量化工具,发布到 PyPI 了!
人工智能·python·langchain
AI技术控1 小时前
RAG 效果差不是模型问题:10 个检索增强失败原因总结
人工智能·python·自然语言处理