GithubHelp home page GithubHelp logo

Comments (9)

guitargeek avatar guitargeek commented on June 8, 2024

Hi! You are having two different C++ interpreters running there. The one of ROOT and the one of cppyy. I don't really understand why you do that. Maybe it's an artifact of how you constructed the reproducer? What about using PyROOT all the way?

import ROOT

ROOT.gInterpreter.LoadText("""
#include <tuple>
#include <string>
using ATuple = std::tuple<int, float, std::string, double>;
""")
from ROOT import ATuple

ROOT.std.tuple_element[1, ATuple].type

If you mix the independent interpreters in such a crazy way that you use the types from PyROOT as template parameters for cppyy types, it's not surprising that it fails.

from root.

tmadlener avatar tmadlener commented on June 8, 2024

I think in this case the cppyy that we pick up is the one that comes bundled with ROOT1, and this seems to be working in all other OS'es (or at least we have not yet heard any complaints) except for macOS. I simply assumed that ROOT will just forward to its cppyy internally which is why I went for cppyy directly.

Let me try via PyROOT to see if that indeed already solves this.

Footnotes

  1. At least python -c 'import cppyy; print(cppyy.__file__)' yields <root-prefix>/lib/root/cppyy/__init__.py.

from root.

tmadlener avatar tmadlener commented on June 8, 2024

Just tested this and we get the same error message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: <class cppyy.gbl.tuple_element<1,tuple<int,float,string,double> > at 0x146607890> has no attribute 'type'. Full details:
  type object 'tuple_element<1,tuple<int,float,string,double> >' has no attribute 'type'
  'tuple_element<1,tuple<int,float,string,double> >::type' is not a known C++ class
  'type' is not a known C++ template
  'type' is not a known C++ enum
>>> 

This looks a bit like some mismatch between clang or libc++ versions(?), but I don't know where the specifics would enter in this case.

from root.

guitargeek avatar guitargeek commented on June 8, 2024

Ah okay, interesting I didn't know you would pick up the cppyy from ROOT like this! Will investigate further next week when I can reproduce it. Interestingly, on my computer it works, even your original reproducer! So I think you're right, there must be some mismatch that happens with ROOT in your environment.

from root.

gaede avatar gaede commented on June 8, 2024

Has there been any resolution to this issue ?
I observe the same error on a rather virgin macbook pro (coreI5, 14.3) after installing ROOT w/ homebrew (no LCG or Ke4hep stack involved).

from root.

guitargeek avatar guitargeek commented on June 8, 2024

@gaede, I still fail to reproduce the issue, but I'm intending to make the reproducer a unit test, hoping to see the failure on some of the platforms.

from root.

gaede avatar gaede commented on June 8, 2024

@guitargeek, excellent thanks. Then we hope that it can be reproduced - and fixed ;-)

from root.

guitargeek avatar guitargeek commented on June 8, 2024

It doesn't look like it can be reproduced so far :( Maybe after merging the roottest PR, we will see the failure at some point somewhere in the nightlies.

from root.

gaede avatar gaede commented on June 8, 2024

Strange that you cannot reproduce this on any macos. I see this error even with using cppyy standalone:

import cppyy
cppyy.cppdef("""
#include <tuple>
#include <string>
using ATuple = std::tuple<int, float, std::string, double>;
""")

from cppyy.gbl import ATuple

cppyy.gbl.std.tuple_element[1, ATuple].type

print( cppyy )

Gives with cppyy and no root in the path:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: <class cppyy.gbl.std.tuple_element<1,std::tuple<int,float,std::string,double>> at 0x7f9365f9b1d0> has no attribute 'type'. Full details:
  type object 'tuple_element<1,std::tuple<int,float,std::string,d' has no attribute 'type'
  'std::tuple_element<1,std::tuple<int,float,std::string,double>>::type' is not a known C++ class
  'type' is not a known C++ template
  'type' is not a known C++ enum
>>> print (cppyy)
<module 'cppyy' from '/usr/local/lib/python3.9/site-packages/cppyy/__init__.py'>

And of course the same error using the cppyy shipped with root 6.26.06 and 6.28.04.

So to me it seems cppyy cannot deal with std::tuple on macos.

from root.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.