Closed michaelgruenstaeudl closed 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.
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
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/.
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.
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```
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
I receive the following error when compiling SOAPdenovo2:
Edit 1: Here is my compiler info: