Quantcast
Channel: Everyday I'm coding » osx
Viewing all articles
Browse latest Browse all 10

compile Boost as static Universal binary lib

$
0
0

I want to have a static Universal binary lib of Boost. (Preferable the latest stable version, that is 1.43.0, or newer.)

I found many Google hits with similar problems and possible solutions. However, most of them seems outdated. Also none of them really worked.

Right now, I am trying

sudo ./bjam --toolset=darwin --link=static --threading=multi \
--architecture=combined --address-model=32_64 \
--macosx-version=10.4 --macosx-version-min=10.4 \
install

That compiles and install fine. However, the produced binaries seems broken.

az@ip245 47 (openlierox) %file /usr/local/lib/libboost_signals.a
/usr/local/lib/libboost_signals.a: current ar archive random library

az@ip245 49 (openlierox) %lipo -info  /usr/local/lib/libboost_signals.a
input file /usr/local/lib/libboost_signals.a is not a fat file
Non-fat file: /usr/local/lib/libboost_signals.a is architecture: x86_64

Edit: It seems that the command was wrong and I must remove the “–” for most options. So the command I am trying now (-a just means to rebuild all):

sudo ./bjam -a toolset=darwin link=static threading=multi \
architecture=combined address-model=32_64 \
macosx-version=10.4 macosx-version-min=10.4 \
install

However, this gives many strange errors (what I already had earlier), all like this:

darwin.compile.c++.pch bin.v2/libs/math/build/darwin-4.2.1/release/address-model-32_64/architecture-combined/link-static/macosx-version-min-10.4/macosx-version-10.4/threading-multi/../src/tr1/pch.hpp.gch
In file included from ./boost/math/special_functions/acosh.hpp:18,
                 from ./boost/math/special_functions.hpp:15,
                 from libs/math/build/../src/tr1/pch.hpp:9:
./boost/config/no_tr1/cmath.hpp:21:19: error: cmath: No such file or directory

This could be another problem I have when building Universal binaries: http://stackoverflow.com/questions/2830931/g-on-macosx-doesnt-work-with-arch-ppc64


Solution:

I found the problem. It seems that the MacOSX 10.4 SDK is missing a bunch of symlinks for GCC 4.2.

Use this as a test case:
http://stackoverflow.com/questions/2830931/g-on-macosx-doesnt-work-with-arch-ppc64

It will report multiple errors with GCC 4.2 (missing C++ includes, missing C includes, missing libs). In all cases, you can just fix that by setting a symlink. Search in your SDK for the file and just set the symlink in the same way it is in the MacOSX 10.5 SDK.

After that, it all just worked.


Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles



Latest Images