gdl
gdl copied to clipboard
1.0.0 RC2: cannot initialize return object of type 'int' with an rvalue of type 'nullptr_t' in src/gdlpython.cpp
On FreeBSD, with 1.0.0-rc2, with Python 3 enabled, compilation fails:
[ 23%] Building CXX object src/CMakeFiles/gdl.dir/basic_op.cpp.o
cd /usr/ports/science/gnudatalanguage/work/.build/src && /usr/local/libexec/ccache/c++ -DHAVE_CONFIG_H -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D__WXGTK__ -I/usr/ports/science/gnudatalanguage/work/gdl-1.0.0-rc.2/src -I/usr/local/include -I/usr/local/include/ImageMagick-6 -I/usr/local/lib/wx/include/gtk3-unicode-3.0 -I/usr/local/include/wx-3.0 -I/usr/local/mpi/openmpi/include -I/usr/local/include/python3.7m -I/usr/local/lib/python3.7/site-packages/numpy/core/include -I/usr/local/include/eigen3 -I/usr/ports/science/gnudatalanguage/work/gdl-1.0.0-rc.2 -I/usr/ports/science/gnudatalanguage/work/gdl-1.0.0-rc.2/src/antlr -I/usr/ports/science/gnudatalanguage/work/.build -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -std=gnu++11 -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1 -I/usr/local/include/ImageMagick-6 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -std=gnu++11 -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1 -fPIE -std=gnu++11 -o CMakeFiles/gdl.dir/basic_op.cpp.o -c /usr/ports/science/gnudatalanguage/work/gdl-1.0.0-rc.2/src/basic_op.cpp
--- src/CMakeFiles/gdl.dir/datatypes.cpp.o ---
In file included from /usr/ports/science/gnudatalanguage/work/gdl-1.0.0-rc.2/src/datatypes.cpp:27:
/usr/ports/science/gnudatalanguage/work/gdl-1.0.0-rc.2/src/dinterpreter.hpp:60:18: warning: pragma STDC FENV_ACCESS ON is not supported, ignoring pragma [-Wunknown-pragmas]
# pragma STDC FENV_ACCESS ON
^
In file included from /usr/ports/science/gnudatalanguage/work/gdl-1.0.0-rc.2/src/datatypes.cpp:38:
In file included from /usr/ports/science/gnudatalanguage/work/gdl-1.0.0-rc.2/src/topython.cpp:22:
In file included from /usr/local/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
In file included from /usr/local/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
In file included from /usr/local/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1822:
/usr/local/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it with " \
^
In file included from /usr/ports/science/gnudatalanguage/work/gdl-1.0.0-rc.2/src/datatypes.cpp:41:
/usr/ports/science/gnudatalanguage/work/gdl-1.0.0-rc.2/src/gdlpython.cpp:40:34: error: cannot initialize return object of type 'int' with an rvalue of type 'nullptr_t'
if( Py_IsInitialized()) return NULL;
^~~~
/usr/include/sys/_null.h:37:14: note: expanded from macro 'NULL'
#define NULL nullptr
^~~~~~~
In file included from /usr/ports/science/gnudatalanguage/work/gdl-1.0.0-rc.2/src/datatypes.cpp:41:
/usr/ports/science/gnudatalanguage/work/gdl-1.0.0-rc.2/src/gdlpython.cpp:59:3: error: cannot initialize return object of type 'int' with an rvalue of type 'nullptr_t'
import_array();
^~~~~~~~~~~~~~
/usr/local/lib/python3.7/site-packages/numpy/core/include/numpy/__multiarray_api.h:1546:151: note: expanded from macro 'import_array'
#define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NUMPY_IMPORT_ARRAY_RETVAL; } }
^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/lib/python3.7/site-packages/numpy/core/include/numpy/__multiarray_api.h:1541:35: note: expanded from macro 'NUMPY_IMPORT_ARRAY_RETVAL'
#define NUMPY_IMPORT_ARRAY_RETVAL NULL
^~~~
/usr/include/sys/_null.h:37:14: note: expanded from macro 'NULL'
#define NULL nullptr
^~~~~~~
In file included from /usr/ports/science/gnudatalanguage/work/gdl-1.0.0-rc.2/src/datatypes.cpp:41:
/usr/ports/science/gnudatalanguage/work/gdl-1.0.0-rc.2/src/gdlpython.cpp:61:10: error: cannot initialize return object of type 'int' with an rvalue of type 'nullptr_t'
return NULL;
^~~~
/usr/include/sys/_null.h:37:14: note: expanded from macro 'NULL'
#define NULL nullptr
^~~~~~~
2 warnings and 3 errors generated.
*** [src/CMakeFiles/gdl.dir/datatypes.cpp.o] Error code 1
My compiler left that as a warning but I got rid of the message by replacing NULL with 0 as return values in gdlpython.cpp, see #753