[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libltdl problems with C++ library

From: Olivier Boudeville
Subject: Re: libltdl problems with C++ library
Date: Sun, 02 Jul 2006 16:14:49 +0200
User-agent: Mozilla Thunderbird 1.0.8 (X11/20060502)

Hi again,

finally I applied the solution suggested in,
even though it somewhat hinders from switching easily of compiler (it
would be a nice Request For Enhancement if libltdl could manage it
automatically, it seems to be the only big thing lacking for a working
C++ support).

I had to add /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/libstdc++.a to
testCeylanPlugin_LDADD so that all symbols are found. I did not succeed
to use, for the executable, the same libstdc++ library that the Ceylan
library was alreading using.

Here some snippets that may help other people :
if test x$ac_cv_cxx_compiler_gnu = xyes; then
    # Path to the static archive for the Standard Library needed for
plugins :
    CEYLAN_LIBSTDCPLUSPLUS=`$CXX -print-file-name=libstdc++.a`

It does the trick, works quite well according to my tests (from the
plugin, one can use symbols declared in the library and/or in the
Standard C++ Library), and the executable can find the plugin symbols.

The only (significant) drawback is that the executable has to statically
link to the libstdc++, which makes its size increase a lot and may cause
license issues.

Does anybody could give a hint to remove the need of this static linking ?

Thanks in advance,


Olivier Boudeville a écrit :

>Hi everybody,
>I am trying to use libtool and libltdl to develop a C++ library (named
>Ceylan) that provides some services, including plugin support. Despite
>the reading of libltdl documentation and of the autobook, I am facing
>link problems with the unit test (testCeylanPlugin) for plugin support
>(test plugin is, it would need some other services
>provided by, as if the STL symbols could not be found
>despite the various flags :
>creating .libs/testCeylanPluginS.c
>generating symbol list for `testCeylanPlugin'
>extracting global C symbols from
>g++ -g -ggdb -O0 -fno-inline -Wall -Werror -Woverloaded-virtual -W
>-Wfloat-equal -Wundef -Wendif-labels -Wshadow -Wpointer-arith
>-Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare
>-Wmissing-format-attribute -Wpacked -Wredundant-decls
>-Wno-unused-parameter -ansi -pedantic-errors -o .libs/testCeylanPlugin
>.libs/testCeylanPluginS.o testCeylanPlugin.o -Wl,--export-dynamic 
>-L/home/sye/tmp-Ceylan-test-install/lib -L/usr/i686-pc-linux-gnu/bin
>/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/ -lm -lgcc_s -lc
>/home/sye/tmp-Ceylan-test-install/lib/ -ldl -lpthread
>-Wl,--rpath -Wl,/home/sye/tmp-Ceylan-test-install/lib
>.libs/testCeylanPluginS.o:(.rodata+0x3044): undefined reference to
>`std::_Base_bitset<(unsigned)1>::_M_do_find_next(unsigned, unsigned) const'
>.libs/testCeylanPluginS.o:(.rodata+0x304c): undefined reference to
>`std::_Base_bitset<(unsigned)1>::_M_do_find_first(unsigned) const'  
>.libs/testCeylanPluginS.o:(.rodata+0x30c4): undefined reference to
>.libs/testCeylanPluginS.o:(.rodata+0x3314): undefined reference to
>.libs/testCeylanPluginS.o:(.rodata+0x331c): undefined reference to
>(one thing I do not understand is why
>"/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/" is specified
>this way, I would have expected
>"-L/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6 -lstdc++"; I tried to run
>that command manually but the link error remained)
>In I have indeed
>but libtool says :
>*** Warning: Linking the executable testCeylanPlugin against the
>loadable module
>*** is not portable!
>libtool: link: warning: `AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen
>In my I have :
>testCeylanPlugin_SOURCES   =
>testCeylanPlugin_LDFLAGS = -export-dynamic -no-undefined -dlpreopen
>force -dlopen self -dlopen
>testCeylanPlugin_LDADD   = $(LIBLTDL)
>testCeylanPlugin_DEPENDENCIES = $(LIBLTDL)
>ceylan_test_plugin_la_SOURCES =
>ceylan_test_plugin_la_LDFLAGS = -no-undefined -module -avoid-version
>I tried various combinations (specifying convenience/installable
>libltdl, declaring the plugin with extern "C", using a pure-C plugin,
>playing with the numerous link options in with no luck for
>the moment.
>Does anybody have a clue, or know the proper way to set up this ?
>Thanks in advance,
>PS: the desired layout would be : libCeylan (which is C++) can load any
>plug-in, including C++ ones, including plug-in needing some services
>provided by libCeylan and the STL

Olivier Boudeville
18, rue Victor Pauchet
92 310 Sèvres

reply via email to

[Prev in Thread] Current Thread [Next in Thread]