Unix Programming - dlopen error

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > May 2007 > dlopen 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 dlopen error
Marialisa.Raucci@gmail.com

2007-05-25, 1:19 pm

hi

I've tried to open a library with che following codes:

void *h=dlopen(c_path.c_str(),RTLD_NOW);
the path it's correct.

the library is compiled using the following Makefile.am

AM_CPPFLAGS = -I${top_srcdir}/src -I.

lib_LTLIBRARIES = libgal.la

libgal_la_SOURCES = st_gal.cc
libgal_la_LDFLAGS = -lga -L/home/minerva/stshell/galib247/ga -avoid-
version -lstdc++

BUT when I load the library I get this error:

.../../build/lib/libgal.so: undefined symbol:
_ZneI22st_list_const_iteratorEiRKT_S3_
even If I add -rdynamic in the main executables (as suggested by
many) I get the same error.
Thanks for your time, and I really appreciate any advice offered.

Frank Cusack

2007-05-25, 1:19 pm

On 25 May 2007 09:46:42 -0700 Marialisa.Raucci@gmail.com wrote:
> hi
>
> I've tried to open a library with che following codes:
>
> void *h=dlopen(c_path.c_str(),RTLD_NOW);
> the path it's correct.
>
> the library is compiled using the following Makefile.am
>
> AM_CPPFLAGS = -I${top_srcdir}/src -I.
>
> lib_LTLIBRARIES = libgal.la
>
> libgal_la_SOURCES = st_gal.cc
> libgal_la_LDFLAGS = -lga -L/home/minerva/stshell/galib247/ga -avoid-
> version -lstdc++
>
> BUT when I load the library I get this error:
>
> ../../build/lib/libgal.so: undefined symbol:
> _ZneI22st_list_const_iteratorEiRKT_S3_
> even If I add -rdynamic in the main executables (as suggested by
> many) I get the same error.
> Thanks for your time, and I really appreciate any advice offered.


At a glance, this doesn't seem to me to have anything to do with
dlopen() but rather with the c_str() method.

But it could be something as simple as: you did not include any
headers (normally you'd need dlfcn.h) and did not link against libdl.
But the error seems to suggest a problem with the String class.
Maybe the stdc++ library you're linking against is problematic.

-frank
Ulrich Eckhardt

2007-05-25, 7:18 pm

Marialisa.Raucci@gmail.com wrote:
> void *h=dlopen(c_path.c_str(),RTLD_NOW);
> the path it's correct.


Please try hardcoding it, just to avoid any mistakes in that part.


> libgal_la_LDFLAGS = -lga -L/home/minerva/stshell/galib247/ga -avoid-
> version -lstdc++

^^^^^^^^
Don't do that. Use g++ for linking C++ code, it knows pretty well which
things it needs to link with.

> BUT when I load the library I get this error:
>
> ../../build/lib/libgal.so: undefined symbol:
> _ZneI22st_list_const_iteratorEiRKT_S3_
> even If I add -rdynamic in the main executables (as suggested by
> many) I get the same error.


- Are all libraries in a position they can be found by the runtime linker?
- Can you link against the library directly instead of loading it via
dlopen()?
- Other than Frank, I don't think it has anything to do with the c_str()
call, as it rather complains about some 'list_const_iterator'. However, it
is one possible point of failure, thus try removing it.

Uli

Gianni Mariani

2007-05-26, 7:23 pm

Marialisa.Raucci@gmail.com wrote:
> hi
>
> I've tried to open a library with che following codes:
>
> void *h=dlopen(c_path.c_str(),RTLD_NOW);
> the path it's correct.
>
> the library is compiled using the following Makefile.am
>
> AM_CPPFLAGS = -I${top_srcdir}/src -I.
>
> lib_LTLIBRARIES = libgal.la
>
> libgal_la_SOURCES = st_gal.cc
> libgal_la_LDFLAGS = -lga -L/home/minerva/stshell/galib247/ga -avoid-
> version -lstdc++
>
> BUT when I load the library I get this error:
>
> ../../build/lib/libgal.so: undefined symbol:
> _ZneI22st_list_const_iteratorEiRKT_S3_
> even If I add -rdynamic in the main executables (as suggested by
> many) I get the same error.
> Thanks for your time, and I really appreciate any advice offered.
>


c++filt _ZneI22st_list_const_iteratorEiRKT_S3_


int operator!=<st_list_const_iterator>(st_list_const_iterator const&,
st_list_const_iterator const&)


It appears that a global "operator !=" template is undefined.

If you have one of these templates in your headers somewhere, it may be
the problem.

template <typename T>
int operator!=( const T &, const T & );
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com