One likely cause of this problem - when linking the dynamic wrapper
library, the linker may be using the shared version of the ActiveMQ-CPP
library, meaning that at runtime, it expects that shared library to be
loaded before the wrapper.

To get the linker to use the static library when linking the wrapper
library, make sure to tell the linker to force use of the static library,
as described on this Stack Overflow answer:
https://stackoverflow.com/questions/3698321/g-linker-force-static-linking-if-static-library-exists

I believe that means the following in the command to create the dynamic
wrapper library:

... -Wl,-Bstatic -lactivemq-cpp -Wl,-Bdynamic ...


Note that I tested a generic dynamic-lib link locally on a mac and the
arguments are a little different; here is what I came up with:

... -Wl,-static -lb -Wl,-dynamic -Wl,-dylib


Art


On Thu, Mar 21, 2019 at 11:55 AM Arthur Naseef <a...@amlinv.com> wrote:

> It's been a while since I've worked with C++, mangled symbol names and
> linking, but I used to be good at it, so I'll help...
>
> When linking the dynamic wrapper library, is the static library being
> pulled into the link via "-L... -lactivemq-cpp"?  If you can share the
> commands used to build, that would help.
>
> Also, can you verify that the exact same mangled symbol name appears in
> the activemq-cpp library (not the demangled form)?  I believe "nm
> libactivemq-cpp.a" will show the mangled names:
>
> nm libactivemq-cpp.a | grep
> _ZN8activemq4core25ActiveMQConnectionFactoryC1ERKSsS3_S3_
>
>
> Art
>
>
>
> On Thu, Mar 21, 2019 at 6:32 AM klaus.holst.jacobsen <
> klaus.holst.jacob...@gmail.com> wrote:
>
>> Hello
>>
>> I am building activemq-cpp 3.9.2 on my raspberry pi3.
>> I am building with the installed gcc 4.8 compiler on the device.
>> I also compile apr-1.5.2 as a prerequisite.
>>
>> I use the static libs produced by the compilation.
>> These static libs are used in my own wrapper classes residing in a dynamic
>> lib which is loaded and used by my main application.
>>
>> When I load my wrapper dynamic lib I get the following error:
>> undefined symbol:
>> _ZN8activemq4core25ActiveMQConnectionFactoryC1ERKSsS3_S3_
>>
>> If I run objdump -xC on my dynamic wrapper lib i do see:
>>
>> 00000000         *UND*00000000
>>
>> activemq::core::ActiveMQConnectionFactory::ActiveMQConnectionFactory(std::string
>> const&, std::string const&, std::string const&)
>>
>> So it does appear that the particular ConnectionFactory constructor is
>> indeed not present in the .so file.
>> The question is why. Compilation of activemq-cpp 3.9.2 runs smoothly
>> without
>> hickups, but why is it missing this particular constructor?
>>
>> objdump -xC does show that a ton of other activemq-cpp symbol are indeed
>> present in my wrapper dynamic lib.
>>
>> Regards
>> Klaus
>>
>>
>>
>> --
>> Sent from:
>> http://activemq.2283324.n4.nabble.com/ActiveMQ-Dev-f2368404.html
>>
>

Reply via email to