statgen / bamUtil

http://genome.sph.umich.edu/wiki/BamUtil
89 stars 30 forks source link

Error building from source: libStatGen #61

Open moldach opened 3 years ago

moldach commented 3 years ago

I'm working on a Linux based HPC working with private data hence the environment is restrictive (no internet connection); therefore packages must be built from source.

After downloading the file and transferring it to the cluster I try to build by specifying the PATH for libStatGen but I get an error:

$ wget https://github.com/statgen/bamUtil/archive/v1.0.14.tar.gz

$ tar -zxvf v1.0.14.tar.gz
$ cd bamUtil-1.0.14
$ make LIB_PATH_GENERAL=/project/M-mtgraovac182840/tools/libStatGen
make[1]: Entering directory '/project/M-mtgraovac182840/tools/bamUtil-1.0.14/src'
make -C /project/M-mtgraovac182840/tools/libStatGen --no-print-directory opt
ar -cru ../libStatGen.a obj/bgzf.o obj/knetfile.o
g++  -O4 -pipe -Wall -Werror  -Wno-strict-overflow -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/Chromosome.o -c Chromosome.cpp -DVERSION="\"1.0.0\""
Chromosome.cpp: In constructor 'Chromosome::Chromosome(const string&, unsigned int, bool)':
Chromosome.cpp:42:15: error: '*<unknown>.Chromosome::gs' is used uninitialized in this function [-Werror=uninitialized]
     if (this->gs) delete gs;
         ~~~~~~^~
cc1plus: all warnings being treated as errors
make[3]: *** [../Makefiles/Makefile.common:81: obj/Chromosome.o] Error 1
make[2]: *** [Makefiles/Makefile.base:15: general] Error 2
make[1]: *** [/project/M-mtgraovac182840/tools/libStatGen/Makefiles/Makefile.ext:50: /project/M-mtgraovac182840/tools/libStatGen/libStatGen.a] Error 2
make[1]: Leaving directory '/project/M-mtgraovac182840/tools/bamUtil-1.0.14/src'
make: *** [/project/M-mtgraovac182840/tools/libStatGen/Makefiles/Makefile.base:15: src] Error 2
jonathonl commented 3 years ago

This is already fixed in the master branch of libStatGen. You can download at https://github.com/statgen/libStatGen/archive/master.zip.

moldach commented 3 years ago

Hi @jonathonl I've tried following the build instructions using the latest master branch of libStatGen but I'm getting an error still:

$ wget https://github.com/statgen/bamUtil/archive/v1.0.14.tar.gz
$ tar zxvf v1.0.14.tar.gz
$ cd bamUtil-1.0.14
$ wget https://github.com/statgen/libStatGen/archive/master.zip
$ unzip master.zip
$ make all
make[1]: Entering directory '/project/M-mtgraovac182840/tools/bamUtil-1.0.14/src'
make -C ../../libStatGen --no-print-directory opt
ar -cru ../libStatGen.a obj/bgzf.o obj/knetfile.o
g++  -O4 -pipe -Wall -Werror  -Wno-strict-overflow -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=6                                                                                                                    4 -D__STDC_LIMIT_MACROS  -o obj/Chromosome.o -c Chromosome.cpp -DVERSION="\"1.0.0\""
Chromosome.cpp: In constructor 'Chromosome::Chromosome(const string&, unsigned int, bool)':
Chromosome.cpp:42:15: error: '*<unknown>.Chromosome::gs' is used uninitialized in this function [-Werror=uniniti                                                                                                                    alized]
     if (this->gs) delete gs;
         ~~~~~~^~
cc1plus: all warnings being treated as errors
make[3]: *** [../Makefiles/Makefile.common:81: obj/Chromosome.o] Error 1
make[2]: *** [Makefiles/Makefile.base:15: general] Error 2
make[1]: *** [../../libStatGen/Makefiles/Makefile.ext:50: ../../libStatGen/libStatGen.a] Error 2
make[1]: Leaving directory '/project/M-mtgraovac182840/tools/bamUtil-1.0.14/src'
make: *** [../libStatGen/Makefiles/Makefile.base:15: src] Error 2
jonathonl commented 3 years ago

bamUtil is looking for libStatGen in the location "../libStatGen" relative to the bamUtil folder. You unzipped master.zip in the bamUtil directory instead in the parent directory. Also, master.zip unzips into a directory called libStatGen-master and bamUtil expects it to be called libStatGen.

From the bamUtil directory, you could run:

mv ../libStatGen ../libStatGen.bak && mv libStatGen ../libStatGen && make clean && make

Or, better yet, you could:

cd ../libStatGen && git pull && cd ../bamUtil && make clean && make

Or you could edit ../libStatGen/general/Makefile and remove -Werror so that it doesn't error on warnings. The source code that is failing doesn't get used by bamUtil.