You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 18.04安装OpenCV 4.5.1及contrib时libtiff.so.5未定义引用报错问询

问题排查与解决方法

报错信息如下:
/usr/bin/ld: warning: libjbig.so.0, needed by //usr/lib/x86_64-linux-gnu/libtiff.so.5, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libthai.so.0, needed by //usr/lib/x86_64-linux-gnu/libpango-1.0.so.0, not found (try using -rpath or -rpath-link)
//usr/lib/x86_64-linux-gnu/libtiff.so.5: undefined reference to jbg_enc_out' //usr/lib/x86_64-linux-gnu/libtiff.so.5: undefined reference to jbg_dec_getsize'
//usr/lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined reference to `th_uni2tis@LIBTHAI_0.1'

错误原因

上述报错属于编译链接阶段的依赖缺失问题:

  • libjbig.so.0 是JBIG格式图像的编解码依赖库,被系统的libtiff库调用,当前系统未安装该库
  • libthai.so.0 是泰语字符处理依赖库,被系统的pango图形文本渲染库调用,当前系统未安装该库

解决步骤

  • 第一步:更新系统包索引
    sudo apt update
    
  • 第二步:安装缺失的两个依赖包
    sudo apt install -y libjbig0 libthai0
    
  • 第三步:刷新系统动态链接库缓存,让系统识别新安装的库
    sudo ldconfig
    
  • 第四步:清理OpenCV之前的编译缓存,重新编译
    进入你之前创建的OpenCV编译build目录,执行清理操作,避免旧缓存影响:
    cd /path/to/your/opencv/build # 替换为你自己的build目录路径
    make clean
    rm -rf *
    
    之后重新执行你原来的cmake配置命令,再启动编译即可:
    # 这里替换为你自己的cmake配置命令,比如带opencv-contrib路径的配置
    cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.5.1/modules ..
    make -j$(nproc)
    

可选验证步骤

如果执行完上述操作还是报错,可以先验证依赖库是否正常安装:

  • 验证libjbig.so.0是否存在:
    ldconfig -p | grep libjbig.so.0
    
    正常输出会显示该库的系统路径,无输出说明安装失败,可以尝试重新安装对应包
  • 验证libthai.so.0是否存在:
    ldconfig -p | grep libthai.so.0
    

内容的提问来源于stack exchange,提问作者骆忠伟

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.27 17:45:08