3

I am trying to use the NBIS library from NIST:

http://www.nist.gov/itl/iad/ig/nbis.cfm

NBIS is composed of several different related libraries that they compile into multiple archive files. They give you an option when installing it to install either all of the individual .a files or to bundle them into a single, monolithic .a file. I had been using the multiple library files but decided to try to use the single, monolithic file to make things easier. But I am getting an error when trying to link against it when using -lnbis in my link step (using g++, which uses ld):

libnbis.a: error adding symbols: Archive has no index; run ranlib to add one

Looking at the archive, it contains the other individual .a files:

$ ar t libnbis.a
liban2k.a
libbozorth3.a
libcblas.a
... and so forth

The line in the Makefile that generates the archive is: $(AR) -ru libnbis.a *.a

I have tried running ranlib libnbis.a and that does not modify it.

So, my question is: How can I link to the NBIS library? I know which individual libraries inside the libnbis.a file I need to link to if I need that. Will it work this way? Or are NIST doing something wrong trying to merge their individual libraries into one archive file?

I have tried searching around to find similar problems and it seems like the answer to the above is that they are doing it wrong. For instance, answers to this question suggest unpacking the individual .a files and repacking the .o files into the conglomerate archive:

How to merge two "ar" static libraries into one

There is also a comment suggesting using libtool:

https://stackoverflow.com/a/8170851/196561

So it looks like I have a couple options if I want to build the libnbis.a file myself. I just wanted to make sure there was not some way to use the .a files in the archive as-is before I do that.

Community
  • 1
  • 1
plasmoidia
  • 604
  • 6
  • 15

0 Answers0