Boost logo

Boost-Build :

Subject: Re: [Boost-build] Suppress "weak external" exports from Mac OS X executables?
From: Allen Cronce (allenslists_at_[hidden])
Date: 2008-11-25 12:19:49

Hi Jürgen,

Thanks for getting back to me so quickly. Using your suggestions I was
able to successfully pass the required flags on the command line. Sure
enough, specifying visibility as hidden disabled the symbol exports in
our applications. In addition to being cleaner, this also reduces the
size of the binaries. In one case, I saw a reduction of 22k bytes.

For posterity, here's the build command line that worked:

./tools/jam/src/bin.macosxx86/bjam -d+2 debug release toolset=darwin
address-model=32 architecture=combined threading=multi link=static
macosx-version=10.5 macosx-version-min=10.4 cflags="-
fvisibility=hidden -arch x86_64 -arch ppc64" cxxflags="-
fvisibility=hidden -arch x86_64 -arch ppc64" --layout=system --prefix=/
tmp/boostbuild_20081124_142343/32 --exec-prefix=/tmp/
boostbuild_20081124_142343/32 --build-dir=../../../buildProductsMac/
boost install

This results in the correct g++ command lines being generated. Here's
a sample:

     "g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -
Wall -mmacosx-version-min=10.4 -no-cpp-precomp -gdwarf-2 -Wno-long-
double -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch i386 -arch ppc -
fvisibility=hidden -arch x86_64 -arch ppc64 -fvisibility=hidden -arch
x86_64 -arch ppc64 -DBOOST_ALL_NO_LIB=1 -DNDEBUG -I"." -c -o
hypot.o" "libs/math/build/../src/tr1/hypot.cpp"

Although because I'm specifying both cflags and cxxflags, I'm seeing
two copies of my options on the command line. I guess I should just
specify cflags instead of both.

As an aside, once I learned how to pass cflags correctly, I was able
to add 64 bit architectures to the existing 32 bit ones specified via
the "address-model" option. This allowed me to build quad binaries in
one pass. Previously our script would build the 32 bit and 64 bit
binaries separately, then stitch them together with lipo.

Anyway, things look good now. Thanks again for your help Jürgen.


Allen Cronce
On Nov 25, 2008, at 5:24 AM, Jürgen Hunold wrote:
> Hi Allen !
> An'n Dienstag 25 November 2008 hett Allen Cronce schreven:
>> I suspect that the problem is I'm just not passing the cflags or
>> cxxflags correctly.
> Most probably.
>> 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 --
> 1. simply use cxxflags= , not darwin/cxxflags
> 2. Use quotes around -fvisibility=hidden else bjam will split again  
> at "="
> something like cxxflags=" -fvisibility=hidden" should work.
>> layout=system --prefix=/tmp/boostbuild_20081124_142343/32 --exec-
>> prefix=/tmp/boostbuild_20081124_142343/32 --builddir=../../../
>> buildProductsMac/boost install
> add -d+2 or use -n to see the resulting command line. Check this for  
> your
> flags.
>> Thanks in advance for any suggestions regarding eliminating these
>> symbol exports.
> Please post the resulting command line next time.
> Yours,
> Jürgen
> -- 
> * Dipl.-Math. Jürgen Hunold       ! Ingenieurgesellschaft für
> * voice: ++49 511 262926 57       ! Verkehrs- und Eisenbahnwesen mbH
> * fax  : ++49 511 262926 99       ! Lister Straße 15
> * juergen.hunold_at_[hidden]        !
> *
> * Geschäftsführer:                ! Sitz des Unternehmens: Hannover
> * Prof. Dr.-Ing. Thomas Siefer    ! Amtsgericht Hannover, HRB 56965
> * PD Dr.-Ing. Alfons Radtke       !
> _______________________________________________
> Unsubscribe & other changes:

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