Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 932459 - dev-libs/boost-1.85.0 USE="numpy" fails with error: ‘PyArray_Descr’ {aka ‘struct _PyArray_Descr’} has no member named ‘elsize’
Summary: dev-libs/boost-1.85.0 USE="numpy" fails with error: ‘PyArray_Descr’ {aka ‘str...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: David Seifert
URL:
Whiteboard:
Keywords: PATCH
Depends on: 935739
Blocks: 930951
  Show dependency tree
 
Reported: 2024-05-22 11:56 UTC by Attila Tóth
Modified: 2024-07-11 10:23 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
https://github.com/boostorg/python/pull/432 with the path fixed (432.patch,1.04 KB, patch)
2024-05-31 06:14 UTC, Justin Keogh
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Attila Tóth 2024-05-22 11:56:04 UTC
gcc.compile.c++ bin.v2/libs/python/build/gcc-13.2/gentoorelease/pch-off/python-3.10/threading-multi/visibility-hidden/numpy/dtype.o

    "x86_64-pc-linux-gnu-g++"   -fvisibility-inlines-hidden  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -O2 -march=native -pipe -std=c++17 -fPIC -m64 -pthread -finline-functions -Wno-inline -Wall -fvisibility=hidden  -DBOOST_ALL_NO_LIB=1 -DBOOST_COBALT_USE_STD_PMR=1 -DBOOST_NUMPY_SOURCE -DNDEBUG   -I"." -I"/usr/include/python3.10" -I"/usr/lib/python3.10/site-packages/numpy/_core/include"  -c -o "bin.v2/libs/python/build/gcc-13.2/gentoorelease/pch-off/python-3.10/threading-multi/visibility-hidden/numpy/dtype.o" "libs/python/src/numpy/dtype.cpp"

In file included from ./boost/python/detail/is_xxx.hpp:8,
                 from ./boost/python/detail/is_auto_ptr.hpp:9,
                 from ./boost/python/detail/copy_ctor_mutates_rhs.hpp:8,
                 from ./boost/python/detail/value_arg.hpp:7,
                 from ./boost/python/object/forward.hpp:10,
                 from ./boost/python/object/pointer_holder.hpp:16,
                 from ./boost/python/to_python_indirect.hpp:10,
                 from ./boost/python/converter/arg_to_python.hpp:10,
                 from ./boost/python/call.hpp:15,
                 from ./boost/python/object_core.hpp:14,
                 from ./boost/python/args.hpp:22,
                 from ./boost/python.hpp:11,
                 from ./boost/python/numpy/internal.hpp:17,
                 from libs/python/src/numpy/dtype.cpp:11:
./boost/python/detail/is_auto_ptr.hpp:17:40: warning: ‘template<class> class std::auto_ptr’ is deprecated: use 'std::unique_ptr' instead [-Wdeprecated-declarations]
   17 | BOOST_PYTHON_IS_XXX_DEF(auto_ptr, std::auto_ptr, 1)
      |                                        ^~~~~~~~
./boost/detail/is_xxx.hpp:20:4: note: in definition of macro ‘BOOST_DETAIL_IS_XXX_DEF’
   20 |    qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, T) >        \
      |    ^~~~~~~~~~~~~~
./boost/python/detail/is_auto_ptr.hpp:17:1: note: in expansion of macro ‘BOOST_PYTHON_IS_XXX_DEF’
   17 | BOOST_PYTHON_IS_XXX_DEF(auto_ptr, std::auto_ptr, 1)
      | ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/memory:78,
                 from ./boost/function/function_base.hpp:34,
                 from ./boost/function/function_template.hpp:14,
                 from ./boost/function/function0.hpp:10,
                 from ./boost/python/errors.hpp:13,
                 from ./boost/python/handle.hpp:11,
                 from ./boost/python/args_fwd.hpp:10,
                 from ./boost/python/args.hpp:10:
/usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/unique_ptr.h:65:28: note: declared here
   65 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
libs/python/src/numpy/dtype.cpp: In member function ‘int boost::python::numpy::dtype::get_itemsize() const’:
libs/python/src/numpy/dtype.cpp:101:83: error: ‘PyArray_Descr’ {aka ‘struct _PyArray_Descr’} has no member named ‘elsize’
  101 | int dtype::get_itemsize() const { return reinterpret_cast<PyArray_Descr*>(ptr())->elsize;}
      |                                                                                   ^~~~~~


Reproducible: Always
Comment 1 Chicago 2024-05-22 15:36:25 UTC
Hi Attila,

    I ran into this too.
    Try downgrading to =dev-python/numpy1.26.4
    https://github.com/numpy/numpy/releases/tag/v1.26.4

    Both boost v1.84 and v1.85 were failing for me and after downgrading numpy, "no more problems".

    Also, it compiled for me using =sys-devel/gcc-13.3.0.

Best Regards,
-Chicago
Comment 2 Attila Tóth 2024-05-23 08:59:19 UTC
(In reply to Chicago from comment #1)
> Hi Attila,
> 
>     I ran into this too.
>     Try downgrading to =dev-python/numpy1.26.4
>     https://github.com/numpy/numpy/releases/tag/v1.26.4
> 
>     Both boost v1.84 and v1.85 were failing for me and after downgrading
> numpy, "no more problems".
> 
>     Also, it compiled for me using =sys-devel/gcc-13.3.0.
> 
> Best Regards,
> -Chicago

Thanks for sharing!
What I don't understand is, that according to numpy's documentation elsize is still the member of PyArray_Descr struct in contrast to the error message. Or I have to take a closer look...
Comment 3 Attila Tóth 2024-05-23 19:48:01 UTC
(In reply to Attila Tóth from comment #2)
> (In reply to Chicago from comment #1)
> > Hi Attila,
> > 
> >     I ran into this too.
> >     Try downgrading to =dev-python/numpy1.26.4
> >     https://github.com/numpy/numpy/releases/tag/v1.26.4
> > 
> >     Both boost v1.84 and v1.85 were failing for me and after downgrading
> > numpy, "no more problems".
> > 
> >     Also, it compiled for me using =sys-devel/gcc-13.3.0.
> > 
> > Best Regards,
> > -Chicago
> 
> Thanks for sharing!
> What I don't understand is, that according to numpy's documentation elsize
> is still the member of PyArray_Descr struct in contrast to the error
> message. Or I have to take a closer look...

https://numpy.org/devdocs/numpy_2_0_migration_guide.html#the-pyarray-descr-struct-has-been-changed
Comment 4 Chicago 2024-05-24 01:29:47 UTC
Yeah, I don't know.

Boost breaks things ALL OF THE TIME.

When I noticed the numpy 2 package was merely a release candidate, I went to the homepage and it looked like the 1.26.4 release was actually more fresh; so that's why I gave it a try.
Comment 5 Justin Keogh 2024-05-31 06:14:57 UTC
Created attachment 894689 [details, diff]
https://github.com/boostorg/python/pull/432 with the path fixed

dropping https://github.com/boostorg/python/pull/432.patch into "/etc/portage/patches/dev-libs/boost" wont work, because the patch is missing the path element "libs/python" since it should be patching  "libs/python/src/numpy/dtype.cpp"

The attached patch just fixes the paths, putting it in "/etc/portage/patches/dev-libs/boost" works for me.
Comment 6 Larry the Git Cow gentoo-dev 2024-05-31 22:38:01 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c4165b90a91bb690c3a21dc686ab72ce2c741af

commit 7c4165b90a91bb690c3a21dc686ab72ce2c741af
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-05-31 22:34:43 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-05-31 22:35:49 +0000

    dev-libs/boost: fix build w/ numpy-2
    
    Closes: https://bugs.gentoo.org/932459
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-libs/boost/boost-1.85.0.ebuild                 |  1 +
 .../boost/files/boost-1.85.0-python-numpy-2.patch  | 26 ++++++++++++++++++++++
 2 files changed, 27 insertions(+)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b3c11ad7888226360acbfca8ffc210dd3cf43ddd

commit b3c11ad7888226360acbfca8ffc210dd3cf43ddd
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-05-31 22:37:35 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-05-31 22:37:35 +0000

    dev-libs/boost: subslot depend on numpy
    
    no revbump as it didn't build for >=2 until now anyway
    
    Bug: https://bugs.gentoo.org/932459
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-libs/boost/boost-1.85.0.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 7 Joost Ruis 2024-07-10 22:33:34 UTC
This also happens on stable tree when you pull in dev-python/numpy:0/2 and compile dev-libs/boost-1.84.0-r3 against it.

For now I masked this numpy slot and see if that resolves my issue.


          17 | BOOST_PYTHON_IS_XXX_DEF(auto_ptr, std::auto_ptr, 1)
             |                                        ^~~~~~~~
       ./boost/detail/is_xxx.hpp4: note: in definition of macro ‘BOOST_DETAIL_IS_XXX_DEF’
          20 |    qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, T) >        \
             |    ^~~~~~~~~~~~~~
       ./boost/python/detail/is_auto_ptr.hpp1: note: in expansion of macro ‘BOOST_PYTHON_IS_XXX_DEF’
          17 | BOOST_PYTHON_IS_XXX_DEF(auto_ptr, std::auto_ptr, 1)
             | ^~~~~~~~~~~~~~~~~~~~~~~
       In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/memory:78,
                        from ./boost/function/function_base.hpp:34,
                        from ./boost/function/detail/prologue.hpp:18,
                        from ./boost/function/function_template.hpp:13,
                        from ./boost/function/detail/maybe_include.hpp:15,
                        from ./boost/function/function0.hpp:11,
                        from ./boost/python/errors.hpp:13,
                        from ./boost/python/handle.hpp:11,
                        from ./boost/python/args_fwd.hpp:10,
                        from ./boost/python/args.hpp
       /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/unique_ptr.h28: note: declared here
          65 |   template<typename> class auto_ptr;
             |                            ^~~~~~~~
       libs/python/src/numpy/dtype.cpp: In member function ‘int boost::get_itemsize() const’:
       libs/python/src/numpy/dtype.cpp83: error: ‘PyArray_Descr’ {aka ‘struct _PyArray_Descr’} has no member named ‘elsize’
Comment 8 Joost Ruis 2024-07-11 00:06:31 UTC
(In reply to Joost Ruis from comment #7)
> This also happens on stable tree when you pull in dev-python/numpy:0/2 and
> compile dev-libs/boost-1.84.0-r3 against it.
> 
> For now I masked this numpy slot and see if that resolves my issue.
> 
> 
>           17 | BOOST_PYTHON_IS_XXX_DEF(auto_ptr, std::auto_ptr, 1)
>              |                                        ^~~~~~~~
>        ./boost/detail/is_xxx.hpp4: note: in definition of macro
> ‘BOOST_DETAIL_IS_XXX_DEF’
>           20 |    qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, T) >     
> \
>              |    ^~~~~~~~~~~~~~
>        ./boost/python/detail/is_auto_ptr.hpp1: note: in expansion of macro
> ‘BOOST_PYTHON_IS_XXX_DEF’
>           17 | BOOST_PYTHON_IS_XXX_DEF(auto_ptr, std::auto_ptr, 1)
>              | ^~~~~~~~~~~~~~~~~~~~~~~
>        In file included from
> /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/memory:78,
>                         from ./boost/function/function_base.hpp:34,
>                         from ./boost/function/detail/prologue.hpp:18,
>                         from ./boost/function/function_template.hpp:13,
>                         from ./boost/function/detail/maybe_include.hpp:15,
>                         from ./boost/function/function0.hpp:11,
>                         from ./boost/python/errors.hpp:13,
>                         from ./boost/python/handle.hpp:11,
>                         from ./boost/python/args_fwd.hpp:10,
>                         from ./boost/python/args.hpp
>       
> /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/unique_ptr.h28:
> note: declared here
>           65 |   template<typename> class auto_ptr;
>              |                            ^~~~~~~~
>        libs/python/src/numpy/dtype.cpp: In member function ‘int
> boost::get_itemsize() const’:
>        libs/python/src/numpy/dtype.cpp83: error: ‘PyArray_Descr’ {aka
> ‘struct _PyArray_Descr’} has no member named ‘elsize’

Yes masking dev-python/numpy:0/2 on my stable tree resolved my issue!
I am going to reopen this bug since it now affects stable tree.
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-07-11 10:22:56 UTC
I filed bug 935739 the other day.