@[TOC]背景

ubuntu下go build 出错:

# github.com/h2non/bimg
/tmp/go-build2910330990/b131/_x005.o: In function `vips_reduce_bridge':
../../pkg/mod/github.com/h2non/bimg@v1.1.9/vips.h:133: undefined reference to `vips_reduce'
collect2: error: ld returned 1 exit status
# github.com/h2non/bimg
In file included from ../../pkg/mod/github.com/h2non/bimg@v1.1.9/vips.go:5:0:
../../pkg/mod/github.com/h2non/bimg@v1.1.9/vips.h: In function ‘vips_reduce_bridge’:
../../pkg/mod/github.com/h2non/bimg@v1.1.9/vips.h:133:9: warning: implicit declaration of function ‘vips_reduce’ [-Wimplicit-function-declaration]
return vips_reduce(in, out, xshrink, yshrink, NULL);
^

@[TOC]主要原因

https://github.com/deso-protocol/backend/issues/84

https://github.com/libvips/libvips/issues/1844

即需要更新libvips包到高版本(最新也可)。如未安装该包,则会提示:

No package 'vips' found
Package vips was not found in the pkg-config search path.
Perhaps you should add the directory containing `vips.pc'
to the PKG_CONFIG_PATH environment variable
No package 'vips' found
pkg-config: exit status 1

install一下即可解决。

@[TOC]排查手段

查看版本(成功时)

vips -v
vips-8.2.2-Sat Jan 30 17:12:08 UTC 2016

如未安装则会提示。

@[TOC]解决办法

首先安装几个必要的包:

apt-get install  build-essential  libvips-dev libglib2.0-dev  libexpat1-dev

备份源

cp  /etc/apt/sources.list  /etc/apt/sources.list.bk

更新源

vim /etc/apt/sources.list

内容如下:

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

执行更新:

sudo apt-get update

可先尝试更新libvips-dev

apt-get upgrade libvips-dev

如有报错 或 更新成功了但尝试再次编译还是不成功的话,继续看下一步。

按依赖识别更新所有包:

apt-get dist-upgrade

再次查看

vips -v
vips-8.4.5-Wed Jan 18 12:36:44 UTC 2017

可以看到本部已更新。

@[TOC]最终成功时的pkg-config的环境变量

export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig

问题记录vips.h:133: undefined reference to `vips_reduce‘ collect2: error: ld returned 1 exit status相关推荐

  1. gcc报(.text+0x24): undefined reference to `main‘collect2: error: ld returned 1 exit status解决方法

    我已经记不清自己为什么这样解决了,重新搜索了一下也没发现类似的答案. 由于实验需要,我需要编译这个例子: https://github.com/grimm-co/GEARSHIFT/blob/trun ...

  2. NS2:undefined reference to `xxx' collect2: error: ld returned 1 exit status

    这个问题是没有链接. 刚开始先确认,头文件有没有导入. 以下是完整的提示信息错误,检查之后发现hdr_ant_pkt所在的头文件已经被导入: In function `hdr_ant_pkt::acc ...

  3. 编译报错file format not recognized和collect2: error: ld returned 1 exit status记录

    报错啦! 年少无知不懂事,在编译多文件的时候使用了*来编译所有文件 ,于是报了这个错 ld: cannot find res: file format not recognized collect2: ...

  4. VScode报错:undefined reference to ‘WinMain’ collect2.exe: error: ld returned 1 exit status

    X:/MinGw/mingw64/bin/-/lib/gcc/x86_64-w64-mingw32/8.1.0/-/-/-/-/x86_64-w64-mingw32/lib/-/lib/libming ...

  5. undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status

    [root@localhost dss]# gcc -o abc abc.cpp /tmp/ccY3hmyr.o(.eh_frame+0x11): undefined reference to `__ ...

  6. lua-5.2.3编译问题记录quot;libreadline.so: undefined reference to `PC#39;quot;

    作者:zhanhailiang 日期:2014-10-21 [root@~/software]# cd lua-5.2.3 [root@~/software/lua-5.2.3]# make linu ...

  7. [CentOS]CentOS下编译CPP文件时报错[undefined reference to `__gxx_personality_v0' collect2: ld]的解决办法...

    在CentOS环境下编译CPP时报出 undefined reference to `__gxx_personality_v0' collect2: ld 以上错误,调查了一下,加上参数[-lstdc ...

  8. 【ubuntu-qt-dlib】 配置问题 (一) undefined reference to `XPending'

    问题描述:undefined reference to `XPending' source.o: In function `dlib::gui_core_kernel_2_globals::event ...

  9. Caffe编译错误记录(../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_string'....)

    编译caffe出错如下,百思不得其解,错误如下: 86%] Linking CXX executable train_net ../lib/libcaffe.so: undefined referen ...

最新文章

  1. react-native安装Ant Design
  2. SQL Server 2008高可用性系列:数据库快照
  3. Python 中的匿名函数,你滥用了吗?
  4. 非接触式IC智能(射频)卡
  5. Pyhton注释符号使用方法及规范
  6. OutputDebugString输出调试信息
  7. Would It affect RAC clusterware and database If we adjust OS time/Clock?
  8. HTML5+CSS3之字体的下载使用
  9. 官网下载mysql源码
  10. 轻量应用服务器腾讯云,腾讯云轻量应用服务器 ECS云服务器使用对比
  11. Unity IOS微信登录
  12. c语言中int和void,关于指针:void(*)void和int(*)int在C中的含义是什么?
  13. 智能对话机器人开发实战案例剖析(2)
  14. Latex最后一页文本或参考文献左右对齐(平衡)
  15. 将特殊的字符串转换为字典
  16. php blog 博客程序那个好
  17. Java RMI学习与解读(二)
  18. 科学计算与matlab语言期末答案,科学计算与MATLAB语言答案
  19. 传统的DHTML模型
  20. Altium Designer使用方法(DRC警告设置,走线技巧,DIY电路板打印技术)

热门文章

  1. 远程锁定计算机,利用Microsoft帐户来远程退出并锁定你的Windows 10电脑
  2. 【生成报名号+缴费成功】不代表考研报名成功!
  3. linux abs函数怎么用,Linux输入子系统详解
  4. 闲话链表的诞生以及它与数组亲缘关系的故事
  5. 2019,无数人改变命运的绝佳之年!(深度)
  6. 第001讲:我和Python的第一次亲密接触 | 课后测试题及答案
  7. 基于射频RFID智能刷卡门禁系统设计(毕设课设)
  8. python爬虫 requests+lxml爬取前程无忧网之模拟浏览器登录
  9. 材料化学博士后-谷歌offer的转行总结 -- 转自一亩三分地
  10. 制作minist格式的图像数据集