A undefined symbol problem when using several shared libraries.

Y

yhyun.kim

Hi, I'm Kent.

Let's get to the point.

To do system test easily, I made some lua wrappers for our legacy
system with SWIG. And also I wanted to theses things to be pluggable.
So I made them as several shared libraries. After I got everything to
test a whole system, I had a undefined symbol problem.

As I said before, there were several shared libraries, such as lua
script engine and some lua wrappers for our legacy system. In my test
app, I loaded lua script engine first and ran it. After that I typed
some lua command to load lua wrappers and got a undefined symbol
problem.

The problem was that a lua wrapper couldn't find the symbol, for
example "lua_getmetatable" function in lua core apis. This
"lua_getmetatable" function already exist in lua script engine shared
library, I checked it with nm, and this library had been already
loaded by my test app. Which means my test app can see all the symbols
of lua core apis. So I thought lua wrappers can find the symbols to be
needed by themselves after they are loaded by my test app. Hoever,
it's not working.

Why? I really don't know. Can anybody help me?

Thanks in advance.
Kent.
 
A

AnonMail2005

Hi, I'm Kent.

Let's get to the point.

To do system test easily, I made some lua wrappers for our legacy
system with SWIG. And also I wanted to theses things to be pluggable.
So I made them as several shared libraries. After I got everything to
test a whole system, I had a undefined symbol problem.

As I said before, there were several shared libraries, such as lua
script engine and some lua wrappers for our legacy system. In my test
app, I loaded lua script engine first and ran it. After that I typed
some lua command to load lua wrappers and got a undefined symbol
problem.

The problem was that a lua wrapper couldn't find the symbol, for
example "lua_getmetatable" function in lua core apis. This
"lua_getmetatable" function already exist in lua script engine shared
library, I checked it with nm, and this library had been already
loaded by my test app. Which means my test app can see all the symbols
of lua core apis. So I thought lua wrappers can find the symbols to be
needed by themselves after they are loaded by my test app. Hoever,
it's not working.

Why? I really don't know. Can anybody help me?

Thanks in advance.
Kent.

So you're saying you program compiled and linked correctly but it gets
that error when you run it?

If that's the case it could be the environment variable that tells the
OS where to find your libraries at runtime is not set correctly. For
Windows it's the PATH variable, for *nix it's the LD_LIBRARY_PATH
variable.

HTH
 
Y

yhyun.kim

I'm loading these with dlopen and the absolute path, so I don't need
LD_LIBRARY_PATH setting.

The thing is that one shared library already loaded into one
application is trying to access some symbols which exist in another
shared library, like a chain.

Isn't it possible??

Thanks.
 
A

AnonMail2005

I'm loading these with dlopen and the absolute path, so I don't need
LD_LIBRARY_PATH setting.

The thing is that one shared library already loaded into one
application is trying to access some symbols which exist in another
shared library, like a chain.

Isn't it possible??

Thanks.

But what about the libraries that the library you are loading with
dlopen depend on?
How are those found? Check the return code of your dlopen command.
Also, I seem to recall that dlopen has a "lazy load" option. So it
could return successfully but then fail later when the library it
actually used.

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top