For a better way to build the framework using
Makefilecheckout makefile branch of this repository.
Script will download source code tarball if it isn't available in the root directory.
- boost downloads
- 1.53.0
- 1.54.0
- 1.55.0 - untested!
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
- C++ Language Dialect set to C++11 [-std=c++11]
- C++ Standard Library set to libc++ (LLVM C++ standard library with C++11 support)
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.
In 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.
- It doesn't include all the subspecs you might need for development
- It takes really long time to update every time you run
pod updateorpod install(given that you have modifiedPodfile)- The tarball is downloaded (50+ mb)
- The tarball is unpacked
- There's podspec for 1.51.0 only
- You can't use the Pod if you need libraries like
serializationserializationhas 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
- https://gitorious.org/boostoniphone
- http://goodliffe.blogspot.com.au/2010/09/building-boost-framework-for-ios-iphone.html
- http://goodliffe.blogspot.com.au/2009/12/boost-on-iphone.html
And lots of contributions by other people.