richarddurbin / pbwt

Implementation of Positional Burrows-Wheeler Transform for genetic data
100 stars 37 forks source link

"Undefined reference" link-time error #32

Closed yunusbb closed 9 years ago

yunusbb commented 9 years ago

Dear Richard Durbin,

I have managed to compile the pbwt software on my laptop running mac osx but could not do it on our linux based machines (cluster nodes running Scientific Linux 6.5)

This is what I am getting:

make gcc -g -o pbwt pbwtMain.o pbwtCore.o pbwtSample.o pbwtIO.o pbwtMatch.o pbwtImpute.o pbwtPaint.o pbwtLikelihood.o pbwtMerge.o pbwtGeneticMap.o pbwtHtslib.o hash.o dict.o array.o utils.o ../htslib/libhts.a -lpthread -lz -lm pbwtImpute.o: In function referenceImpute3': /gpfs/hpchome/bayazit1/udustorage/macs/macs-0.5d/TEST_MACS_PBWT/pbwt-master/pbwtImpute.c:1148: undefined reference tomergesort' collect2: ld returned 1 exit status make: *\ [pbwt] Error 1

By the way, our IT people also failed to compile it and this is why I decided to report this.

johnlees commented 9 years ago

mergesort is a function in the os x std lib (based on bsd?), but not in other systems

you can get this to compile on other unix systems if you change this to a quicksort in pbwtImpute.c line 1148: { if (nSparse > 1) /* can't guarantee order of sparse segments */ qsort (arrp(maxMatch[j], 0, MatchSegment), arrayMax(maxMatch[j]), sizeof(MatchSegment), matchSegmentCompare);

yunusbb commented 9 years ago

Hi John, Thank you for your reply. After substituting 'mergesort' by 'qsort' now I am getting another sort of error(see below) message. I guess some other changes also needed? I know little about C and all this compiling business, so thank you very much for your help!

$make echo '#define PBWT_COMMIT_HASH """"' > version.h gcc -g -c pbwtMain.c gcc -g -c pbwtCore.c gcc -g -c pbwtSample.c gcc -g -c pbwtIO.c gcc -g -c pbwtMatch.c gcc -g -c pbwtImpute.c pbwtImpute.c: In function ‘referenceImpute3’: pbwtImpute.c:1149: error: void value not ignored as it ought to be make: *\ [pbwtImpute.o] Error 1

johnlees commented 9 years ago

You need to do the edit as I've pasted it above, not just change mergesort to qsort i.e. remove the 'if' and 'die' statements The reason for this is qsort doesn't return a value and mergesort does

yunusbb commented 9 years ago

Hi John, It worked now! Thank you for your help!