Opened 8 years ago

Closed 8 years ago

#733 closed defect (fixed)

build failure with static libbam

Reported by: Peter Owned by: Peter
Priority: critical Milestone: yat 0.10.1
Component: build Version: 0.10
Keywords: Cc:


I get the following error message when trying to build yat

make[1]: Entering directory `/home/peterJo/projects/osd/_yat'
  CXXLD    yat/
/usr/bin/ld: /home/peterJo/local/lib/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
/home/peterJo/local/lib/libbam.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[1]: *** [yat/] Error 1

Compiling works fine but creating libyat fails. I suspect it is because I only have libbam as static library on this system. I suspect that is not very uncommon because if building yourself samtools Makefile does not create any as part of 'make all'.

Change History (7)

comment:1 Changed 8 years ago by Peter

If I configure --disable-shared everything works including the test suite, but obviously I have no created.

comment:2 Changed 8 years ago by Peter

Owner: changed from Jari Häkkinen to Peter
Status: newassigned

comment:3 Changed 8 years ago by Peter

We could skip -lbam when creating which would solve the problem, but that means -lbam is not added as which implies the users linking against must add -lbam explicitly. One could use libtool's -R switch to at least add -lbam into And -lbam should of course be listed in yat-config and YAT_CHECK_YAT just as now.

I've posted a question to libtool to see if they've got anything wise to say about this situation (mail)

comment:4 Changed 8 years ago by Peter

ticket #737 has been marked as spin off

comment:5 in reply to:  description Changed 8 years ago by Jari Häkkinen

Replying to peter: A work around is to compile samtools with flag -fPIC. I encountered the same problem on my machines and did not consider it to be a yat problem. I think samtools should proved a proper library and using -fPIC does that.

comment:6 Changed 8 years ago by Peter

The Makefile in samtools has rules to build and libbam.dylib, but they are not included in 'make all' and I have only utilized the rule on my desktop. I agree samtools should fix their Makefile and/or packagers should install (perhaps already?). But in the meantime, I think it should be smooth to build, install, and use yat. If no objections, I therefore plan to remove -lbam (and -lz?) when building, just like we don't mention -lcblas. It implies users have to link against -lbam when building binaries that link against -lyat. Not optimal but only a problem if you link manually against -lyat; if you use yat-config, you won't even notice that I've removed -lbam from A better solution requires more extensive surgery and better be done in trunk (see #737).

comment:7 Changed 8 years ago by Peter

Resolution: fixed
Status: assignedclosed

(In [2954]) fixes #733 and #736. Do not link -lbam into, but do mention it in yat-config and yat.pc. Also mention -lz in yat.pc (#736)

Note: See TracTickets for help on using tickets.