You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After updating the Boost download URL in #15691 we encountered the root cause of this issue again: #15338
I investigate it further and in summary, compiling Boost version 1.74 fails when using the current default Clang version (18.1.8) in the ossfuzz base image:
96.21 In file included from /usr/src/boost_1_74_0/boost/math/special_functions/bessel.hpp:24:
96.21 In file included from /usr/src/boost_1_74_0/boost/math/special_functions/detail/bessel_ik.hpp:13:
96.21 /usr/src/boost_1_74_0/boost/math/special_functions/round.hpp:118:12: warning: implicit conversion from 'type' (aka 'long long') to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-const-int-float-conversion]
96.21 118 | if((r > (std::numeric_limits<boost::long_long_type>::max)()) || (r < (std::numeric_limits<boost::long_long_type>::min)()))
96.21 | ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
96.21 libs/math/build/../src/tr1/c_policy.hpp:129:1: note: in instantiation of function template specialization 'boost::math::llround<double, boost::math::policies::policy<domain_error<errno_on_error>, pole_error<errno_on_error>, overflow_error<errno_on_error>, evaluation_error<errno_on_error>, rounding_error<errno_on_error>, default_policy, default_policy, default_policy, default_policy, default_policy, default_policy>>' requested here
96.21 129 | BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS(c_policy)
96.21 | ^
96.21 /usr/src/boost_1_74_0/boost/math/special_functions/math_fwd.hpp:1151:4: note: expanded from macro 'BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS'
96.21 1151 | BOOST_MATH_DETAIL_LL_FUNC(Policy)\
96.21 | ^
96.21 /usr/src/boost_1_74_0/boost/math/special_functions/math_fwd.hpp:1133:89: note: expanded from macro 'BOOST_MATH_DETAIL_LL_FUNC'
96.21 1133 | inline boost::long_long_type llround(const T& v){ using boost::math::llround; return llround(v, Policy()); }\
96.21 | ^
96.21 libs/math/build/../src/tr1/llround.cpp:18:23: note: in instantiation of function template specialization 'c_policies::llround<double>' requested here
96.21 18 | return c_policies::llround BOOST_PREVENT_MACRO_SUBSTITUTION(x);
96.21 | ^
96.21 1 warning generated.
96.21 clang-linux.compile.c++.with-pch bin.v2/libs/math/build/clang-linux-18.1.8/release/link-static/threading-multi/visibility-hidden/lround.o
96.21 In file included from libs/math/build/../src/tr1/lround.cpp:1:
96.21 In file included from /usr/src/boost_1_74_0/libs/math/build/../src/tr1/pch.hpp:9:
This issue seems to have started when ossfuzz updated their LLVM version to 18 (google/oss-fuzz#11714) as observed by @nikola-matic in #15338.
When upgrading Boost to version 1.83, CMake fails to locate the libc++ headers:
69.20 In file included from /usr/local/bin/../include/c++/v1/__assertion_handler:13:
69.20 /usr/local/bin/../include/c++/v1/__config:13:10: fatal error: '__config_site' file not found
69.20 13 | #include <__config_site>
69.20 | ^~~~~~~~~~~~~~~
69.20 1 error generated.
69.51
69.51 "clang++" -fvisibility-inlines-hidden -m64 -pthread -O3 -Wall -fvisibility=hidden -Wno-inline --target=x86_64-pc-linux -stdlib=libc++ -pthread -DBOOST_ALL_NO_LIB=1 -DBOOST_ATOMIC_SOURCE -DBOOST_ATOMIC_STATIC_LINK=1 -DNDEBUG -I"." -I"libs/atomic/src" -c -o "bin.v2/libs/atomic/build/clang-linux-18/release/link-static/threading-multi/visibility-hidden/lock_pool.o" "libs/atomic/src/lock_pool.cpp"
This can be resolved by installing libc++ development files and correcting its paths, e.g.:
However, Boost will fail again because of incompatibility with the C++ standard library:
9.12 In file included from ./boost/predef/detail/_exception.h:12:
69.12 In file included from /usr/include/c++/v1/exception:82:
69.12 In file included from /usr/include/c++/v1/__exception/exception_ptr.h:16:
69.12 In file included from /usr/include/c++/v1/__memory/construct_at.h:23:
69.12 /usr/include/c++/v1/new:216:86: error: reference to unresolved using declaration
69.12 216 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz) _THROW_BAD_ALLOC;
69.12 | ^
69.12 /usr/include/c++/v1/cstdlib:103:1: note: using declaration annotated with 'using_if_exists' here
69.12 103 | using ::size_t _LIBCPP_USING_IF_EXISTS;
69.12 | ^
69.12 In file included from libs/chrono/src/process_cpu_clocks.cpp:17:
69.12 In file included from ./boost/chrono/detail/inlined/process_cpu_clocks.hpp:15:
69.12 In file included from ./boost/chrono/config.hpp:17:
69.12 In file included from ./boost/predef.h:16:
69.12 In file included from ./boost/predef/library.h:14:
69.12 In file included from ./boost/predef/library/std.h:12:
69.12 In file included from ./boost/predef/library/std/_prefix.h:21:
69.12 In file included from ./boost/predef/detail/_exception.h:12:
By the way, why do we actually use libc++ and not the standard libstdc++? The base image is a Ubuntu 20.04 machine anyway. And, it can successfully compile Boost 1.83 using libstdc++ and Clang-18. For example, the diff below fix the issue without downgrading clang. But maybe libc++ is a requirement of ossfuzz?
diff --git a/scripts/docker/buildpack-deps/Dockerfile.ubuntu.clang.ossfuzz b/scripts/docker/buildpack-deps/Dockerfile.ubuntu.clang.ossfuzz
index 743d924d7..170c2ebcd 100644
--- a/scripts/docker/buildpack-deps/Dockerfile.ubuntu.clang.ossfuzz+++ b/scripts/docker/buildpack-deps/Dockerfile.ubuntu.clang.ossfuzz@@ -73,18 +73,18 @@ FROM base AS libraries
# Boost
RUN set -ex; \
cd /usr/src; \
- wget -q 'https://archives.boost.io/release/1.74.0/source/boost_1_74_0.tar.bz2' -O boost.tar.bz2; \- test "$(sha256sum boost.tar.bz2)" = "83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1 boost.tar.bz2" && \+ wget -q 'https://archives.boost.io/release/1.83.0/source/boost_1_83_0.tar.bz2' -O boost.tar.bz2; \+ test "$(sha256sum boost.tar.bz2)" = "6478edfe2f3305127cffe8caf73ea0176c53769f4bf1585be237eb30798c3b8e boost.tar.bz2" && \
tar -xf boost.tar.bz2; \
rm boost.tar.bz2; \
- cd boost_1_74_0; \- CXXFLAGS="-stdlib=libc++ -pthread" LDFLAGS="-stdlib=libc++" ./bootstrap.sh --with-toolset=clang --prefix=/usr; \- ./b2 toolset=clang cxxflags="-stdlib=libc++ -pthread" linkflags="-stdlib=libc++ -pthread" headers; \- ./b2 toolset=clang cxxflags="-stdlib=libc++ -pthread" linkflags="-stdlib=libc++ -pthread" \+ cd boost_1_83_0; \+ CXXFLAGS="-pthread" ./bootstrap.sh --with-toolset=clang --prefix=/usr; \+ ./b2 toolset=clang cxxflags=" -pthread" linkflags="-pthread" headers; \+ ./b2 toolset=clang cxxflags=" -pthread" linkflags="-pthread" \
link=static variant=release runtime-link=static \
system filesystem unit_test_framework program_options \
install -j $(($(nproc)/2)); \
- rm -rf /usr/src/boost_1_74_0+ rm -rf /usr/src/boost_1_83_0
After updating the Boost download URL in #15691 we encountered the root cause of this issue again: #15338
I investigate it further and in summary, compiling Boost version 1.74 fails when using the current default Clang version (18.1.8) in the ossfuzz base image:
This issue seems to have started when ossfuzz updated their LLVM version to 18 (google/oss-fuzz#11714) as observed by @nikola-matic in #15338.
When upgrading Boost to version 1.83, CMake fails to locate the libc++ headers:
This can be resolved by installing libc++ development files and correcting its paths, e.g.:
However, Boost will fail again because of incompatibility with the C++ standard library:
By the way, why do we actually use libc++ and not the standard libstdc++? The base image is a Ubuntu 20.04 machine anyway. And, it can successfully compile Boost 1.83 using libstdc++ and Clang-18. For example, the diff below fix the issue without downgrading clang. But maybe libc++ is a requirement of ossfuzz?
Another fix is to downgrade clang to version 15, like it was done by ossfuzz developers in https://github.com/google/oss-fuzz/pull/11714/files#diff-00e309e72907992784fc9669925d1181e3b5e645017e81e675928d2cc10dd25aR17-R18
The text was updated successfully, but these errors were encountered: