当前位置:   article > 正文

ubuntu undefined reference to 问题解决方法_undefined reference to `ffi_type_uint32@libffi_bas

undefined reference to `ffi_type_uint32@libffi_base_7.0

一、背景现象:

ubuntu20.04下编译opencv4.5.5时报错:

/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'

二、原因分析:

        1.观察报错:大概是libwayland-client.so.0找不到LIBFFI_BASE_7.0,可见库与ffi有关

        2.用ldd命令分析libwayland-client.so依赖:

         $  ldd /lib/x86_64-linux-gnu/libwayland-client.so | grep ffi  发现依赖libffi.so.7

        3.定位这个库:          $  locate libffi.so.7

                                      或 $  find /usr/lib/ -name "libffi.so*"

                发现除了/usr/lib/x86_64-linux-gnu之外,Anaconda安装目录/lib下面libffi.so.7

        4.查看这两个库:# 查看系统的libffi
                                $ ll /lib/x86_64-linux-gnu/ | grep ffi
                                # 查看Anaconda的libffi
                                $ ll ~/anaconda3/lib/ | grep ffi

三、解决:

        将anaconda的libffi.so.7 指向系统libffi.so.7

                $ cd (你的Anaconda安装目录)/lib
                $ sudo rm libffi.so.7
                $ sudo ln -s /lib/x86_64-linux-gnu/libffi.so.7.1.0 libffi.so.7

四、附带各版本libffi.so位置

http://mirrors.edge.kernel.org/ubuntu/pool/main/libf/libffi/

ubuntu下载后安装:

        $ sudo apt install ./libffixxxxxxx.deb

    会安装到/usr/lib/x86_64-linux-gnu/

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/185124
推荐阅读
相关标签
  

闽ICP备14008679号