Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation errors with clang 16 #119

Closed
thierry-FreeBSD opened this issue Jun 25, 2023 · 5 comments
Closed

Compilation errors with clang 16 #119

thierry-FreeBSD opened this issue Jun 25, 2023 · 5 comments

Comments

@thierry-FreeBSD
Copy link
Contributor

FreeBSD-CURRENT (i.e. version 14.0) switched to clang version 16.0.6, and this causes some errors in cbang:

  1. When using -std=gnu++17:
c++ -o build/boost/libs/regex/src/w32_regex_traits.o -c -faligned-new -std=c++14 -fsigned-char -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -std=gnu++17 -funroll-loops -fno-pie -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -fPIC -DNDEBUG -D_REENTRANT -DUSING_CBANG -Iinclude -Isrc -Isrc/boost src/boost/libs/regex/src/w32_regex_traits.cpp
In file included from src/boost/libs/regex/src/cregex.cpp:22:
In file included from src/boost/boost/regex.hpp:31:
In file included from src/boost/boost/regex/v4/regex.hpp:67:
In file included from src/boost/boost/regex/v4/basic_regex.hpp:23:
In file included from src/boost/boost/functional/hash.hpp:6:
src/boost/boost/container_hash/hash.hpp:132:33: error: no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?
        struct hash_base : std::unary_function<T, std::size_t> {};
                           ~~~~~^~~~~~~~~~~~~~
                                __unary_function
/usr/include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared here
using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
^
  1. When using -std=gnu++14

This fixes the previous error, but it fails further:

c++ -o build/cbang/packet/Packet.o -c -faligned-new -std=c++14 -fsigned-char -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -std=gnu++14 -funroll-loops -fno-pie -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -fPIC -DNDEBUG -D_REENTRANT -DUSING_CBANG -Iinclude -Isrc -Isrc/boost src/cbang/packet/Packet.cpp
In file included from src/cbang/time/Time.cpp:42:
In file included from src/boost/boost/date_time/posix_time/posix_time.hpp:24:
In file included from src/boost/boost/date_time/posix_time/time_formatters.hpp:12:
In file included from src/boost/boost/date_time/gregorian/gregorian.hpp:31:
In file included from src/boost/boost/date_time/gregorian/gregorian_io.hpp:16:
In file included from src/boost/boost/date_time/date_facet.hpp:23:
In file included from src/boost/boost/date_time/period_parser.hpp:14:
In file included from src/boost/boost/date_time/string_parse_tree.hpp:13:
In file included from src/boost/boost/lexical_cast.hpp:32:
In file included from src/boost/boost/lexical_cast/try_lexical_convert.hpp:43:
In file included from src/boost/boost/lexical_cast/detail/converter_numeric.hpp:36:
In file included from src/boost/boost/numeric/conversion/cast.hpp:33:
In file included from src/boost/boost/numeric/conversion/converter.hpp:13:
In file included from src/boost/boost/numeric/conversion/conversion_traits.hpp:13:
In file included from src/boost/boost/numeric/conversion/detail/conversion_traits.hpp:18:
In file included from src/boost/boost/numeric/conversion/detail/int_float_mixture.hpp:19:
In file included from src/boost/boost/mpl/integral_c.hpp:32:
src/boost/boost/mpl/aux_/integral_wrapper.hpp:73:31: error: integer value -1 is outside the valid range of values [0, 3] for the enumeration type 'udt_builtin_mixture_enum' [-Wenum-constexpr-conversion]
    typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value - 1)) ) prior;
                              ^
src/boost/boost/mpl/aux_/static_cast.hpp:24:47: note: expanded from macro 'BOOST_MPL_AUX_STATIC_CAST'
#   define BOOST_MPL_AUX_STATIC_CAST(T, expr) static_cast<T>(expr)
                                              ^
freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this issue Jun 25, 2023
See <CauldronDevelopmentLLC/cbang#119> for
details.

PR:		271047
Reported by:	pkg-fallout
@DimitryAndric
Copy link

Hm, this looks similar to what I fixed in https://cgit.freebsd.org/ports/commit/?id=c035007f958a9fa3c45bb1441a63540be39018ed, which applies boostorg/functional@6a573e4 ...

@DimitryAndric
Copy link

Ah, it's actually fixed in boost's numeric_conversion here: boostorg/numeric_conversion@50a1eae

@thierry-FreeBSD
Copy link
Contributor Author

Thanks Dimitry, with your patch applied to src/boost/boost/container_hash/hash.hpp the 1st problem (std::unary_function) is fixed, but the 2nd one (integer value outside the valid range) remains.

@thierry-FreeBSD
Copy link
Contributor Author

Seen!
boostorg/numeric_conversion@50a1eae is about this 2nd error!

freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this issue Jun 25, 2023
Do not force clang 15, but apply a patch provided by dim@ for the first
error, and other patches from boost upstream, pointed out by dim@ in
CauldronDevelopmentLLC/cbang#119 (comment)

PR:		271047
@kbernhagen
Copy link
Contributor

Since boost has been updated, this should be fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants