pycuda icon indicating copy to clipboard operation
pycuda copied to clipboard

errors building with clang on ubuntu 24.04

Open gregjhogan opened this issue 1 year ago • 1 comments

compiling with clang fails with errors related to enum values being out of bounds

In file included from bpl-subset/bpl_subset/libs/python/src/converter/builtin_converters.cpp:6:
In file included from bpl-subset/bpl_subset/boost/python/handle.hpp:10:
In file included from bpl-subset/bpl_subset/boost/python/cast.hpp:10:
In file included from bpl-subset/bpl_subset/boost/type_traits/same_traits.hpp:13:
In file included from bpl-subset/bpl_subset/boost/type_traits/is_same.hpp:31:
In file included from bpl-subset/bpl_subset/boost/type_traits/detail/bool_trait_def.hpp:15:
In file included from bpl-subset/bpl_subset/boost/type_traits/integral_constant.hpp:11:
In file included from bpl-subset/bpl_subset/boost/mpl/integral_c.hpp:32:
bpl-subset/bpl_subset/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]
   73 |     typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value - 1)) ) prior;
      |                               ^

because clang no longer allows downgrading this to a warning https://reviews.llvm.org/D150226

which it appears was fixed in boost version 1.81 https://reviews.llvm.org/D150226#4338856

and this project seems to still be on boost version 1.52 https://github.com/inducer/bpl-subset/blob/7bf979035e33df582cadf610a6645af1f6a62661/bpl_subset/boost/version.hpp#L30

clang++ version that doesn't work

$ clang++ --version
Ubuntu clang version 18.1.3 (1ubuntu1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

g++ version that works

$ g++ --version
g++ (Ubuntu 13.2.0-23ubuntu4) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

maybe you can force using g++ if this won't be fixed soon (I am having issues when both are installed)

gregjhogan avatar Oct 16 '24 06:10 gregjhogan

Thanks for the detailed analysis! The real solution to this will be to stop relying on a hacked-up Boost that's a pain to upgrade, see #393 for work towards that (not even that far to go). Nonetheless, in the short run, https://github.com/boostorg/mpl/issues/69 points to two specific fixes:

  • https://github.com/boostorg/numeric_conversion/commit/50a1eae942effb0a9b90724323ef8f2a67e7984a
  • https://github.com/boostorg/mpl/pull/77/files

that might make this go. Those two applied cleanly to our Boost subset, so I've pushed them. Could you give this a try and report back?

inducer avatar Oct 17 '24 01:10 inducer

Hi @inducer this works for me. thanks a lot!

guoriyue avatar Nov 04 '24 23:11 guoriyue

Thanks! A release with this is forthcoming.

inducer avatar Nov 05 '24 00:11 inducer