orliac opened a new issue, #36438:
URL: https://github.com/apache/arrow/issues/36438

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   When compiling this code https://github.com/ratt-ru/arcae which has a 
dependency on pyarrow, I get the following errors (only the first 3 are shown):
   
   ```
        303      [9/11] Building CXX object 
arcae/CMakeFiles/arrow_tables.dir/arrow_tables.cxx.o
     >> 304    FAILED: arcae/CMakeFiles/arrow_tables.dir/arrow_tables.cxx.o
        305      /work/backup/ska/orliac/spack_0200/lib/spack/env/gcc/g++ 
-Darrow_tables_EXPORTS 
-I/tmp/orliac/spack-stage/spack-stage-py-arcae-main-vovnmrg4xrujcsqzdemxk4
               6ldm6wmanc/spack-src/arcae/PkgConfig::casacore 
-I/work/ska/soft/spack/blackhole/v2/opt/spack/linux-rhel8-cascadelake/gcc-11.3.0/py-numpy-1.24.3-a24j2n7xqpnc
               
4qlygxwkatwvmpbbbwxm/lib/python3.10/site-packages/numpy/core/include 
-I/tmp/orliac/spack-stage/spack-stage-py-arcae-main-vovnmrg4xrujcsqzdemxk46ldm6wmanc/sp
               ack-src/cpp 
-I/work/ska/soft/spack/blackhole/v2/opt/spack/linux-rhel8-cascadelake/gcc-11.3.0/python-3.10.4-tl3vrz4pgbao3vfzuyldkj5bn7qpic4g/include/python3.
               10 
-I/tmp/orliac/spack-stage/spack-stage-py-arcae-main-vovnmrg4xrujcsqzdemxk46ldm6wmanc/spack-src/cpp/PkgConfig::casacore
 -isystem /tmp/orliac/spack-stage/s
               
pack-stage-py-arcae-main-vovnmrg4xrujcsqzdemxk46ldm6wmanc/spack-src/vcpkg/installed/x64-linux-dynamic-cxx17-abi0-rel/lib/pkgconfig/../../include
 -O3 -DNDEBU
               G -std=c++17 -fPIC -D_GLIBCXX_USE_CXX11_ABI=0 -MD -MT 
arcae/CMakeFiles/arrow_tables.dir/arrow_tables.cxx.o -MF 
arcae/CMakeFiles/arrow_tables.dir/arrow_table
               s.cxx.o.d -o 
arcae/CMakeFiles/arrow_tables.dir/arrow_tables.cxx.o -c 
/tmp/orliac/spack-stage/spack-stage-py-arcae-main-vovnmrg4xrujcsqzdemxk46ldm6wmanc/spac
               
k-src/_skbuild/linux-x86_64-3.10/cmake-build/arcae/arrow_tables.cxx
        306      In file included from 
/tmp/orliac/spack-stage/spack-stage-py-arcae-main-vovnmrg4xrujcsqzdemxk46ldm6wmanc/spack-src/_skbuild/linux-x86_64-3.10/cmake-build/
               arcae/arrow_tables.cxx:786:
     >> 307      
/work/ska/soft/spack/blackhole/v2/opt/spack/linux-rhel8-cascadelake/gcc-11.3.0/py-pyarrow-12.0.0-rkba5twblovfxpwsyl6ceyk76xjwzm4u/lib/python3.10/site-pack
               ages/pyarrow/src/arrow/python/datetime.h:50:8: error: 
'PyDateTime_CAPI' does not name a type; did you mean 'PyDateTimeAPI'?           
                       
        308         50 | extern PyDateTime_CAPI* datetime_api;
        309            |        ^~~~~~~~~~~~~~~
        310            |        PyDateTimeAPI
        311      
/work/ska/soft/spack/blackhole/v2/opt/spack/linux-rhel8-cascadelake/gcc-11.3.0/py-pyarrow-12.0.0-rkba5twblovfxpwsyl6ceyk76xjwzm4u/lib/python3.10/site-pack
               ages/pyarrow/src/arrow/python/datetime.h: In function 'int64_t 
arrow::py::internal::PyTime_to_us(PyObject*)':
     >> 312      
/work/ska/soft/spack/blackhole/v2/opt/spack/linux-rhel8-cascadelake/gcc-11.3.0/py-pyarrow-12.0.0-rkba5twblovfxpwsyl6ceyk76xjwzm4u/lib/python3.10/site-pack
               ages/pyarrow/src/arrow/python/datetime.h:62:11: error: 
'PyDateTime_TIME_GET_HOUR' was not declared in this scope                       
                      
        313         62 |   return (PyDateTime_TIME_GET_HOUR(pytime) * 
3600000000LL +
        314            |           ^~~~~~~~~~~~~~~~~~~~~~~~
     >> 315      
/work/ska/soft/spack/blackhole/v2/opt/spack/linux-rhel8-cascadelake/gcc-11.3.0/py-pyarrow-12.0.0-rkba5twblovfxpwsyl6ceyk76xjwzm4u/lib/python3.10/site-pack
               ages/pyarrow/src/arrow/python/datetime.h:63:11: error: 
'PyDateTime_TIME_GET_MINUTE' was not declared in this scope                     
                      
        316         63 |           PyDateTime_TIME_GET_MINUTE(pytime) * 
60000000LL +
        317            |           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   ...
   ```
   I'm compiling using Spack on a RH8 box using GCC 11.3.0 and Python 3.10.
   
   Where should the definition for `PyDateTime_CAPI` come from in
   ```
     >> 307      
/work/ska/soft/spack/blackhole/v2/opt/spack/linux-rhel8-cascadelake/gcc-11.3.0/py-pyarrow-12.0.0-rkba5twblovfxpwsyl6ceyk76xjwzm4u/lib/python3.10/site-pack
               ages/pyarrow/src/arrow/python/datetime.h:50:8: error: 
'PyDateTime_CAPI' does not name a type; did you mean 'PyDateTimeAPI'?           
                       
   ```
   ?
   
   This issue appears on the line below the `#ifndef PYPY_VERSION` line 
(meaning that `datetime.h` was not included):
   ```
   #pragma once
   
   #include <algorithm>
   #include <chrono>
   
   #include "arrow/result.h"
   #include "arrow/status.h"
   #include "arrow/type.h"
   #include "arrow/type_fwd.h"
   #include "arrow/util/int_util_overflow.h"
   #include "arrow/util/logging.h"
   #include "arrow/python/platform.h"
   #include "arrow/python/visibility.h"
   
   // By default, PyDateTimeAPI is a *static* variable.  This forces
   // PyDateTime_IMPORT to be called in every C/C++ module using the
   // C datetime API.  This is error-prone and potentially costly.
   // Instead, we redefine PyDateTimeAPI to point to a global variable,
   // which is initialized once by calling InitDatetime().
   #ifdef PYPY_VERSION
   #include "datetime.h"
   #else
   #define PyDateTimeAPI ::arrow::py::internal::datetime_api
   #endif
   
   namespace arrow {
   using internal::AddWithOverflow;
   using internal::MultiplyWithOverflow;
   namespace py {
   namespace internal {
   
   #ifndef PYPY_VERSION
   extern PyDateTime_CAPI* datetime_api;    ### issue is there
   
   ARROW_PYTHON_EXPORT
   void InitDatetime();
   #endif
   ```
   Thank you.
   
   ### Component(s)
   
   C++, Python


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to