vibansal / crisp

Code for multi-sample variant calling from sequence data of pooled or unpooled DNA samples
MIT License
19 stars 8 forks source link

compilation error in ubuntu #7

Closed IgnasiLucas closed 5 years ago

IgnasiLucas commented 5 years ago

During compilation, I got the output shown below. I searched the error in the forums and found this question, which suggested that my gcc was trying to make Position Independent Executables. After adding the option -no-pie to the Makefiles, the compilation worked. But I don't know if that's a good idea.

This was the original output, with some warnings and errors:

make -C samtools all 
make[1]: Entering directory '/path/to/crisp/samtools'
make[2]: Entering directory '/path/to/crisp/samtools'
gcc -c -g -Wall -O2  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam.c -o bam.o
gcc -c -g -Wall -O2  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_import.c -o bam_import.o
gcc -c -g -Wall -O2  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_index.c -o bam_index.o
bam_index.c: In function ‘bam_index_load_core’:
bam_index.c:330:2: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  fread(magic, 1, 4, fp);
  ^~~~~~~~~~~~~~~~~~~~~~
bam_index.c:337:2: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  fread(&idx->n, 4, 1, fp);
  ^~~~~~~~~~~~~~~~~~~~~~~~
bam_index.c:350:3: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
   fread(&size, 4, 1, fp);
   ^~~~~~~~~~~~~~~~~~~~~~
bam_index.c:353:4: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
    fread(&key, 4, 1, fp);
    ^~~~~~~~~~~~~~~~~~~~~
bam_index.c:357:4: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
    fread(&p->n, 4, 1, fp);
    ^~~~~~~~~~~~~~~~~~~~~~
bam_index.c:361:4: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
    fread(p->list, 16, p->n, fp);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
bam_index.c:371:3: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
   fread(&index2->n, 4, 1, fp);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
bam_index.c:375:3: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
   fread(index2->offset, index2->n, 8, fp);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -c -g -Wall -O2  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_pileup.c -o bam_pileup.o
bam_pileup.c: In function ‘resolve_cigar2’:
bam_pileup.c:75:9: warning: variable ‘is_head’ set but not used [-Wunused-but-set-variable]
  int k, is_head = 0;
         ^~~~~~~
gcc -c -g -Wall -O2  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_lpileup.c -o bam_lpileup.o
gcc -c -g -Wall -O2  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_md.c -o bam_md.o
gcc -c -g -Wall -O2  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=1 -I. faidx.c -o faidx.o
faidx.c: In function ‘fai_load’:
faidx.c:277:5: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
     else
     ^~~~
faidx.c:280:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
  if (fp == 0) {
  ^~
gcc -c -g -Wall -O2  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_sort.c -o bam_sort.o
In file included from bam_sort.c:9:0:
bam_sort.c:309:26: warning: ‘bam1_lt’ is static but used in inline function ‘__ks_insertsort_sort’ which is not static
 KSORT_INIT(sort, bam1_p, bam1_lt)
                          ^
ksort.h:148:25: note: in definition of macro ‘KSORT_INIT’
    for (j = i; j > s && __sort_lt(*j, *(j-1)); --j) {   \
                         ^~~~~~~~~
bam_sort.c:53:27: warning: ‘heap_lt’ is static but used in inline function ‘__ks_insertsort_heap’ which is not static
 KSORT_INIT(heap, heap1_t, heap_lt)
                           ^
ksort.h:148:25: note: in definition of macro ‘KSORT_INIT’
    for (j = i; j > s && __sort_lt(*j, *(j-1)); --j) {   \
                         ^~~~~~~~~
ar -csru libbam.a bgzf.o kstring.o bam_aux.o bam.o bam_import.o sam.o bam_index.o bam_pileup.o bam_lpileup.o bam_md.o razf.o faidx.o bedidx.o knetfile.o bam_sort.o sam_header.o bam_reheader.o kprobaln.o bam_cat.o
ar: `u' modifier ignored since `D' is the default (see `U')
make[2]: Leaving directory '/path/to/crisp/samtools'
make[2]: Entering directory '/path/to/crisp/samtools/bcftools'
make[2]: Nothing to be done for 'lib'.
make[2]: Leaving directory '/path/to/crisp/samtools/bcftools'
make[2]: Entering directory '/path/to/crisp/samtools/misc'
make[2]: Nothing to be done for 'lib'.
make[2]: Leaving directory '/path/to/crisp/samtools/misc'
gcc -c -g -Wall -O2  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_tview.c -o bam_tview.o
gcc -c -g -Wall -O2  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_plcmd.c -o bam_plcmd.o
gcc -c -g -Wall -O2  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam2bcf.c -o bam2bcf.o
gcc -g -Wall -O2  -o samtools bam_tview.o bam_plcmd.o sam_view.o bam_rmdup.o bam_rmdupse.o bam_mate.o bam_stat.o bam_color.o bamtk.o kaln.o bam2bcf.o bam2bcf_indel.o errmod.o sample.o cut_target.o phase.o bam2depth.o -Lbcftools  libbam.a -lbcf -lcurses  -lm -lz
/usr/bin/ld: sam_view.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: bam_rmdup.o: relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: bam_rmdupse.o: relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: bam_mate.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: bam_stat.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: bam_color.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: bamtk.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: bam2bcf_indel.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: sample.o: relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: cut_target.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: phase.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: bam2depth.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: libbam.a(bgzf.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: 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: libbam.a(sam.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: libbam.a(bedidx.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: 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: 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: libbam.a(bam_reheader.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: libbam.a(kprobaln.o): relocation R_X86_64_32S against `.bss' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: libbam.a(bam_cat.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: libbam.a(razf.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: bcftools/libbcf.a(bcf.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: bcftools/libbcf.a(bcfutils.o): relocation R_X86_64_32S against `.rodata' 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:44: recipe for target 'samtools' failed
make[1]: *** [samtools] Error 1
make[1]: Leaving directory '/path/to/crisp/samtools'
Makefile:10: recipe for target 'all' failed
make: *** [all] Error 2
vibansal commented 5 years ago

This has something to do with the version of Ubuntu on your system (PIE is enabled by default). The -no-pie option should be fine.