For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > June 2007 > Re: dlopen: fatal: relocation error









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: dlopen: fatal: relocation error
shahan.am@gmail.com

2007-06-27, 7:08 pm

On Jun 27, 11:57 pm, Frank Cusack <fcus...@fcusack.com> wrote:
> On Wed, 27 Jun 2007 10:59:54 -0700 shahan...@gmail.com wrote:
>
>
>
>
>
>
>
>
>
>
>
> It's not complaining about not finding your global symbol, it's
> complaining about the .so not being dlopen()able at all.
>
> ...
>
>
> That is not what you reported earlier. You are either
> about where this error is being generated, or you are not accurately
> reporting the errors.
>
> It would probably help to PASTE the output from your compilation and
> then running of the program. BTW, did you compile the shared lib with
> -fpic? I don't think that's it because you said it works on x86.
>
> -fran


thanks frank
yes i did compile the .so with -fpic. but didn't work..

this is the exact error message dlerror gives after dlopen fails.

ld.so.1: rexserd: fatal: relocation error: file libmsat.d.so: symbol
_Z11GetLastErrorv: referenced symbol not found

where rexserd is my executable which invoke dlopen

as far as i understand this means it can't find the reference to the
GetLastError function isn't it ?

but the GetLastError function (CError* GetLastError (void)) is defined
in the executable and i even checked its symbols using nm -s rexserd |
grep GetLastError .

[475] | 80912| 40|FUNC |GLOB |0 |.text |
_Z11GetLastErrorv

this is the out put.

so what did actually went wrong..





Frank Cusack

2007-06-27, 7:08 pm

On Wed, 27 Jun 2007 13:34:10 -0700 shahan.am@gmail.com wrote:
> yes i did compile the .so with -fpic. but didn't work..
>
> this is the exact error message dlerror gives after dlopen fails.
>
> ld.so.1: rexserd: fatal: relocation error: file libmsat.d.so: symbol
> _Z11GetLastErrorv: referenced symbol not found
>
> where rexserd is my executable which invoke dlopen
>
> as far as i understand this means it can't find the reference to the
> GetLastError function isn't it ?


Yes. Sorry, I misread your initial report.

> but the GetLastError function (CError* GetLastError (void)) is defined
> in the executable and i even checked its symbols using nm -s rexserd |
> grep GetLastError .
>
> [475] | 80912| 40|FUNC |GLOB |0 |.text |
> _Z11GetLastErrorv
>
> this is the out put.


I thought you were dlopen()'ing the library containing GetLastError()?
This shows that that function is directly in rexserd. So I'm still
slightly .

> so what did actually went wrong..


I think this has problem has exceeded my knowledge. Google turns up

<http://docs.sun.com/app/docs/doc/80...j9vuquit?a=view>
<http://forum.java.sun.com/thread.js...ssageID=9264816>
<http://www.opensolaris.org/jive/thr...essageID=127598>

So, I would try 'ldd -d libmsat.so' which might give something useful,
and 'LD_NODIRECT=1 rexserd' which might help. It would also be
interesting to see exactly how you link libmsat.so.

Did you try linking against libgcc_s?

-frank
Frank Cusack

2007-06-28, 7:08 pm

On Thu, 28 Jun 2007 07:54:44 -0700 shahan.am@gmail.com wrote:
> libstdc++.so.6 (GLIBCXX_3.4) => (version not found)
> libstdc++.so.6 (CXXABI_1.3) => (version not found)

....
> libstdc++.so.6 (CXXABI_1.3) => (version not found)
> libstdc++.so.6 (GLIBCXX_3.4) => (version not found)
> libstdc++.so.6 (GLIBCXX_3.4) => (version not found)
> libstdc++.so.6 (CXXABI_1.3) => (version not found)


There's your problem. You need to set the runpath when you link.
-R for older versions of GNU ld and -runpath (I think) for newer
versions.

-frank
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com