ClickHouse/contrib/boost-cmake
2018-11-24 23:52:30 +08:00
..
CMakeLists.txt update libhdfs3 without uuid/curl dependence 2018-11-24 23:52:30 +08:00
README Fix typo in readme 2018-10-13 15:28:08 +03:00

Motivation
==========

For reproducible build, we need to control, what exactly version of boost we build,
 because different versions of boost obviously have slightly different behaviour.
You may already have installed arbitrary version of boost on your system, to build another projects.

We need to have all libraries with C++ interface to be located in tree and to be build together.
This is needed to allow quickly changing build options, that could introduce changes in ABI of that libraries.

Otherwise it will be very hard to rebuild all libraries.
If you have several C++ libraries, that depend on boost, that was compiled separately with different versions of boost,
 and then you try to link your program with that libraries, you either will get link error,
 or even worse, you will have crashes or wrong behaviour at runtime.

Summary: boost and every library that depend on boost must be located in tree.


How to add more libraries
=========================

This is subset of boost. Feel free to copy more libraries, that you need.
Before doing that, first update boost to latest version.


How to update
=============

Feel free to update boost to latest version at any time.

Temporarily remove system boost library:

sudo mv /usr/include/boost /usr/include/boost_; sudo mv /usr/local/include/boost /usr/local/include/boost_

Download new boost and copy to this directory.
Then clean all unneeded files:

rm -rf boost_*/doc
rm -rf boost_*/tools
find . -name '*.html' | xargs rm
find . -name '*.htm' | xargs rm
find . -name '*.jam' | xargs rm
find . -name '*.xml' | xargs rm
find . -type d -and -name 'doc' | xargs rm -rf
find . -type d -and -name 'example' | xargs rm -rf
find . -type d -and -name 'meta' | xargs rm -rf
find . -name 'sublibs' | xargs rm
find . -type d -and -name 'more' | xargs rm -rf
find . -type d -and -name 'status' | xargs rm -rf
rm boost_*/INSTALL boost_*/Jamroot boost_*/boost.css boost_*/boost.png boost_*/bootstrap.* boost_*/rst.css
find . -name '*.css' | xargs rm

In project root, find out all used libraries:

find . -name '*.h' -or -name '*.cpp' -or -name '*.hpp' | grep -v contrib | xargs grep -h -o -P '<boost/\w+' | sed 's/<boost\///' | sort | uniq

Then manually remove all other libraries, by deleting directories.

Then add all internal dependencies by recursively running this command in contrib/libboost:

make 2>&1 | grep 'No such file' | tee err; grep -o -P ' boost/\w+\.h(pp)?' err | tr -d ' ' | xargs -I{} cp boost_*_/{} boost_*/{}; grep -o -P ' boost/\w+/' err | tr -d ' ' | xargs -I{} cp -r boost_*_/{} boost_*/{}

Then build project and add all missing files.

Move system boost library back:

sudo mv /usr/include/boost_ /usr/include/boost; sudo mv /usr/local/include/boost_ /usr/local/include/boost