[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lt_dlopen an uninstalled library

From: Bob Friesenhahn
Subject: Re: lt_dlopen an uninstalled library
Date: Tue, 23 Nov 2021 11:31:13 -0600 (CST)
User-agent: Alpine 2.20 (GSO 67 2015-01-07)

On Mon, 22 Nov 2021, ilya Basin wrote:

Hi List.
I'm making a program with plugins as shared libraries and when I run `make 
check` I want my program to load the uninstalled plugins using lt_dlopen().

I expected that passing `-dlopen` to libtool would force the generation of a wrapper script setting the proper LD_LIBRARY_PATH (just like regular linking with a shared .la does). However, an ELF binary is generated and and attempt to call lt_dlopen("") fails with "File not found". It only succeeds if the filename contains "./.libs/". What am I doing wrong?

I am not sure what the correct answer is. Normally loadable modules do not have "lib" prefixes and so normally one does not use a "lib" prefix in conjunction with -module. Use of "lib" prefixes is for shared libraries indended to be linked with using a linker (for software compilation).

When libtool builds shared libraries and modules, it puts them in a ".libs" subdirectory. The ".la" file in the build directory should be enough for libltdl to load the module from the hidden ".libs" subdirectory. When the module is installed, the a new ".la" file is created which is correct for the installed form, and the module may be re-linked while being installed.

Feel free to look at GraphicsMagick ( source code for ideas. GraphicsMagick uses lots of modules and its test suite works without installing the software. It does not use libltdl's static-module "preloaded" feature.

Bob Friesenhahn,
GraphicsMagick Maintainer,
Public Key,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]