Rootcling with python and numpy


ROOT Version: v6.18.04 and v6.12.06
Platform: SLF6
Compiler: gcc 7.3.0


Hello, I am building an application using rootcling that also links to python and numpy. I can successfully do this with ROOT v6.12.06, but since I switched to v6.18.04 the following error appears:


[…]/lib/python2.7/site-packages/numpy-1.15.4-py2.7-linux-x86_64.egg/numpy/core/include/numpy/ndarraytypes.h:719:30: error: typedef redefinition with different types (‘PyArrayObject_fields’ (aka ‘tagPyArrayObject_fields’) vs ‘tagPyArrayObject’)
typedef PyArrayObject_fields PyArrayObject;

[…]/root/v6_18_04b/Linux64bit+2.6-2.12-e17-prof/etc/…/include/TMVA/PyMethodBase.h:50:26: note: previous definition is here
typedef tagPyArrayObject PyArrayObject;


I made a simplified project that reproduces this issue (available here). In this project, a class “ExampleClass” is built, which uses numpy array objects included via

#include "Python.h"
#include "numpy/arrayobject.h"

I also added a simple GNU makefile to build this class, which calls rootcling and then g++ as described here. Once built, the library libMyLib.so is created, then:

root -l 
> gROOT->ProcessLine(".L libMyLib.so")
> example::ExampleClass e

This works fine with ROOT v6.12.06, but it returns the above error with v6.18.04. Not sure if I am doing something wrong or if I should submit a ticket for a bug to be fixed. Thank you!

May be @etejedor can help ?

Hi,

This should be fixed when


is merged.

Perhaps @moneta can confirm.

Enric

1 Like