libtool
[Top][All Lists]
Advanced

[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
http://www.gnu.org/software/libtool/manual.html#C_002b_002b-libraries,
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 :

configure.in:
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`
    AC_SUBST(CEYLAN_LIBSTDCPLUSPLUS)
fi

Makefile.am:
testCeylanPlugin_LDADD   = $(LIBLTDL) @CEYLAN_LIBSTDCPLUSPLUS@

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,
regards,

Olivier.



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 ceylan-test-plugin.la, it would need some other services
>provided by libCeylan.la), 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
>`testCeylanPlugin.o'                                                           
>     
>
>[..]
>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
>-L/usr/i686-pc-linux-gnu/lib
>-L/usr/lib/gcc-lib/i686-pc-linux-gnu/../../../i686-pc-linux-gnu/lib
>./.libs/ceylan-test-plugin.so
>/home/sye/tmp-Ceylan-test-install/lib/libCeylan.so
>/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/libstdc++.so -lm -lgcc_s -lc
>/home/sye/tmp-Ceylan-test-install/lib/libltdl.so -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
>`std::__enc_traits::_S_max_size'
>.libs/testCeylanPluginS.o:(.rodata+0x3314): undefined reference to
>`__gnu_cxx::facet_name'
>.libs/testCeylanPluginS.o:(.rodata+0x331c): undefined reference to
>`__gnu_cxx::messages_c'
>.
>[...]
>""""
>
>(one thing I do not understand is why
>"/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/libstdc++.so" 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 configure.in I have indeed
>"""
>AC_LIBTOOL_DLOPEN
>AM_PROG_LIBTOOL
>"""                                
>
>but libtool says :
>
>"""
>*** Warning: Linking the executable testCeylanPlugin against the
>loadable module
>*** ceylan-test-plugin.so is not portable!
>libtool: link: warning: `AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen
>support.      
>"""
>
>In my Makefile.am I have :
>
>"""
>testCeylanPlugin_SOURCES   = testCeylanPlugin.cc
>testCeylanPlugin_LDFLAGS = -export-dynamic -no-undefined -dlpreopen
>force -dlopen self -dlopen ceylan-test-plugin.la
>testCeylanPlugin_LDADD   = $(LIBLTDL)
>testCeylanPlugin_DEPENDENCIES = $(LIBLTDL) ceylan-test-plugin.la
>
>
>lib_LTLIBRARIES = ceylan-test-plugin.la
>
>ceylan_test_plugin_la_SOURCES = ceylan-test-plugin.cc
>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 Makefile.am) with no luck for
>the moment.
>
>Does anybody have a clue, or know the proper way to set up this ?
>
>Thanks in advance,
>regards,
>
>Olivier.
>
>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
>                                                      
>
>
>_______________________________________________
>http://lists.gnu.org/mailman/listinfo/libtool
>
>
>  
>


-- 
Olivier Boudeville
18, rue Victor Pauchet
92 310 Sèvres
06-16-83-37-22





reply via email to

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