2013-01-18 105 views
2

我试着按以下步骤安装程序(vcftools),为此,Makefile中写道:的Linux的Makefile:未定义的引用 'gzbuffer'(其中LIB = -lz)

# 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软件中心),但显示不出来,当我进入:

[email protected]:/home/Public/Packages/vcftools_0.1.10/cpp# whereis zlib1g-dev 
zlib1g-dev: 
[email protected]:/home/Public/Packages/vcftools_0.1.10/cpp# which zlib1g-dev 

我已经考虑删除并重新安装zlib的,但它看起来像有几个程序依赖于它。当试图运行安装或删除,我得到以下信息:

命令和apt-get安装的zlib-devel的

Reading package lists... Done 
Building dependency tree  
Reading state information... Done 
E: Unable to locate package zlib-devel 

我不知道问题出在zlib的安装在我的电脑,安装中的错误,或其他完全在我头上的东西。任何建议将不胜感激。谢谢。

+0

FTR gzbuffer()是添加到zlib 1.2.3.5(2010年1月8日) – marcin

回答

1

在我的系统(Ubuntu 12.04.3 LTS)上,这是一个lib位置问题。
确保已安装zlib1g-dev。
在vcftools_whatever/CPP/Makefile文件,更改

LIB = -lz 

LIB = -L/usr/local/lib/ -lz 
0

有一个在obuntu在这方面,在特定库的声明必须的声明后出现的错误图书馆路径。

在Makefile的-lz后,才能被放置-L/usr/local/lib/

我建议改变LIB声明下面的一个 - 这应该可以解决问题

LIB = -I/usr/local/include/ -L/usr/local/lib/ -lz