Boost logo

Boost-Build :

Subject: [Boost-build] Suppress "weak external" exports from Mac OS X executables?
From: Allen Cronce (allenslists_at_[hidden])
Date: 2008-11-24 21:51:06

Hi all,

We're using boost static libraries in our projects. We've noticed that
there are tons of symbol exports in our Mac OS X executables, even
after stripping. Here's an excerpt from an "nm -m" command:

00008330 (__TEXT,__text) weak external
0000c240 (__TEXT,__text) weak external
00009d80 (__TEXT,__text) weak external
00009ef0 (__TEXT,__text) weak external
0000b340 (__TEXT,__text) weak external
00008540 (__TEXT,__text) weak external

Note that these are "defined" externals, meaning the code being
exported actually exists in the executable section of the binary. I
would expect to possibly see exported symbols like this in shared
libraries, but not application executables. In some applications, we
see hundreds of these exports.

I've tried to suppress these symbols by disabling visibility in the
boost static libraries, but that hasn't worked. Yes, I'm aware of gcc
4.0 visibility issues with exception handling across shared libraries.
But since we're statically linking, we shouldn't see those kind of

I suspect that the problem is I'm just not passing the cflags or
cxxflags correctly. Either that, or this isn't really a symbol
visibility issue.

In any case, here's the command line I tried:

./tools/jam/src/bin.macosxx86/bjam debug release toolset=darwin
address-model=32 architecture=combined threading=multi
link=shared,static macosx-version=10.5 macosx-version-min=10.4 darwin/
cflags=-fvisibility=hidden darwin/cxxflags=-fvisibility=hidden --
layout=system --prefix=/tmp/boostbuild_20081124_142343/32 --exec-
prefix=/tmp/boostbuild_20081124_142343/32 --builddir=../../../
buildProductsMac/boost install

Thanks in advance for any suggestions regarding eliminating these
symbol exports.


Allen Cronce

Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at