1

I need to build a static library to create a binary. I am using ubuntu 15.04 and I need libdevmapper static library. I am sorry I couldn't be more clear as I have absolutely no clue how to do that. I installed libdevmapper-dev, it only installs .so not .la. Any pointers on how can I do it?

Thanks.

  • Find where the libdevmapper.so is linked to your application. There should be something like `-ldevmapper`. replace that with `-Bstatic -ldevmapper` – Milind Dumbare Feb 27 '15 at 11:38
  • Get a copy of libdevmapper.tar.bz2. Run dist/configure with option --disable-shared. Pray. – William Pursell Feb 27 '15 at 11:44
  • Download the LVM sources https://www.sourceware.org/lvm2/ `git clone http://git.fedorahosted.org/git/lvm2.git` $ cd lvm2 $ ./configure --enable-static_link --prefix=$PWD/build/ $ make device-mapper Find the libdevmapper.a in `lvm2/libdm/ioctl/` – Milind Dumbare Feb 27 '15 at 12:24

1 Answers1

0

You might first want to take a look at this tutorial to get some idea about static libraries.

First you need to create your object code from your source file.

gcc -Wall -c test1.c test2.c

Then you need to use the ar command to generate the library file.

ar -cvq libtest.a test1.o test2.o
Ayan
  • 797
  • 1
  • 11
  • 18