How can I compile an autotools project with statically related dependencies?

There is an open source library that I want to use. Since I want to distribute my software as a binary package, I do not want the library to have dependencies on other libraries, so I need to link the dependencies statically.

Now that the library is open source and there are no pre-installed binaries, I compile it myself. The library uses autotools, and I did not find any useful documentation on how to bind dependencies statically. I tried calling configure script with --enable-static, but this apparently only tells configure to compile the static version of the library, but I need a dynamic library that includes all the libraries it depends on.

So, I need a way to either tell configure to link to the dependencies, or a way to publish the built-in library to include all the dependencies. Can someone tell me how to do this?

Oh, and if that matters: I'm on the 64-bit Snow Leopard.

+3
source share
2 answers

Having recently walked this path, I discovered that, unfortunately, static libraries do not actually work this way.

When you create a static binary executable, the linker looks at all the functions that it needs, and then it looks at the list of provided libraries and extracts the code for each necessary function.

, , ( ar, , zip), .a, ( "A" "".) , , , . " ", .

, , () - , , , .

, , , , , . , pkg-config, ( ) , , .

, , , . , , , . GPL, , , GPL, , , .

+2

.a , Makefile.am .

yourproject_LDADD =  libxxx.a
+2

Source: https://habr.com/ru/post/1746699/


All Articles