Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find zlib.h. #14

Open
ArnieBerg opened this issue Oct 16, 2019 · 15 comments
Open

Cannot find zlib.h. #14

ArnieBerg opened this issue Oct 16, 2019 · 15 comments

Comments

@ArnieBerg
Copy link

ArnieBerg commented Oct 16, 2019

When I run the 'make test' after a successful setup of the environment and pipeline, I get the following error:
(raseenv) analynano@analynano:/media/analynano/Data500GB/ArnieFiles/rase-pipeline$ prophyle decompress "database/spneumoniae-sparc.k18.tar.gz" database
[prophyle] 2019-10-15 16:15:26 Shell command: make -j -s -C /home/analynano/miniconda3/envs/raseenv/lib/python3.7/site-packages/prophyle
prophyle_assembler.cpp:43:10: fatal error: zlib.h: No such file or directory
#include <zlib.h>
^~~~~~~~
compilation terminated.
make[1]: *** [Makefile:13: prophyle_assembler.o] Error 1
make: *** [Makefile:14: compile_assembler] Error 2
[prophyle] 2019-10-15 16:15:26 Unfinished, an error occurred (error code 2, 0.8 MB used): make -j -s -C /home/analynano/miniconda3/e
nvs/raseenv/lib/python3.7/site-packages/prophyle
ProPhyle Error: A command failed, see messages above.

There is a zlib.h in /home/analynano/miniconda3/envs/raseenv/include. And it is referenced in $CFLAGS:

(raseenv) analynano@analynano:/media/analynano/Data500GB/ArnieFiles/rase-pipeline/rase$ echo $CFLAGS
-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/analynano/miniconda3/envs/raseenv/include

What could I be missing?

@karel-brinda
Copy link
Member

Thanks for reporting the problem. What operating system do you use?

@ArnieBerg
Copy link
Author

Ubuntu 18.04.

@karel-brinda
Copy link
Member

It's weird that zlib is not installed on your system. Could you run sudo apt-get install libz-dev and try it again?

@ArnieBerg
Copy link
Author

It seems that zlib.h is installed on the system, but is not included in the search path for the make environment.

Notice that if it helps you can setup an environment with docker and replicate the issue by running 'docker build' with this file:
https://gist.github.com/sbuller/a7b769b9c6be7162949084d68daaece8

It looks like a problem with the prophyle Makefiles not working with conda environments.
Conda puts zlib.h in $ENV/include, but the compiler is built to expect the system includes under $ENV/x86_64-conda_cos6-linux-gnu. Conda seems to take care of this by setting conventional environment variables for the compiler. These environment variables are picked up by default make rules, but are not present in the rules in the Makefiles in $ENV/lib/python3.7/site-packages/prophyle/*. See https://www.gnu.org/software/make/manual/make.html#Implicit-Rules for more on implicit rules. In particular conda relies on CFLAGS and LDFLAGS being used, but this is just convention due to the aforementioned implicit rules.

Does that help point to a solution?

@ArnieBerg
Copy link
Author

Here is what fixed it for my environment. I modified the Makefiles to reflect the include location.

export PROPHYLE=/home/analynano/miniconda3/envs/raseenv/lib/python3.7/site-packages/prophyle

append LDFLAGS to compilation commands

sed -i 's/($(CC).$)/\1 $(LDFLAGS)/' $PROPHYLE/{,/}/Makefile
sed -i 's/($(CXX).$)/\1 $(LDFLAGS)/' $PROPHYLE/{,/}/Makefile

append to CFLAGS rather than overwriting

sed -i 's/CFLAGS=/CFLAGS+=/' $PROPHYLE/prophyle_index/{,bwa/}Makefile
sed -i 's/CXXFLAGS =/CXXFLAGS +=/' $PROPHYLE/prophyle_as*/Makefile

@karel-brinda
Copy link
Member

Hi Arnie, thanks for the solution! I will keep the ticket open as other users might be experiencing the same and the issue needs to be fixed.

@karel-brinda karel-brinda reopened this Oct 17, 2019
@ArnieBerg
Copy link
Author

ArnieBerg commented Oct 31, 2019 via email

@MortenEneberg
Copy link

MortenEneberg commented Apr 6, 2021

Hi Karel and Arnie,

I receive the exact same error also running Ubuntu (20.04) in a VM.

Which of the Makefiles is it that has to be altered to fix the error?

Kind regards,
Morten

@MortenEneberg
Copy link

I tried using Arnie's solution as I realized (at least that is what I think) it was supposed to replace all occurrences. However, I receive an error upon execution, can you help:
image

Thanks!

@MortenEneberg
Copy link

@karel-brinda , @ArnieBerg
? :-)

@karel-brinda
Copy link
Member

I think the best solution would be to edit the corresponding file manually (note that you will have to identify the directory of the source codes in your log messages, it no longer will be /home/analynano/miniconda3/envs/raseenv/lib/python3.7/site-packages/prophyle).

On most computers the current way of packaging ProPhyle works, but sometimes there are issues like this one. As ProphAsm (formerly called prophyle_assembler) now exists as a standalone program, future versions of ProPhyle will no longer be distributed with its source codes, but use ProphAsm as a dependency. But it will require changes in the architecture of ProPhyle.

@karel-brinda
Copy link
Member

Concerning the sed error message, my best guess is that on your system there's a slightly different variant of sed with a different syntax (it might be a GNU vs. BSD issue like with many other Unix programs).

@MortenEneberg
Copy link

MortenEneberg commented Apr 22, 2021

Hi again,
I did locate the 4(?) files that are to be edited, however I am unsure what substitutions the sed command actually makes to the flags, and thus what manual substitutions I should conduct. Could you help me with what exact changes I need to make to these files?

Sincerely, Morten

Prophyle makefile
Screenshot from 2021-04-22 09-34-44

Prophyle/prophyle_index/bwa makefile
Screenshot from 2021-04-22 09-36-58

Prophyle/prophyle_assigment makefile
Screenshot from 2021-04-22 09-40-17

Prophyle/prophyle_assembler makefile
Screenshot from 2021-04-22 09-40-37

@MortenEneberg
Copy link

Or maybe a hint to what version of sed will work. This is my installed version:
image

@karel-brinda
Copy link
Member

I am sorry for the difficulties. Maybe try if some params like -E are not necessary: https://unix.stackexchange.com/questions/615977/invalid-reference-1-on-s-commands-rhs-error-for-sed-script. On some systems, these might be passed automatically (e.g., through aliasing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants