How to analyse dlopen() failure?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to analyse dlopen() failure?

Federico Giannici
I have a problem with dlopen() that I don't know how to analyse.

Let's start from the beginning. I'm trying to upgrade an old VoIP server
with OpenBSD 5.3 amd64, installing a completely new PC with OpenBSD 5.9
amd64 and reinstalling all the programs there.

The problem is that, EXACTLY the same source (OpenSER 1.1 with some
custom changes) compiles correctly under 5.9 but it's unable to load the
mysql module. The main program loads a few modules compiled as ".so"
loadable modules. All modules are correctly loaded but one, the mysql.so
one.

This is the code that load the modules:

        handle=dlopen(path, RTLD_NOW); /* resolve all symbols now */
        if (handle==0){
                LOG(L_ERR, "ERROR: load_module: could not open module <%s>: %s\n",
                                        path, dlerror() );
                goto error;
        }


And this is the error generated:
Jun 29 17:18:37 eowyn2 openser: ERROR: load_module: could not open
module </usr/local/lib/openser/modules/mysql.so>: Cannot load specified
object


Here is the ldd of the module (I verified that all the libraries listed
here actually do exist):
eowyn2:/home/giannici# ldd /usr/local/lib/openser/modules/mysql.so
/usr/local/lib/openser/modules/mysql.so:
         Start            End              Type Open Ref GrpRef Name
         000005ab5046f000 000005ab50888000 dlib 2    0   0
/usr/local/lib/openser/modules/mysql.so
         000005ab9c012000 000005ab9c43a000 rlib 0    3   0
/usr/lib/libm.so.9.0
         000005ab98016000 000005ab9877d000 rlib 0    1   0
/usr/local/lib/libmysqlclient.so.27.0
         000005ac10636000 000005ac10a4b000 rlib 0    2   0
/usr/lib/libz.so.5.0
         000005abf5656000 000005abf5a68000 rlib 0    2   0
/usr/lib/libpthread.so.20.1
         000005ab6af15000 000005ab6b36f000 rlib 0    1   0
/usr/lib/libssl.so.38.0
         000005abe8370000 000005abe893f000 rlib 0    2   0
/usr/lib/libcrypto.so.37.0
         000005ac1d45c000 000005ac1d972000 rlib 0    1   0
/usr/lib/libstdc++.so.57.0


I repeat that:
1) The same source had no problem under OpenBSD 5.3.
2) All other modules are correctly loaded, only this one give error.

Now, what could be the problem?
How can I find what is the specific problem?
I'd like to have a more specific error instead of "Cannot load specified
object". Is there any way?
Something changed in dlopen() between OpenBSD 5.3 and 5.9?

Thank you for any suggestion.

Reply | Threaded
Open this post in threaded view
|

Re: How to analyse dlopen() failure?

Ted Unangst-6
Federico Giannici wrote:

> Jun 29 17:18:37 eowyn2 openser: ERROR: load_module: could not open
> module </usr/local/lib/openser/modules/mysql.so>: Cannot load specified
> object
>
> I repeat that:
> 1) The same source had no problem under OpenBSD 5.3.
> 2) All other modules are correctly loaded, only this one give error.
>
> Now, what could be the problem?
> How can I find what is the specific problem?
> I'd like to have a more specific error instead of "Cannot load specified
> object". Is there any way?
> Something changed in dlopen() between OpenBSD 5.3 and 5.9?

Probably need to link openser with libpthread. or use
LD_PRELOAD=libpthread.so.

Reply | Threaded
Open this post in threaded view
|

Re: How to analyse dlopen() failure?

Federico Giannici
On 06/29/16 18:58, Ted Unangst wrote:

> Federico Giannici wrote:
>> Jun 29 17:18:37 eowyn2 openser: ERROR: load_module: could not open
>> module </usr/local/lib/openser/modules/mysql.so>: Cannot load specified
>> object
>>
>> I repeat that:
>> 1) The same source had no problem under OpenBSD 5.3.
>> 2) All other modules are correctly loaded, only this one give error.
>>
>> Now, what could be the problem?
>> How can I find what is the specific problem?
>> I'd like to have a more specific error instead of "Cannot load specified
>> object". Is there any way?
>> Something changed in dlopen() between OpenBSD 5.3 and 5.9?
>
> Probably need to link openser with libpthread. or use
> LD_PRELOAD=libpthread.so.


Yes, it was it!
([hidden email] already told me)

Thank you everybody...

Reply | Threaded
Open this post in threaded view
|

Fwd: How to analyse dlopen() failure?

Philip Guenther-2
---------- Forwarded message ----------
From: Philip Guenther <[hidden email]>
Date: Wed, Jun 29, 2016 at 10:36 AM
Subject: Re: How to analyse dlopen() failure?
To: Federico Giannici <[hidden email]>


On Wed, Jun 29, 2016 at 10:31 AM, Federico Giannici
<[hidden email]> wrote:
> On 06/29/16 18:58, Ted Unangst wrote:
...
>> Probably need to link openser with libpthread. or use
>> LD_PRELOAD=libpthread.so.
>
> Yes, it was it!
> ([hidden email] already told me)
>
> Thank you everybody...

Note that this should no longer be necessary in 6.0.


Philip Guenther