Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost.serialization] shared object plugin
From: Francois Mauger (mauger_at_[hidden])
Date: 2012-08-08 04:31:57


Hi Giamperio

unless you have mismatched your Cmake linking directives (I guess it is
not the case), maybe you should tell us more about the gcc version you use.
it seems some recent gcc versions (>=4.6) have a new linking model and
dll linkage is done only if some code is explicitely recognized in your
own dll or executable.
Some hints to fix such issue :
- invoke a dlopen call on the missing linked dll in your executable or
at loading of your own dll
- add some static code that explicitely uses some resources from the
missig dll

however these are just hints... maybe nothing to do with your pb.
just in case it could help you.

regards
frc

--
Le 08/08/2012 08:41, Giampiero Gabbiani a écrit :
> Hi Robert,
> I tried the test_dll_plugin (with CMAKE under Linux) that seems to cover my
> case.
>
> add_executable(test_dll_plugin test_dll_plugin.cpp polymorphic_base.cpp)
> target_link_libraries(test_dll_plugin dl boost_serialization
> boost_filesystem)
>
> add_library(plugin_polymorphic_derived2 SHARED polymorphic_derived2.cpp)
>
> it compiles (under Linux) but during execution I get:
>
> test_dll_plugin: /usr/include/boost/serialization/singleton.hpp:137: static
> T& boost::serialization::singleton<T>::get_mutable_instance() [with T =
> boost::archive::detail::extra_detail::guid_initializer<polymorphic_derived2>]:
> Assertion `! is_locked()' failed.
>
> If I make an ldd of both the executable
>
> ldd test_dll_plugin
> linux-vdso.so.1 =>  (0x00007fff0d56d000)
> libdl.so.2 => /lib64/libdl.so.2 (0x00007f547aaab000)
> libboost_serialization-1_49.so.1.49.0 =>
> /usr/lib64/libboost_serialization-1_49.so.1.49.0 (0x00007f547a835000)
> libboost_filesystem-1_49.so.1.49.0 =>
> /usr/lib64/libboost_filesystem-1_49.so.1.49.0 (0x00007f547a610000)
> libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/libstdc++.so.6
> (0x00007f547a301000)
> libm.so.6 => /lib64/libm.so.6 (0x00007f547a07d000)
> libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f5479e66000)
> libc.so.6 => /lib64/libc.so.6 (0x00007f5479ad4000)
> libboost_system-1_49.so.1.49.0 => /usr/lib64/libboost_system-1_49.so.1.49.0
> (0x00007f54798d0000)
> /lib64/ld-linux-x86-64.so.2 (0x00007f547acaf000)
>
> and the shared object
>
> ldd libplugin_polymorphic_derived2.so
> linux-vdso.so.1 =>  (0x00007fffd332b000)
> libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/libstdc++.so.6
> (0x00007ffa4936c000)
> libm.so.6 => /lib64/libm.so.6 (0x00007ffa490e7000)
> libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007ffa48ed0000)
> libc.so.6 => /lib64/libc.so.6 (0x00007ffa48b3e000)
> /lib64/ld-linux-x86-64.so.2 (0x00007ffa498fa000)
>
> the strange is that there is no dynamic linking to libboost_serialization
> inside the libplugin_polymorphic_derived2.so.
>
> So ... did I make some error in the project organization or are there any
> comile option or define I missed?
>
> I wonder - for example - if I should link the executable against the
> multithread version of the serialization library (I guess not ...).
>
> Many thanks
> Giampiero
>
>> Giampiero Gabbiani wrote:
>>
>>> So far, is there a complete example of boost.serialization of plugins
>>> with private implementation in shared object?
>>
>> There are some tests and demo for this case.  Have you checked
>> in the libs/serialization/test and libs/serialization/example directories?
>>
>> Robert Ramey
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net