Is it possible to link some — but not all — libraries statically with libtool?

After some research I have answered my own question.

Up vote 2 down vote favorite share g+ share fb share tw.

I am working on a project which is built using autoconf, automake and libtool. The project is distributed in both binary and source form. On Linux, by default the build script links to all libraries dynamically.

This makes sense since Linux users can rely on their distribution’s package manager to handle dependencies. On Windows, by default the build script links to all libraries statically using libtool’s -all-static option. This makes sense since none of the dependencies are provided with Windows, and it’s helpful to be able to distribute a single binary containing all dependencies rather than mucking about distributing tons of DLLs.

On OSX, some of the dependencies are provided by the OS, and some are not. Therefore it would be helpful to link to the OS-provided libraries dynamically and to the other libraries statically. Unfortunately libtool’s all-or-nothing -all-static option is not helpful here.

Is there a good way to get libtool to link to some libraries statically, but not all? Note: I realise I could carefully compile the dependencies so that only static builds are available. However, I’d rather the build system for my project were robust in the common case of static and dynamic builds of dependencies being available.

Note: Of course, I am not concerned with really low level dependencies like the C/C++ runtime libraries, which are always linked dynamically on all three of the above platforms. Libtool link|improve this question asked Dec 22 '09 at 2:13Daniel Cassidy2,312824 91% accept rate.

After some research I have answered my own question. If you have static and dynamic builds of a library installed, and you link to that library using the -l parameter, libtool links by preference to the dynamic build. It links to a static build if there is no dynamic build available, or if you pass the -static or -all-static options.

Libtool can be forced to link to the static library by giving the full path to that library in place of the -l option.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions