This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Newbie question] compilation,, linking and general libbfd/libiberty question

Hi Florian,

$ gcc  -o tbfd tbfd.c /usr/lib/libiberty.a /usr/lib/libbfd.a -liberty
-lbfd -ldl

/usr/lib/libbfd.a(compress.o): In function `bfd_compress_section_contents':
(.text+0x2c): undefined reference to `compressBound'

As you have discovered these symbols are provided by the z compression library, so you need to include -lz on the command line.

Is there any additional introductory material that I could read.

Not really. The sources are the best reference. Although in this particular case perhaps the easiest way to find out what was going wrong would be to use the sources to build the binutils for an arbitrary target (eg configure --target=x86_64-pc-linux-gnu) and then examine the command line used to link in the bfd library when creating an executable.

PS: Sorry for the question, but why is the libiberty no independent
shared object? I read that it has historically and propably organically
grown, but I don't see why this is the reason for libiberty not beeing a
.so for it's own...

Actually it can be built as a shared library - just add "--enable-shared" to the configure command line at the start. It is just a historical thing that the default is a static library.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]