I am trying to compile boost from sources but getting the error below. It works fine for all versions of boost up to 1.74.0 but it breaks for anything newer than that. Note that I am compiling a subset of boost modules, std::regex only. Is there anything that changed on this version that makes these types unavailable?
clang-linux.compile.c bin.v2/libs/regex/build/clang-linux-14/release/link-static/visibility-hidden/posix_api.o
libs/regex/build/../src/posix_api.cpp:90:4: error: no type named 'uint_fast32_t' in namespace 'boost'; did you mean simply 'uint_fast32_t'?
boost::uint_fast32_t flags = (f & REG_PERLEX) ? 0 : ((f & REG_EXTENDED) ? regex::extended : regex::basic);
^~~~~~~~~~~~~~~~~~~~
uint_fast32_t
This script causes the error:
#!/bin/bash
set -exo pipefail
INSTALL_DIR=/ssd/tmp/install
TMPDIR=/ssd/tmp
TAG=boost-1.78.0
cd $TMPDIR
rm -rf boost
git clone https://github.com/boostorg/boost.git
cd boost
git checkout $TAG
allsm=" tools/build
tools/bcp
tools/boost_install
tools/boostdep
libs/regex
libs/config
libs/predef
libs/core
libs/detail
libs/headers
libs/integer"
for sm in $allsm; do
git submodule update --init $sm
done
#export LD=/usr/local/bin/ld.lld
#export CC='/usr/local/bin/clang'
#export CXX='/usr/local/bin/clang '
#export CXXFLAGS='-O3 -stdlib=libc -std=c 20 -stdlib=libc '
#export LDFLAGS="-lc abi -lc "
./bootstrap.sh
#--with-toolset=clang
./b2 headers
./b2 install -q -a \
--prefix=$INSTALL_DIR/local \
--build-type=minimal \
--layout=system \
--disable-icu \
--with-regex \
variant=release link=static runtime-link=static \
threading=single address-model=64 architecture=x86
# toolset=clang
However it works if you change the git tag from boost-1.78.0
to boost-1.71.0
.
CodePudding user response:
You aren't checking out all of the submodules, the simplest solution is to just follow the docs and run:
git clone --recursive https://github.com/boostorg/boost.git
or:
git clone [email protected]:boostorg/boost.git
git submodule update --init
After adding libs/throw_exception
, and libs/assert
to the submodules in your script it works for me on Ubuntu 20.04.
Here's the dockerfile I used for testing:
From ubuntu:20.04
RUN apt update
RUN apt-get install g git -y
RUN git clone https://github.com/boostorg/boost.git
RUN cd boost && git checkout boost-1.78.0
RUN cd boost && git submodule update --init tools/build
RUN cd boost && git submodule update --init tools/bcp
RUN cd boost && git submodule update --init tools/boost_install
RUN cd boost && git submodule update --init tools/boostdep
RUN cd boost && git submodule update --init libs/regex
RUN cd boost && git submodule update --init libs/config
RUN cd boost && git submodule update --init libs/predef
RUN cd boost && git submodule update --init libs/core
RUN cd boost && git submodule update --init libs/detail
RUN cd boost && git submodule update --init libs/headers
RUN cd boost && git submodule update --init libs/integer
RUN cd boost && git submodule update --init libs/assert
RUN cd boost && git submodule update --init libs/throw_exception
RUN cd boost && ./bootstrap.sh
RUN cd boost && ./b2 headers
RUN cd boost && ./b2 install -q -a \
--prefix=$INSTALL_DIR/local \
--build-type=minimal \
--layout=system \
--disable-icu \
--with-regex \
variant=release link=static runtime-link=static \
threading=single address-model=64 architecture=x86
CodePudding user response:
Since Boost 1.76, Boost.Regex is a header-only library:
This is a header only library provided your compiler supports C 11 or later. Support for C 03 compilers is still present, but is now deprecated and may be removed without further notice!
The only people that still need to build the external libboost_regex library are those that are either:
- Using the library in C 03 mode, or,
- Using the deprecated POSIX C API's
Since you're compiling as C 11 or above, you should not need to build the libboost_regex library, so you can remove the --with-regex
option.