ucscGenomeBrowser / kent

UCSC Genome Browser source tree. Stable branch: "beta".
http://genome.ucsc.edu/
Other
219 stars 89 forks source link

bamToPsl v357_base compile error #8

Closed karl616 closed 6 years ago

karl616 commented 7 years ago

I have problems compiling bamToPsl. Error output pasted at the end. I saw there were changes to htslib, could this have an impact here?

My target was v357, but I also tried to checkout the head of the repository and the problem persists.

cd bamToPsl && echo bamToPsl && make
bamToPsl
make[1]: Entering directory `/TL/deep-share/archive00/software/packages/kent_source/git/kent/src/utils/bamToPsl'
gcc -O -g -o /home/karln/bin/x86_64/bamToPsl bamToPsl.o    ../../lib/x86_64/jkweb.a -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -ldl -lstdc++ -lrt -lpthread -L/lib -lssl -lcrypto ../../htslib/libhts.a -L/usr/lib/x86_64-linux-gnu -lpng12 -lz -lm
../../lib/x86_64/jkweb.a(bamFile.o): In function `bamFetchAlreadyOpen':
/TL/deep-share/archive00/software/packages/kent_source/git/kent/src/lib/bamFile.c:168: undefined reference to `cram_get_Md5'
/TL/deep-share/archive00/software/packages/kent_source/git/kent/src/lib/bamFile.c:175: undefined reference to `cram_get_ref_url'
/TL/deep-share/archive00/software/packages/kent_source/git/kent/src/lib/bamFile.c:176: undefined reference to `cram_get_cache_dir'
../../lib/x86_64/jkweb.a(bamFile.o): In function `bamAndIndexFetchPlus':
/TL/deep-share/archive00/software/packages/kent_source/git/kent/src/lib/bamFile.c:218: undefined reference to `cram_set_cache_url'
collect2: error: ld returned 1 exit status
make[1]: *** [/home/karln/bin/x86_64/bamToPsl] Error 1
make[1]: Leaving directory `/TL/deep-share/archive00/software/packages/kent_source/git/kent/src/utils/bamToPsl'
make: *** [bamToPsl.all] Error 2
christopherLee1 commented 7 years ago

Did you already run make libs from top level kent source? What make were you running that generated this error?

Thanks,

Christopher Lee UCSC Genomics Institute

christopherLee1 commented 7 years ago

Also if you don't need to compile it yourself, you can download a pre-compiled version here: http://hgdownload.soe.ucsc.edu/admin/exe/linux.x86_64/

karl616 commented 7 years ago

I used GNU Make 3.81 under Debian 7.11 and yes I followed the instructions in the README file, first compiling src/lib, then jkOwnLib and htslib. This was the first error I saw.

I saw the pre-compiled binaries. The reason I want to compile myself is to be able to track which release I'm using. It's a bit cumbersome, but the best I have at the moment.

I have the same problem trying to compile the packed archive of v357:

http://hgdownload.soe.ucsc.edu/admin/exe/userApps.v357.src.tgz

I am able to compile userApps.v309.src.tgz without problems.

maximilianh commented 7 years ago

Looks like htslib was not compiled before this was run.

You can go into the htslib directory and run "make" there. "make libs" or "make topLibs" in kent/src would also make all required libraries, including htslib.

The top-level targets "make" or "make userApps" or "make cgi" in kent/src will build the libraries first and then the tools.

How did you arrive at a situation where htslib was not compiled? What was the "make" command that you ran to get here?

Sorry if this overlaps with what Chris commented earlier, I didn't see that he replied.

karl616 commented 7 years ago

htslib compiles without errors. IThe libhts.a file referred while building bamToPsl is there.

make libs fails trying to enter the non-existing folder of optimalLeaf. make topLibs finishes without error. Both these make commands only have targets in the src folder though. The targets in the htslib directory is missing.

As tried to describe above:

NullModel commented 7 years ago

Good Morning Karl: I've been trying to reproduce your issue here. One thing to note, with the userApps.src.tgz source, the make target is 'userApps' as in: make userApps, I believe we have never mentioned that in any README instructions.

The typical 'make libs' does not function with this userApps.src since the optimalLeaf directory is not included in that source. You would need the entire source tree for that.

I'm not sure what happens with the build when you set a CFLAGS and LDFLAGS on the command line. I don't know if src/inc/common.mk is aware of how to handle that.

If you want to use the download binaries and keep track of their version, place your download binaries in a versioned directory, e.g.: kent357/

For your build, compare your compile output with this sequence from 'make' in src/utils/bamToPsl, I would be curious to see what yours looks like:

`gcc -O -g -Wall -Wformat -Wimplicit -Wreturn-type -Wuninitialized -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DMACHTYPE_x86_64 -Wall -Wformat -Wimplicit -Wreturn-type -Wuninitialized -I../inc -I../../inc -I../../../inc -I../../../../inc -I../../../../../inc -I../../htslib -I/include -I/usr/include/libpng12 -o bamToPsl.o -c bamToPsl.c

gcc -O -g -o /home/hiram/bin/x86_64/bamToPsl bamToPsl.o ../../lib/x86_64/jkweb.a -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -ldl -lstdc++ -lrt -lpthread -L/lib -lssl -lcrypto ../../htslib/libhts.a -L/usr/lib/x86_64-linux-gnu -lpng12 -lz -lm true /home/hiram/bin/x86_64/bamToPsl`

This assumes the kent/src libraries have already been built.

What is is your install location for uuid includes and libraries ? If it is a 'standard' location for Debian, perhaps I can get that into src/inc/common.mk for future Debian users.

NullModel commented 7 years ago

I note your example gcc link line is remarkably void of the gcc options that I see when I run it ?

NullModel commented 7 years ago

I have verified you can set CFLAGS and that will get into the compile. However LDFLAGS will not, to get something extra in the library link, use the variable: L

` export L="-L/path/to/uuid"

gcc -O -g -o /home/hiram/bin/x86_64/bamToPsl bamToPsl.o ../../lib/x86_64/jkweb.a -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -ldl -lstdc++ -lrt -L/path/to/uuid -lpthread -L/lib -lssl -lcrypto ../../htslib/libhts.a -L/usr/lib/x86_64-linux-gnu -lpng12 -lz -lm `

karl616 commented 6 years ago

Sorry for the late reply. Other things came in between.

Only being an C end-user I don't see how the uuid path can be relevant here. I read the error as bamFile.c missing references to bam/cram specific functions, which I assume are located in htslib.

The "missing" gcc options are hidden behind the scroll bar. Copied it out below:

gcc -O -g -o /home/karln/bin/x86_64/bamToPsl bamToPsl.o ../../lib/x86_64/jkweb.a -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -ldl -lstdc++ -lrt -lpthread -L/lib -lssl -lcrypto ../../htslib/libhts.a -L/usr/lib/x86_64-linux-gnu -lpng12 -lz -lm

Anyhow, if this hasn't shown up elsewhere and you cannot repeat it, I would write it of as something system specific. I was able to compile the parts I needed.