我正在尝试安装一个程序(vcftools),它的Makefile代码如下:
# Make file for vcftools
# Author: Adam Auton
# ($Revision: 230 $)
# Compiler
CPP = g++
# Output executable
EXECUTABLE = vcftools
# Flag used to turn on compilation of PCA routines
ifndef VCFTOOLS_PCA
VCFTOOLS_PCA = 0
endif
# Compiler flags
CPPFLAGS = -O2 -Wall -Wextra -D_FILE_OFFSET_BITS=64
#CPPFLAGS = -g
# Included libraries (zlib)
#LIB = -lz
LIB = -lz -I/usr/local/include/ -L/usr/local/lib/
OBJS = vcftools.o vcf_file.o vcf_entry.o \
vcf_entry_getters.o vcf_entry_setters.o \
vcf_file_filters.o vcf_file_output.o \
vcf_file_format_convert.o \
vcf_file_diff.o parameters.o \
vcf_file_index.o \
output_log.o我无法让这个Makefile正确运行,但却得到了如下错误:
vcf_file.cpp:(.text+0xe72): undefined reference to `gzbuffer'
collect2: ld returned 1 exit status
make[1]: *** [vcftools] Error 1
make[1]: Leaving directory `/home/Public/Packages/vcftools_0.1.10/cpp'
/bin/sh: 2: cd: can't cd to perl
make: *** [install] Error 2我认为部分问题是与我的zlib安装路径相关的错误。我尝试更改-I和-L路径以匹配我的zlib安装,但没有任何运气(有很多文件夹似乎包含zlib文件)。
此外,通过搜索与此程序(here)相关的其他论坛,似乎我可能需要zlib1g-dev。zlib1g-dev在我的电脑上(它显示在我的ubuntu软件中心),但当我进入:
root@root:/home/Public/Packages/vcftools_0.1.10/cpp# whereis zlib1g-dev
zlib1g-dev:
root@root:/home/Public/Packages/vcftools_0.1.10/cpp# which zlib1g-dev我考虑过删除和重新安装zlib,但看起来有几个程序依赖于它。尝试运行安装或删除时,我收到以下消息:
sudo apt-get install zlib-devel
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package zlib-devel我不确定问题是不是出在我电脑上zlib的安装位置,是安装中的错误,还是我完全无法理解的其他问题。任何建议都将不胜感激。谢谢。
发布于 2013-12-15 08:48:08
在我的系统(Ubuntu 12.04.3 LTS)上,这是一个lib位置问题。
确保安装了zlib1g-dev。
在vcftools_cpp/cpp/Makefile中,更改
LIB = -lz至
LIB = -L/usr/local/lib/ -lz发布于 2016-09-01 16:05:35
该区域的obuntu中有一个bug,其中特定库的声明必须出现在库路径的声明之后。
在makefile中,-lz只能放在-L/usr/local/lib/之后
我建议将LIB声明更改为下面的声明-这应该可以解决问题
LIB = -I/usr/local/include/ -L/usr/local/lib/ -lz发布于 2018-09-24 23:10:23
我通过搜索对gzbuffer var的未定义引用找到了这一点。在CentOS-6.6Linux机器上从源代码编译ImageMagick时出现错误。我不得不做两件事: 1)按照re的建议。Ubuntu,通过travc,编辑Makefile,查找"LIBS =“(在我的例子中是空白的),并将其更改为"LIBS = -L/usr/local/lib -lz”。这让我得到了一个干净的编译。运行"make install“来安装它,它在运行时失败了。2)修复方法是cd到/usr/local/lib,然后从命令行运行"ldconfig“。"ldconfig“更新动态链接器运行时绑定(有关详细信息,请参阅"man”页面)。你可以通过在X-windows的命令行中运行“ImageMagick”来确认安装的正常。(如果您安装了ImageMagick,以便“显示”prgm工作,Python及其各种图形/图像生成工具将自动使用它,允许渲染和检查超出屏幕尺寸的复杂图像)。
https://stackoverflow.com/questions/14405596
复制相似问题