Re: dlopened lookup modules not linked against respective libraries

Jeremy Harris via Exim-users <[email protected]> Fri, 12 Dec 2025 17:09:09 +0000
Newsgroups gmane.mail.exim.user
Message-ID <[email protected]>
On 2025/12/12 3:28 PM, Andreas Metzler via Exim-users wrote:
> I have been playing around with dlopened lookups modules, but they do
> not end up being linked against the respective library:
> 
> make[2]: Entering directory '/tmp/EXIM4/exim4/build-Linux-x86_64/lookups'
> cc -shared sqlite.c
> cc  -lsqlite3  -DDYNLOOKUP -shared -rdynamic -fPIC -O -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/usr/include/p11-kit-1  -I/usr/include/p11-kit-1    sqlite.c -o sqlite.so

Even after re-ordering that cmdline I get "NEEDED" items.


My test build:

$ make FULLECHO=''
cc -shared sqlite.c
cc -DDYNLOOKUP -shared -rdynamic -fPIC -O -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Werror=implicit-function-declaration -Wmaybe-uninitialized -Wunused-value -fPIC -Wpointer-sign  -DDYNLOOKUP -shared -rdynamic -fPIC -O -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Werror=implicit-function-declaration -Wmaybe-uninitialized -Wunused-value -fPIC -Wpointer-sign   sqlite.c -lsqlite3 -o sqlite.so
[...]
$ objdump -p ./build-Linux-x86_64/dynmodules/sqlite_lookup.so | grep NEEDED
   NEEDED               libsqlite3.so.0
   NEEDED               libc.so.6
$


[ I'm not sure how you managed to *not* get libsqlite3.so needed; any way I tried to
   force that resulted in the testsuite claiming that sqlite was not included - I think
   because the "exim -bV" stage did not show it in the "lookups (dynamic)" section, in
   turn because the modload faied.

   But with that pair of NEEDED items, the testcase for sqlite lookups passes (modulo
   debug output differences related to all the modules I'd built).
]


So, while I'm not averse to shuffling that line for style, I think it has no effect.

-- 
Cheers,
   Jeremy

-- 
## subscription configuration (requires account):
##   https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
##   [email protected]
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/