Question: Installing ShortRead - error: zlib not found even with zlib in LD_LIBRARY_PATH
gravatar for joseph.elsherbini
10 weeks ago by
joseph.elsherbini30 wrote:
I am unable to install ShortRead which I need for dada2
R version 3.4.3 (2017-11-30)



checking for gzeof in -lz... no
configure: error: zlib not found
ERROR: configuration failed for package ‘ShortRead’
However, I do have libz available:


LD_LIBRARY_PATH         /home/josephe/miniconda3/envs/dada2pipeline/lib/R/lib:/builddir/vendor/build/lib:/usr/lib/jvm/java-1.7.0-openjdk-

ls -l ~/miniconda3/envs/dada2pipeline/lib/libz*
-rw-rw-r-- 4 josephe josephe 153418 Jan 23  2017 /home/josephe/miniconda3/envs/dada2pipeline/lib/libz.a
lrwxrwxrwx 2 josephe josephe     14 May 11 12:30 /home/josephe/miniconda3/envs/dada2pipeline/lib/ ->
lrwxrwxrwx 2 josephe josephe     14 May 11 12:30 /home/josephe/miniconda3/envs/dada2pipeline/lib/ ->
ADD COMMENTlink modified 24 days ago by pandit.aridaman0 • written 10 weeks ago by joseph.elsherbini30
gravatar for Martin Morgan
10 weeks ago by
Martin Morgan ♦♦ 22k
United States
Martin Morgan ♦♦ 22k wrote:

I'd ensure that this was seen by R, and that the header for libz (typically, installing the '-dev' version of the library) are available.

As a next step, if from the command line and with the unpacked source tarball available you try to install the package

> download.packages("ShortRead", ".", repos = BiocInstaller::biocinstallRepos())
> quit()
$ tar xzf ShortRead_*gz
$ cd ShortRead
ShortRead$ R CMD INSTALL .

and then look for config.log you'll see something like

configure:2897: checking for gzeof in -lz
configure:2922: gcc -o conftest -g -O2   conftest.c -lz   >&5
configure:2922: $? = 0
configure:2931: result: yes

except that you won't get that result, and there'll be a conftest.c file and perhaps informative messages. I'd also look on the mailing list / support site for whatever 'conda' manager you're using for similar messages.

ADD COMMENTlink modified 10 weeks ago • written 10 weeks ago by Martin Morgan ♦♦ 22k
I get the error "cannot find -lz". Do you have any insight into that? I think I have zlib version 1.2.11 installed, it is in the directory /home/josephe/miniconda3/envs/dada2pipeline/lib, and my LD_LIBRARY_PATH is set to that directory.
configure:2897: checking for gzeof in -lz
configure:2922: /home/josephe/miniconda3/envs/dada2pipeline/bin/x86_64-conda_cos6-linux-gnu-cc -o conftest -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-
protector-strong -fno-plt -O2 -pipe -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now conftest.c -lz   >&5
/home/josephe/miniconda3/envs/dada2pipeline/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.2.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
configure:2922: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char gzeof ();
| int
| main ()
| {
| return gzeof ();
|   ;
|   return 0;
| }
configure:2931: result: no
configure:2941: error: zlib not found
ADD REPLYlink written 9 weeks ago by joseph.elsherbini30

You can see the command begin run (the stuff after the line configure:2922:) on the file echoed in the | comment. I'd guess it is that the LD_LIBRARY_PATH is either incorrect or not forwarded to the process that does the compilation and installation. You could edit the file to echo what configure is seeing

AC_CHECK_LIB([z], [gzeof], , AC_ERROR([zlib not found]))
AC_CHECK_SIZEOF([unsigned long]) AC_OUTPUT(src/Makevars)

then use autoconf and R CMD INSTALL; I have

ShortRead master$ autoconf
ShortRead master$ bioc-dev CMD INSTALL .
* installing to library '/home/mtmorgan/R/x86_64-pc-linux-gnu-library/3.5-Bioc-3.8'
* installing *source* package 'ShortRead' ... 
LD_LIBRARY_PATH: /home/mtmorgan/bin/R-3-5-branch/lib:/usr/local/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/java-9-openjdk-amd64/lib/amd64/server:/home/mtmorgan/bin/R-3-5-branch/lib:/usr/local/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/java-9-openjdk-amd64/lib/amd64/server

If LD_LIBRARY_PATH is not correct, then I'm not really sure what to do -- I think it is really a conda problem.

ADD REPLYlink modified 9 weeks ago • written 9 weeks ago by Martin Morgan ♦♦ 22k

I am also facing the same issue with R version 3.4.3 installed via anaconda3.5.2. Did you find any solution for this problem? 

ADD REPLYlink modified 25 days ago • written 25 days ago by amalthomas1110

did you try to troubleshoot as above? what were the results?

ADD REPLYlink written 25 days ago by Martin Morgan ♦♦ 22k

Yes. No luck with that!  Echoing LD_LIBRARY_PATH shows that anaconda lib is included. I am not sure why the package still can't find zlib.
checking for gzeof in -lz... no
configure: error: zlib not found


ADD REPLYlink modified 15 days ago • written 15 days ago by amalthomas1110

Hi Martin,

I have the same problem with the same versions etc. I tried your troubleshooting method, but it just gives the same error that I get in the R console, the one posted above. This is also using conda. Installing ShortRead via conda will unfortuately downgrade R and some other things as I guess they don't have the current version yet.

ADD REPLYlink written 7 days ago by Till10

I finally figured out setting CPPFLAGS and LDFLAGS works:

CPPFLAGS='-I/home/till/miniconda2/envs/dada2/include' LDFLAGS='-L/home/till/miniconda2/miniconda2/envs/dada2/lib'

What does NOT work however is

R CMD INSTALL --configure-args='--with-zlib-include=home/till//miniconda2/envs/dada2/include --with-zlib-lib=/home/till/miniconda2/envs/dada2/lib' .

ADD REPLYlink modified 7 days ago • written 7 days ago by Till10

Thanks for working on this. It sounds like a bioconda issue (I guess -- is that what creates the 'miniconda2' directory?), and that somehow R should know to look in the paths you indicate for the include and lib files. Can you pursue this 'upstream' with the bioconda team?

ADD REPLYlink written 5 days ago by Martin Morgan ♦♦ 22k

 Could you please tell us what exactly you did?
This didn't work for me.

export CPPFLAGS="-I~/panases_soft/anaconda3.5.2/include"
export LDFLAGS="-L~/panases_soft/anaconda3.5.2/lib"


ADD REPLYlink modified 5 days ago • written 5 days ago by amalthomas1110
gravatar for pandit.aridaman
24 days ago by
pandit.aridaman0 wrote:

I had the same error for the past week. I made it to work by installing ShortRead in R (not in conda) and then add the core R's library when I ran R in conda environment. I just made it to work, so I am sure there might be a better solution. I think this is because of conflict in the zlib conda and core library.

Also posted the solution for the same question here:


ADD COMMENTlink written 24 days ago by pandit.aridaman0
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 256 users visited in the last hour