riebl / artery

OMNeT++ V2X simulation framework for ETSI ITS-G5
GNU General Public License v2.0
203 stars 131 forks source link

error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’} #297

Closed Enough7 closed 1 year ago

Enough7 commented 1 year ago

Hey, I built the repo as mentioned on the project's homepage. In the final step cmake --build . I got the following error:

In file included from /home/userp/Desktop/artery/extern/pybind11/include/pybind11/attr.h:13,
                 from /home/userp/Desktop/artery/extern/pybind11/include/pybind11/pybind11.h:45,
                 from /home/userp/Desktop/artery/extern/pybind11/include/pybind11/embed.h:12,
                 from /home/userp/Desktop/artery/src/artery/storyboard/Binding.cc:21:
/home/userp/Desktop/artery/extern/pybind11/include/pybind11/cast.h: In function ‘std::string pybind11::detail::error_string()’:
/home/userp/Desktop/artery/extern/pybind11/include/pybind11/cast.h:446:36: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
  446 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
      |                                    ^~
In file included from /usr/include/python3.11/Python.h:42,
                 from /home/userp/Desktop/artery/extern/pybind11/include/pybind11/detail/common.h:124,
                 from /home/userp/Desktop/artery/extern/pybind11/include/pybind11/pytypes.h:12,
                 from /home/userp/Desktop/artery/extern/pybind11/include/pybind11/cast.h:13:
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
   22 | typedef struct _frame PyFrameObject;
      |                ^~~~~~

I figured out it is probably an issue with pybind11. I was on commit 8de7772c. I fixed it by entering the following in my terminal from the artery-root directory:

git submodule update --remote extern/pybind11/

Now pybind11 is on commit 8b03ffa7 and it works.

~Edit: I downloaded an older python version. This could be a factor as well:~

$ python3 --version
Python 3.7.16

$ python --version
Python 3.11.2