aquaskyline / SOAPdenovo2

Next generation sequencing reads de novo assembler.
GNU General Public License v3.0
220 stars 78 forks source link

Error during compilation #39

Closed michaelgruenstaeudl closed 6 years ago

michaelgruenstaeudl commented 6 years ago

I receive the following error when compiling SOAPdenovo2:

~/git/SOAPdenovo2 $ make

pregraph_sparse_63mer.v1.0.3 cleaning done.                         
pregraph_sparse_63mer.v1.0.3 objects generated.                    
SOAPdenovo-63mer cleaning done.                              
SOAPdenovo-63mer objects generated.                                
sparsePregraph/io_func.o: In function `read1seqbam(char*, char*, int, samfile_t*, int*) [clone .constprop.58]':
io_func.cpp:(.text+0x47): undefined reference to `samread'
io_func.cpp:(.text+0xe2): undefined reference to `bam_format1_core'
sparsePregraph/io_func.o: In function `read1seqbam(char*, char*, int, samfile_t*, int*)':
io_func.cpp:(.text+0x62a): undefined reference to `samread'
io_func.cpp:(.text+0x6ca): undefined reference to `bam_format1_core'
standardPregraph/readseq1by1.o: In function `read1seqbam':
readseq1by1.c:(.text+0xaa7): undefined reference to `samread'
readseq1by1.c:(.text+0xacc): undefined reference to `bam_format1_core'
/lib64/libbam.a(sam.o): In function `samthreads':
(.text+0x11): undefined reference to `hts_get_format'
(.text+0x2c): undefined reference to `bgzf_mt'
/lib64/libbam.a(sam.o): In function `samopen':
(.text+0x62): undefined reference to `hts_open'
(.text+0xb8): undefined reference to `hts_set_fai_filename'
(.text+0xc9): undefined reference to `sam_hdr_read'
(.text+0xe6): undefined reference to `hts_verbose'
(.text+0x12d): undefined reference to `hts_get_format'
(.text+0x15f): undefined reference to `sam_hdr_write'
(.text+0x169): undefined reference to `hts_verbose'
(.text+0x195): undefined reference to `hts_close'
(.text+0x1c5): undefined reference to `hts_close'
/lib64/libbam.a(sam.o): In function `samclose':
(.text+0x1ea): undefined reference to `bam_hdr_destroy'
(.text+0x1f3): undefined reference to `hts_close'
/lib64/libbam.a(sam.o): In function `samfetch':
(.text+0x23a): undefined reference to `bam_init1'
(.text+0x255): undefined reference to `sam_itr_queryi'
(.text+0x279): undefined reference to `hts_itr_next'
(.text+0x28a): undefined reference to `hts_itr_destroy'
(.text+0x293): undefined reference to `bam_destroy1'
/lib64/libbam.a(sam.o): In function `sampileup':
(.text+0x2d6): undefined reference to `bam_init1'
(.text+0x333): undefined reference to `sam_read1'
(.text+0x354): undefined reference to `bam_destroy1'
/lib64/libbam.a(sam.o): In function `samfaipath':
(.text+0x3ed): undefined reference to `hts_verbose'
(.text+0x3f9): undefined reference to `fai_build'
/lib64/libbam.a(bam_plbuf.o): In function `bam_plbuf_reset':
(.text+0x5): undefined reference to `bam_plp_reset'
/lib64/libbam.a(bam_plbuf.o): In function `bam_plbuf_init':
(.text+0x33): undefined reference to `bam_plp_init'
/lib64/libbam.a(bam_plbuf.o): In function `bam_plbuf_destroy':
(.text+0x59): undefined reference to `bam_plp_destroy'
/lib64/libbam.a(bam_plbuf.o): In function `bam_plbuf_push':
(.text+0x95): undefined reference to `bam_plp_push'
(.text+0xd4): undefined reference to `bam_plp_next'
collect2: error: ld returned 1 exit status
make: *** [Makefile:58: SOAPdenovo-63mer] Error 1

Edit 1: Here is my compiler info:

~/git/SOAPdenovo2 $ make -v

GNU Make 4.2.1
Built for x86_64-unknown-linux-gnu
aquaskyline commented 6 years ago

It seems that your compiler is using your own bam library /lib64/libbam.a instead of the one shipped with the code (inc/libbam.a). I have changed the makefile to use the inc/libbam.a one first. Please download the code and try again.

michaelgruenstaeudl commented 6 years ago

Thanks for your assistance. I downloaded the updated code again and attempted to re-compile. However, a different error occurs during compilation now:

$ make
pregraph_sparse_63mer.v1.0.3 cleaning done.                         
pregraph_sparse_63mer.v1.0.3 objects generated.                    
SOAPdenovo-63mer cleaning done.                              
SOAPdenovo-63mer objects generated.                                
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(bam.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(bam_import.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(sam.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(bam_pileup.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(faidx.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(knetfile.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(sam_header.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(bgzf.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(kstring.o): relocation R_X86_64_32 against `.text' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(bam_aux.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(razf.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
make: *** [Makefile:58: SOAPdenovo-63mer] Error 1
aquaskyline commented 6 years ago

Would you please try compiling the samtools 0.1.19 locally and copy the compiled libbam.a file to the two inc/ folders in SOAPdenovo's source code. You can find samtools 0.1.19's source code at https://sourceforge.net/projects/samtools/files/samtools/0.1.19/.

michaelgruenstaeudl commented 6 years ago

I followed your instructions (local compilation of samtools 0.1.19, followed by copying of libbam.a file to the two inc/ folders) and was able to compile SOAPdenovo2 correctly. Thanks for your assistance.

elvenwhite commented 5 years ago

Under Ubuntu 18.04 LTS, the error persists even if with locally compiled libbam.a. (I haven't had any problem under Ubuntu 14.04 LTS though) Here's result with local libbam.a :

pregraph_sparse_63mer.v1.0.3 cleaning done.
pregraph_sparse_63mer.v1.0.3 objects generated.
SOAPdenovo-63mer cleaning done.
SOAPdenovo-63mer objects generated.
sparsePregraph/io_func.o: In function `read1seqbam(char*, char*, int, samfile_t*, int*) [clone .constprop.58]':
io_func.cpp:(.text+0x47): undefined reference to `samread'
io_func.cpp:(.text+0xe2): undefined reference to `bam_format1_core'
sparsePregraph/io_func.o: In function `read1seqbam(char*, char*, int, samfile_t*, int*)':
io_func.cpp:(.text+0x66a): undefined reference to `samread'
io_func.cpp:(.text+0x70a): undefined reference to `bam_format1_core'
standardPregraph/readseq1by1.o: In function `read1seqbam':
readseq1by1.c:(.text+0xac7): undefined reference to `samread'
readseq1by1.c:(.text+0xaec): undefined reference to `bam_format1_core'
./sparsePregraph/inc/libbam.a(sam.o): In function `samthreads':
/home/yisoo/samtools-1.9/sam.c:35: undefined reference to `hts_get_format'
/home/yisoo/samtools-1.9/sam.c:36: undefined reference to `bgzf_mt'
./sparsePregraph/inc/libbam.a(sam.o): In function `samopen':
/home/yisoo/samtools-1.9/sam.c:43: undefined reference to `hts_open'
/home/yisoo/samtools-1.9/sam.c:55: undefined reference to `hts_set_fai_filename'
/home/yisoo/samtools-1.9/sam.c:61: undefined reference to `sam_hdr_read'
/home/yisoo/samtools-1.9/sam.c:68: undefined reference to `hts_verbose'
/home/yisoo/samtools-1.9/sam.c:72: undefined reference to `hts_get_format'
/home/yisoo/samtools-1.9/sam.c:76: undefined reference to `sam_hdr_write'
/home/yisoo/samtools-1.9/sam.c:77: undefined reference to `hts_verbose'
/home/yisoo/samtools-1.9/sam.c:79: undefined reference to `hts_close'
/home/yisoo/samtools-1.9/sam.c:48: undefined reference to `hts_close'
./sparsePregraph/inc/libbam.a(sam.o): In function `samclose':
/home/yisoo/samtools-1.9/sam.c:92: undefined reference to `bam_hdr_destroy'
/home/yisoo/samtools-1.9/sam.c:93: undefined reference to `hts_close'
./sparsePregraph/inc/libbam.a(sam.o): In function `samfetch':
/home/yisoo/samtools-1.9/sam.c:100: undefined reference to `bam_init1'
/home/yisoo/samtools-1.9/sam.c:101: undefined reference to `sam_itr_queryi'
/home/yisoo/samtools-1.9/sam.c:103: undefined reference to `hts_itr_next'
/home/yisoo/samtools-1.9/sam.c:104: undefined reference to `hts_itr_destroy'
/home/yisoo/samtools-1.9/sam.c:105: undefined reference to `bam_destroy1'
./sparsePregraph/inc/libbam.a(sam.o): In function `sampileup':
/home/yisoo/samtools-1.9/sam.c:114: undefined reference to `bam_init1'
./sparsePregraph/inc/libbam.a(sam.o): In function `samread':
/home/yisoo/samtools-1.9/sam.h:95: undefined reference to `sam_read1'
./sparsePregraph/inc/libbam.a(sam.o): In function `sampileup':
/home/yisoo/samtools-1.9/sam.c:125: undefined reference to `bam_destroy1'
./sparsePregraph/inc/libbam.a(sam.o): In function `samfaipath':
/home/yisoo/samtools-1.9/sam.c:139: undefined reference to `hts_verbose'
/home/yisoo/samtools-1.9/sam.c:140: undefined reference to `fai_build'
./sparsePregraph/inc/libbam.a(bam_plbuf.o): In function `bam_plbuf_init':
/home/yisoo/samtools-1.9/bam_plbuf.c:47: undefined reference to `bam_plp_init'
./sparsePregraph/inc/libbam.a(bam_plbuf.o): In function `bam_plbuf_destroy':
/home/yisoo/samtools-1.9/bam_plbuf.c:55: undefined reference to `bam_plp_destroy'
./sparsePregraph/inc/libbam.a(bam_plbuf.o): In function `bam_plbuf_push':
/home/yisoo/samtools-1.9/bam_plbuf.c:63: undefined reference to `bam_plp_push'
/home/yisoo/samtools-1.9/bam_plbuf.c:65: undefined reference to `bam_plp_next'
./sparsePregraph/inc/libbam.a(bam_plbuf.o): In function `bam_plbuf_reset':
/home/yisoo/samtools-1.9/bam_plbuf.c:40: undefined reference to `bam_plp_reset'
collect2: error: ld returned 1 exit status
Makefile:56: recipe for target 'SOAPdenovo-63mer' failed
make: *** [SOAPdenovo-63mer] Error 1

and with shipped libbam.a :


pregraph_sparse_63mer.v1.0.3 objects generated.
SOAPdenovo-63mer cleaning done.
SOAPdenovo-63mer objects generated.
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(bam.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(bam_import.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(sam.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(bam_pileup.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(faidx.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(knetfile.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(sam_header.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(bgzf.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(kstring.o): relocation R_X86_64_32 against `.text' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(bam_aux.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: ./sparsePregraph/inc/libbam.a(razf.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
Makefile:56: recipe for target 'SOAPdenovo-63mer' failed
make: *** [SOAPdenovo-63mer] Error 1```
aquaskyline commented 5 years ago

Please use samtools 0.1.19.

On Mon, May 20, 2019 at 5:19 PM elvenwhite notifications@github.com wrote:

Under Linux 18.04, the error persists even if with locally compiled libbam.a. Here's result with local libbam.a : pregraph_sparse_63mer.v1.0.3 cleaning done. pregraph_sparse_63mer.v1.0.3 objects generated. SOAPdenovo-63mer cleaning done. SOAPdenovo-63mer objects generated. sparsePregraph/io_func.o: In function read1seqbam(char, char, int, samfile_t, int) [clone .constprop.58]': io_func.cpp:(.text+0x47): undefined reference to samread' io_func.cpp:(.text+0xe2): undefined reference to bam_format1_core' sparsePregraph/io_func.o: In function read1seqbam(char, char, int, samfile_t, int)': io_func.cpp:(.text+0x66a): undefined reference to samread' io_func.cpp:(.text+0x70a): undefined reference to bam_format1_core' standardPregraph/readseq1by1.o: In function read1seqbam': readseq1by1.c:(.text+0xac7): undefined reference to samread' readseq1by1.c:(.text+0xaec): undefined reference to bam_format1_core' ./sparsePregraph/inc/libbam.a(sam.o): In function samthreads': /home/yisoo/samtools-1.9/sam.c:35: undefined reference to hts_get_format' /home/yisoo/samtools-1.9/sam.c:36: undefined reference to bgzf_mt' ./sparsePregraph/inc/libbam.a(sam.o): In function samopen': /home/yisoo/samtools-1.9/sam.c:43: undefined reference to hts_open' /home/yisoo/samtools-1.9/sam.c:55: undefined reference to hts_set_fai_filename' /home/yisoo/samtools-1.9/sam.c:61: undefined reference to sam_hdr_read' /home/yisoo/samtools-1.9/sam.c:68: undefined reference to hts_verbose' /home/yisoo/samtools-1.9/sam.c:72: undefined reference to hts_get_format' /home/yisoo/samtools-1.9/sam.c:76: undefined reference to sam_hdr_write' /home/yisoo/samtools-1.9/sam.c:77: undefined reference to hts_verbose' /home/yisoo/samtools-1.9/sam.c:79: undefined reference to hts_close' /home/yisoo/samtools-1.9/sam.c:48: undefined reference to hts_close' ./sparsePregraph/inc/libbam.a(sam.o): In function samclose': /home/yisoo/samtools-1.9/sam.c:92: undefined reference to bam_hdr_destroy' /home/yisoo/samtools-1.9/sam.c:93: undefined reference to hts_close' ./sparsePregraph/inc/libbam.a(sam.o): In function samfetch': /home/yisoo/samtools-1.9/sam.c:100: undefined reference to bam_init1' /home/yisoo/samtools-1.9/sam.c:101: undefined reference to sam_itr_queryi' /home/yisoo/samtools-1.9/sam.c:103: undefined reference to hts_itr_next' /home/yisoo/samtools-1.9/sam.c:104: undefined reference to hts_itr_destroy' /home/yisoo/samtools-1.9/sam.c:105: undefined reference to bam_destroy1' ./sparsePregraph/inc/libbam.a(sam.o): In function sampileup': /home/yisoo/samtools-1.9/sam.c:114: undefined reference to bam_init1' ./sparsePregraph/inc/libbam.a(sam.o): In function samread': /home/yisoo/samtools-1.9/sam.h:95: undefined reference to sam_read1' ./sparsePregraph/inc/libbam.a(sam.o): In function sampileup': /home/yisoo/samtools-1.9/sam.c:125: undefined reference to bam_destroy1' ./sparsePregraph/inc/libbam.a(sam.o): In function samfaipath': /home/yisoo/samtools-1.9/sam.c:139: undefined reference to hts_verbose' /home/yisoo/samtools-1.9/sam.c:140: undefined reference to fai_build' ./sparsePregraph/inc/libbam.a(bam_plbuf.o): In function bam_plbuf_init': /home/yisoo/samtools-1.9/bam_plbuf.c:47: undefined reference to bam_plp_init' ./sparsePregraph/inc/libbam.a(bam_plbuf.o): In function bam_plbuf_destroy': /home/yisoo/samtools-1.9/bam_plbuf.c:55: undefined reference to bam_plp_destroy' ./sparsePregraph/inc/libbam.a(bam_plbuf.o): In function bam_plbuf_push': /home/yisoo/samtools-1.9/bam_plbuf.c:63: undefined reference to bam_plp_push' /home/yisoo/samtools-1.9/bam_plbuf.c:65: undefined reference to bam_plp_next' ./sparsePregraph/inc/libbam.a(bam_plbuf.o): In function bam_plbuf_reset': /home/yisoo/samtools-1.9/bam_plbuf.c:40: undefined reference to bam_plp_reset' collect2: error: ld returned 1 exit status Makefile:56: recipe for target 'SOAPdenovo-63mer' failed make: *** [SOAPdenovo-63mer] Error 1`

and with shipped libbam.a : pregraph_sparse_63mer.v1.0.3 cleaning done. pregraph_sparse_63mer.v1.0.3 objects generated. SOAPdenovo-63mer cleaning done. SOAPdenovo-63mer objects generated. /usr/bin/ld: ./sparsePregraph/inc/libbam.a(bam.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: ./sparsePregraph/inc/libbam.a(bam_import.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: ./sparsePregraph/inc/libbam.a(sam.o): relocation R_X86_64_32 against .rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: ./sparsePregraph/inc/libbam.a(bam_pileup.o): relocation R_X86_64_32 against .rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: ./sparsePregraph/inc/libbam.a(faidx.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: ./sparsePregraph/inc/libbam.a(knetfile.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: ./sparsePregraph/inc/libbam.a(sam_header.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: ./sparsePregraph/inc/libbam.a(bgzf.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: ./sparsePregraph/inc/libbam.a(kstring.o): relocation R_X86_64_32 against .text' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: ./sparsePregraph/inc/libbam.a(bam_aux.o): relocation R_X86_64_32S against .rodata' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: ./sparsePregraph/inc/libbam.a(razf.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: final link failed: Nonrepresentable section on output collect2: error: ld returned 1 exit status Makefile:56: recipe for target 'SOAPdenovo-63mer' failed make: *** [SOAPdenovo-63mer] Error 1`

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/aquaskyline/SOAPdenovo2/issues/39?email_source=notifications&email_token=AAG2SOJDKSXZ5Q23D4KD54TPWJUL5A5CNFSM4EW33ZUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVYGRGQ#issuecomment-493906074, or mute the thread https://github.com/notifications/unsubscribe-auth/AAG2SOJKSBRLWRXEACK77UDPWJUL5ANCNFSM4EW33ZUA .

-- Laurent