lcm-proj / lcm

Lightweight Communications and Marshalling
GNU Lesser General Public License v2.1
1.01k stars 393 forks source link

make lcm-1.4.0 has strange error #511

Open KailinTong opened 7 months ago

KailinTong commented 7 months ago

I am reproducing this repo, where lcm-1.4.0 is a dependency. https://github.com/katie-hughes/unitree_ros2

I am using Ubuntu 22.04 and Python 3.11.5 When I tried to make lcm-1.4.0, I met the following error:.

/home/tongadm/lcm-1.4.0/lcm-python/module.c: In function ‘PyInit__lcm’:
/home/tongadm/lcm-1.4.0/lcm-python/module.c:46:34: error: lvalue required as left operand of assignment
   46 |     Py_TYPE(&pylcmeventlog_type) = &PyType_Type;
      |                                  ^
/home/tongadm/lcm-1.4.0/lcm-python/module.c:47:26: error: lvalue required as left operand of assignment
   47 |     Py_TYPE(&pylcm_type) = &PyType_Type;
      |                          ^
/home/tongadm/lcm-1.4.0/lcm-python/module.c:48:39: error: lvalue required as left operand of assignment
   48 |     Py_TYPE(&pylcm_subscription_type) = &PyType_Type;
      |                                       ^
make[2]: *** [lcm-python/CMakeFiles/lcm-python.dir/build.make:63: lcm-python/CMakeFiles/lcm-python.dir/module.c.o] Error 1
make[2]: Leaving directory '/home/tongadm/lcm-1.4.0/build'
make[1]: *** [CMakeFiles/Makefile2:1107: lcm-python/CMakeFiles/lcm-python.dir/all] Error 2
make[1]: Leaving directory '/home/tongadm/lcm-1.4.0/build'
make: *** [Makefile:163: all] Error 2

Do you have any ideas? Thank you in advance!

nosracd commented 6 months ago

I'm not familiar with that error, but older releases of LCM have issues with newer versions of Python. Have you tried building with an older version of Python or a newer version of LCM?

KailinTong commented 6 months ago

thank you very much for your reply. I would like to build LCM 1.4 with some older versions of Python. But do you know how to find which version of python is compatible with LCM 1.4?

nosracd commented 6 months ago

Unfortunately, I think your best bet will be trial and error. That information doesn't appear to have been documented anywhere in the 1.4 release.

It does appear there was Python 3 support. Also, LCM 1.4 was released in August 2018. So at the time the newest version of Python when LCM 1.4 was released would have been Python 3.7, so that may be a good starting point.

gaoboyi commented 2 months ago

/home/gaoboyi/lcm/lcm-python/module.c:1:10: fatal error: Python.h: 没有那个文件或目录 1 | #include | ^~~~~~ compilation terminated. make[2]: [lcm-python/CMakeFiles/lcm-python.dir/build.make:63:lcm-python/CMakeFiles/lcm-python.dir/module.c.o] 错误 1 make[1]: [CMakeFiles/Makefile2:977:lcm-python/CMakeFiles/lcm-python.dir/all] 错误 2 make: *** [Makefile:163:all] 错误 2 I have the similar issue

Revivelj commented 2 months ago

/home/gaoboyi/lcm/lcm-python/module.c:1:10: fatal error: Python.h: 没有那个文件或目录 1 | #include | ^~~~~~ compilation terminated. make[2]: [lcm-python/CMakeFiles/lcm-python.dir/build.make:63:lcm-python/CMakeFiles/lcm-python.dir/module.c.o] 错误 1 make[1]: [CMakeFiles/Makefile2:977:lcm-python/CMakeFiles/lcm-python.dir/all] 错误 2 make: *** [Makefile:163:all] 错误 2 I have the similar issue

I have the same issue.Have you solved it yet?

pinkkmin commented 2 months ago

/home/gaoboyi/lcm/lcm-python/module.c:1:10: fatal error: Python.h: 没有那个文件或目录 1 | #include | ^~~~~~ compilation terminated. make[2]: [lcm-python/CMakeFiles/lcm-python.dir/build.make:63:lcm-python/CMakeFiles/lcm-python.dir/module.c.o] 错误 1 make[1]: [CMakeFiles/Makefile2:977:lcm-python/CMakeFiles/lcm-python.dir/all] 错误 2 make: *** [Makefile:163:all] 错误 2 I have the similar issue

I have the same issue.Have you solved it yet?

Install Python Dev Package: sudo apt install python3-dev

Add find_package(Python3 3.8 REQUIRED COMPONENTS Interpreter Development) to the CMakeLists.txt file.

Replace 3.8 with your Python version.