vibansal / HapCUT2

software tools for haplotype assembly from sequence data
BSD 2-Clause "Simplified" License
207 stars 36 forks source link

Release 1.3 build warnings patch #97

Closed mathog closed 4 years ago

mathog commented 4 years ago

HapCUT2 release 1.3 generated a lot of warnings with the gcc 8.3.1 compiler. A couple of these were actual bugs (for instance, access position [4] in an array of size 4.) There was one warning I could not resolve because it wasn't clear to me what that fprintf statement was doing. In any case, it tries to print an int as a double and then trries to print an int with no corresponding variable in the list. The patch to get an (almost) clean compile for 8.3.1 and 9.3.0 is attached, as is the build log for the patched code using gcc 8.3.1.

(This was on CentOS 8. The htslib module had to be loaded first so that it could find that library.)

build_2020_05_08.log hapcut2_1_3_patch.txt

vibansal commented 4 years ago

Thanks a lot for fixing the warnings and the patch. I have fixed the bugs and updated the code.

mathog commented 4 years ago

Much better, no compile warnings. However, the Makefile is still missing pieces needed at the link stage. These are the mods needed on mine:

< HTSLIB=/usr/common/src/htslib #path/to/htslib/
---
> HTSLIB=/usr/common/src/htslib
> SAMTOOLS=/usr/common/src/samtools
21c22
<       $(CC) -I$(HTSLIB) -g $(B)/bamread.o $(B)/hapfragments.o $(B)/hashtable.o $(B)/readfasta.o $(B)/readvariant.o -o $(B)/extractHAIRS $(H)/extracthairs.c -L$(HTSLIB) -pthread -lhts -lm -lz
---
>       $(CC) -I$(HTSLIB) -g $(B)/bamread.o $(B)/hapfragments.o $(B)/hashtable.o $(B)/readfasta.o $(B)/readvariant.o -o $(B)/extractHAIRS $(H)/extracthairs.c -L$(HTSLIB) -pthread -lhts -lm -lz -lcurl -lcrypto -llzma -lbz2

Actually I'm not sure that the SAMTOOLS part is still needed, that dates from a much earlier build of HapCUT2 and I have just been carrying it along for later versions. The extra link libraries are definitely needed though. The INSTALL file says that if samtools is not present the Makefile will download and build it. However, the Makefile does not appear to have any code to do so.

vibansal commented 4 years ago

SAMTOOLS is no longer needed. I have updated the Makefile and INSTALL files. Thanks.