walaj / VariantBam

Filtering and profiling of next-generational sequencing data using region-specific rules
Other
74 stars 10 forks source link

CPPFLAGS and LDFLAGS not propagated to child projects #5

Closed maplesond closed 8 years ago

maplesond commented 8 years ago

I had a problem compiling on our cluster, which doesn't have zlib in the standard directories: /usr or /usr/local. The normal way to do this is to set CPPFLAGS and LDFLAGS appropriately to the custom directory. However, these environment variables do not seem to be propagated from the front end through to the child projects (specifically HTSLIB). Therefore we always fail to link against -lz.

walaj commented 8 years ago

Does it work if you set the environment variables outside of the "configure" call? The issue is that I am using autotools for my own files, but then using the provided Makefiles directly for BWA and HTSlib, so options sent to configure won't make it into those Makefiles.

I am looking for a better solution to this, but just want to check if exporting CPPFLAGS, LDFLAGS before "make" is a work around.

maplesond commented 8 years ago

Unfortunately, this doesn't seem to work for me. The CPPFLAGS and LDFLAGS environment variables do not get propagated into HTSlib (or BWA but that's not a problem for me). I guess the environment variables are being temporarily cleared at some point.

It may be that the only solution is to modify the htslib makefile. It should be possible to do this with minimal changes. An off the cuff idea. You could perhaps rename the HTSLIB Makefile to Makefile.in, add autoconf variables for CPPFLAGS and LDFLAGS where appropriate and add the Makefile in your AC_CONFIG_FILES list in the snowmake configure.ac. That way you can avoid converting htslib to automake but still get custom variables in the Makefile.

walaj commented 8 years ago

Looks like the off the cuff idea works actually. You can now specify either during configure time (./configure CPPFLAGS=-I/path) or before configure with an environment variable. The HTSlib Makefile does indeed clear the environment variables, but switching to Makefile.in and adding references to @CPPFLAGS@ and @LDFLAGS@ gets them back.

I just checked it in. You'll have to update the VariantBam and the SnowTools sub-module, but hopefully this solves it.

maplesond commented 8 years ago

That's great. Seems to work fine now. Thanks for the quick fix!