For a better way to build the framework using
Makefile
checkout makefile branch of this repository.
Script will download source code tarball if it isn't available in the root directory.
You may get the sources manually as well. The script is expecting bz2
tarball. Put the tarball in the same folder with boost.sh
.
Make sure you keep the tarball name unchanged, so it is like boost_1_53_0.tar.bz2
.
Use boost.sh
to build boost framework.
Run boost.sh -h
to get help message.
Set BOOST_LIBS
environment variable with list of libraries that you need.
By default the script will build serialization
, thread
, system
and locale
for demo project.
Examples:
# clean build version 1.53.0 for ios and osx with c++11
# libraries: thread, system and locale
BOOST_LIBS="thread system locale" ./boost.sh clean --with-c++11 -v 1.53.0
# build version 1.54.0 for ios and osx without c++11, no clean
# libraries: system only
BOOST_LIBS="system" ./boost.sh --version 1.54.0
If you use libraries like serialization
you might see link errors in Xcode 5 especially when the framework was built using --with-c++11
flag.
Undefined symbols for architecture i386:
"std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
void std::__1::vector<boost::archive::detail::basic_iarchive_impl::cobject_id, std::__1::allocator<boost::archive::detail::basic_iarchive_impl::cobject_id> >::__push_back_slow_path<boost::archive::detail::basic_iarchive_impl::cobject_id>(boost::archive::detail::basic_iarchive_impl::cobject_id&&) in boost(libboost_serialization_basic_iarchive.o)
You have to change your project or target build settings.
Under Apple LLVM 5.0 - Language - C++ make the following changes
boost/type_traits.hpp
If you happen to include <boost/type_traits.hpp>
header file, you may see compile errors like this
Unexpected member name of ';' after declaration specifiers
To fix this problem, include the following line in your porject ***-Prefix.pch
file.
#define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
Most of the boost libraries are header-only, meaning you only need to include header files to make them work.
However, there is a list of libraries that need to be built for your target platform.
Check the link above and modify BOOST_LIBS
in boost.sh
to include or exclude the libraries for your project.
ar
for Simulator Dev ToolsIn Xcode 5 there's no ar
excutable in SIM_DEV_DIR
so using /usr/bin/ar
instead.
Check out this demo project for some examples.
I tried to use cocoapods spec for boost. However, there's a number of things that made me to switch to using framework instead.
pod update
or pod install
(given that you have modified Podfile
)
serialization
serialization
has to be linked as a library, it doesn't work like the rest of the boost libraries by just including hpp headers inline. It needs to be compiled for your target platform.This repo is practially a fork of https://github.com/wuhao5/boost. Only this one does not contain boost source code, thus is more lightweight.
The script mentioned above in it's turn is based on great work by Pete Goodliffe
And lots of contributions by other people.