activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stephenju <>
Subject Re: Static link ActiveMQ-CPP on Mac OS X
Date Mon, 07 Nov 2011 04:18:25 GMT

stephenju wrote:
> I am trying to add ActiveMQ-CPP to my Mac OS X project. The goal is to
> static link everything into the app bundle.
> I first installed MacPort and built and installed required parts. Then I
> built and installed ActiveMQ-CPP 3.4.0 with --enable-shared=false.
> Finally, I added all necessary static library files (.a) to my project and
> it compiled and linked without any error.
> However, when I examine the resulted binary with otool, it lists all added
> static libs as dylib. For example:
> Load command 13
>           cmd LC_LOAD_DYLIB
>       cmdsize 56
>          name /opt/local/lib/libapr-1.0.dylib (offset 24)
>    time stamp 2 Wed Dec 31 19:00:02 1969
>       current version 5.5.0
> compatibility version 5.0.0
> That library was added to the project as libapr-1.a. Why is it still
> linked as dynamic lib? How do I get it to use static one?
> Thanks.
> BTW. This is on Mac OS 10.6 and Xcode 4.2.

Funny. My post is shown as pending in the account and doesn't seems to be
synced to the mail list.

Anyway. I figure out the problem. All the dependent libraries actually come
with OS X 10.6. Also Xcode has this nasty habit of always using dynamic libs
if it finds one, even when a static .a file is specified. So uninstalling
all MacPort parts and rebuilding ActiveMQ-CPP with --enable-shared=false
created a static lib that references only system libs.

Unfortunately, this is not the end of my problem. The static lib links OK. I
tested with some sample code in my project and it also works. However, when
building with Xcode Release mode, it ends with linker error complaining bad
codegen and wrong offsets. I have to turn code optimization completely off
(-O0) to make it link.

This is beyond frustrating...

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message