I want to build boost with crc library only, how to build in my case? I get err on Ubuntu 24
sudo apt-get install build-essential g++ autotools-dev libicu-dev libbz2-dev libboost-all-dev
git clone https://github.com/boostorg/boost.git
cd boost
git submodule update --init -- libs/crc/
./bootstrap.sh
./bootstrap.sh: 1: ./tools/build/src/engine/build.sh: not found
Building B2 engine..
./bootstrap.sh: 229: ./tools/build/src/engine/build.sh: not found
Failed to build B2 build engine
Ok, let's just check boost libraries list
./bootstrap.sh --show-libraries
./bootstrap.sh: 1: ./tools/build/src/engine/build.sh: not found
Building B2 engine..
./bootstrap.sh: 229: ./tools/build/src/engine/build.sh: not found
Failed to build B2 build engine
Boost.CRC is a header-only library, meaning that you do not have to build anything.
Besides, BoostDep shows that there are few dependencies: array config integer type_traits
This is a rare instance where BCP might actually work to extract a minimul subset. However, I'd simply use the release tarball of Boost and not build anything for simplicity.
So, I found the time to actually test using BCP, and it actually makes a difference:
assuming an example test.cpp
#include <boost/crc.hpp>
#include <cstring>
int main() {
boost::crc_32_type crc;
char const *data = "Hello, world!";
crc.process_bytes(data, std::strlen(data));
return crc.checksum() == 0xEBE6C6E6u ? 0 : 1;
}
get the boost release tarball and extract it
wget https://archives.boost.io/release/1.85.0/source/boost_1_85_0.tar.bz2
tar xf boost_1_85_0.tar.bz2
extract all header dependencies:
mkdir extracted
bcp --boost=./boost_1_85_0/ --scan test.cpp extracted/
test compilation of the sample program
g++ -isystem extracted/ test.cpp
./a.out ; echo $?
Just for reference here's the 198kB zip of extracted/ folder created above: extracted.zip.
Alternatively as the 93kB tarball: extracted.tbz2
Using bcp
to report the 110 headers with their copyright notices: report.html