Skip to content

[Python] build warning in python #27199

@asfimport

Description

@asfimport

Many warnings about compute kernel options when building Arrow python.
Removing below line suppresses the warnings.

virtual ~FunctionOptions() = default;

I think the reason is virtual destructor makes the structure non C compatible and cannot use offsetof macro safely.
As function options are straightforward, looks destructor is not necessary.
@bkietz

Steps to reproduce
build arrow cpp

 ~/arrow/cpp/release $ cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DARROW_COMPUTE=ON -DARROW_BUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX=$(pwd)/_install -DCMAKE_INSTALL_LIBDIR=lib -DARROW_PYTHON=ON -DCMAKE_CXX_COMPILER=/usr/bin/clang++-9 -DCMAKE_C_COMPILER=/usr/bin/clang-9 ..

~/arrow/cpp/release $ ninja install

build arrow python

 ~/arrow/python $ python --version
 Python 3.6.9

~/arrow/python $ python setup.py build_ext --inplace
 ......
 [ 93%] Building CXX object CMakeFiles/_compute.dir/_compute.cpp.o [27/1691]
 In file included from /usr/include/x86_64-linux-gnu/bits/types/stack_t.h:23:0, 
 from /usr/include/signal.h:303,
 from /home/cyb/archery/lib/python3.6/site-packages/numpy/core/include/numpy/npy_interrupt.h:84,
 from /home/cyb/archery/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:5,
 from /home/cyb/arrow/cpp/release/_install/include/arrow/python/numpy_interop.h:41,
 from /home/cyb/arrow/cpp/release/_install/include/arrow/python/helpers.h:27,
 from /home/cyb/arrow/cpp/release/_install/include/arrow/python/api.h:24,
 from /home/cyb/arrow/python/build/temp.linux-x86_64-3.6/_compute.cpp:696:
 /home/cyb/arrow/python/build/temp.linux-x86_64-3.6/_compute.cpp: In function ‘int __Pyx_modinit_type_init_code()’:
 /home/cyb/arrow/python/build/temp.linux-x86_64-3.6/_compute.cpp:26034:146: warning: offsetof within non-standard-layout type ‘__pyx_obj_7pyarrow_8_compute__CastOptions’ is undefined [-Winvalid-offsetof]
 x_type_7pyarrow_8_compute__CastOptions.tp_weaklistoffset = offsetof(struct __pyx_obj_7pyarrow_8_compute__CastOptions, __pyx_base.__pyx_base.__weakref__);
 ^
 /home/cyb/arrow/python/build/temp.linux-x86_64-3.6/_compute.cpp:26066:150: warning: offsetof within non-standard-layout type ‘__pyx_obj_7pyarrow_8_compute__FilterOptions’ is undefined [-Winvalid-offsetof]
 type_7pyarrow_8_compute__FilterOptions.tp_weaklistoffset = offsetof(struct __pyx_obj_7pyarrow_8_compute__FilterOptions, __pyx_base.__pyx_base.__weakref__);
 ^
 /home/cyb/arrow/python/build/temp.linux-x86_64-3.6/_compute.cpp:26082:146: warning: offsetof within non-standard-layout type ‘__pyx_obj_7pyarrow_8_compute__TakeOptions’ is undefined [-Winvalid-offsetof]
 x_type_7pyarrow_8_compute__TakeOptions.tp_weaklistoffset = offsetof(struct __pyx_obj_7pyarrow_8_compute__TakeOptions, __pyx_base.__pyx_base.__weakref__);
 ^
 /home/cyb/arrow/python/build/temp.linux-x86_64-3.6/_compute.cpp:26130:150: warning: offsetof within non-standard-layout type ‘__pyx_obj_7pyarrow_8_compute__MinMaxOptions’ is undefined [-Winvalid-offsetof]
 type_7pyarrow_8_compute__MinMaxOptions.tp_weaklistoffset = offsetof(struct __pyx_obj_7pyarrow_8_compute__MinMaxOptions, __pyx_base.__pyx_base.__weakref__);
 ^
 /home/cyb/arrow/python/build/temp.linux-x86_64-3.6/_compute.cpp:26146:148: warning: offsetof within non-standard-layout type ‘__pyx_obj_7pyarrow_8_compute__CountOptions’ is undefined [-Winvalid-offsetof]
 _type_7pyarrow_8_compute__CountOptions.tp_weaklistoffset = offsetof(struct __pyx_obj_7pyarrow_8_compute__CountOptions, __pyx_base.__pyx_base.__weakref__);
 ^ 
 /home/cyb/arrow/python/build/temp.linux-x86_64-3.6/_compute.cpp:26162:146: warning: offsetof within non-standard-layout type ‘__pyx_obj_7pyarrow_8_compute__ModeOptions’ is undefined [-Winvalid-offsetof]
 x_type_7pyarrow_8_compute__ModeOptions.tp_weaklistoffset = offsetof(struct __pyx_obj_7pyarrow_8_compute__ModeOptions, __pyx_base.__pyx_base.__weakref__);
 ^
 /home/cyb/arrow/python/build/temp.linux-x86_64-3.6/_compute.cpp:26210:154: warning: offsetof within non-standard-layout type ‘__pyx_obj_7pyarrow_8_compute__VarianceOptions’ is undefined [-Winvalid-offsetof]
 pe_7pyarrow_8_compute__VarianceOptions.tp_weaklistoffset = offsetof(struct __pyx_obj_7pyarrow_8_compute__VarianceOptions, __pyx_base.__pyx_base.__weakref__);
 ^
 /home/cyb/arrow/python/build/temp.linux-x86_64-3.6/_compute.cpp:26258:156: warning: offsetof within non-standard-layout type ‘__pyx_obj_7pyarrow_8_compute__ArraySortOptions’ is undefined [-Winvalid-offsetof]
 e_7pyarrow_8_compute__ArraySortOptions.tp_weaklistoffset = offsetof(struct __pyx_obj_7pyarrow_8_compute__ArraySortOptions, __pyx_base.__pyx_base.__weakref__);
 ^
 /home/cyb/arrow/python/build/temp.linux-x86_64-3.6/_compute.cpp:26274:146: warning: offsetof within non-standard-layout type ‘__pyx_obj_7pyarrow_8_compute__SortOptions’ is undefined [-Winvalid-offsetof]
 x_type_7pyarrow_8_compute__SortOptions.tp_weaklistoffset = offsetof(struct __pyx_obj_7pyarrow_8_compute__SortOptions, __pyx_base.__pyx_base.__weakref__);
 ......
 

Reporter: Yibo Cai / @cyb70289
Assignee: Yibo Cai / @cyb70289

PRs and other links:

Note: This issue was originally created as ARROW-11299. Please see the migration documentation for further details.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions