Ask Your Question

error building moveit workspace: cannot find __main__ module

asked 2020-11-16 12:03:53 -0600

GUENNI gravatar image

updated 2020-11-17 05:33:26 -0600

I installed ROS noetic according to doc from ros repos. Then I added MOVEIT along the tutorial When I build the workspace with catkin build, I always get following error:

/usr/bin/python3: can't find '__main__' module in '/opt/ros/noetic/lib/python3/dist-packages/em'
CMake Error at /opt/ros/noetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):

  "/usr/bin/python3" "/opt/ros/noetic/lib/python3/dist-packages/em"
  "--raw-errors" "-F"
  "/opt/ros/noetic/share/catkin/cmake/em/pkg.pc.em") returned error code 1
Call Stack (most recent call first):
  /opt/ros/noetic/share/catkin/cmake/em_expand.cmake:25 (safe_execute_process)
  /opt/ros/noetic/share/catkin/cmake/catkin_package.cmake:327 (em_expand)
  /opt/ros/noetic/share/catkin/cmake/catkin_package.cmake:102 (_catkin_package)
  CMakeLists.txt:7 (catkin_package)

I tried already to reinstall module empy, but without any success. Any ideas, what to to try next?

CMakerror.log added:

Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /KubuntuDaten/ws_moveit/build/catkin_tools_prebuild/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_cc0d0/fast && /usr/bin/make -f CMakeFiles/cmTC_cc0d0.dir/build.make CMakeFiles/cmTC_cc0d0.dir/build
make[1]: Verzeichnis „/KubuntuDaten/ws_moveit/build/catkin_tools_prebuild/CMakeFiles/CMakeTmp“ wird betreten
Building C object CMakeFiles/cmTC_cc0d0.dir/src.c.o
/usr/lib/ccache/cc   -DCMAKE_HAVE_LIBC_PTHREAD   -o CMakeFiles/cmTC_cc0d0.dir/src.c.o   -c /KubuntuDaten/ws_moveit/build/catkin_tools_prebuild/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_cc0d0
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_cc0d0.dir/link.txt --verbose=1
/usr/lib/ccache/cc  -DCMAKE_HAVE_LIBC_PTHREAD    -rdynamic CMakeFiles/cmTC_cc0d0.dir/src.c.o  -o cmTC_cc0d0 
/usr/bin/ld: CMakeFiles/cmTC_cc0d0.dir/src.c.o: in function `main':
src.c:(.text+0x46): undefined reference to `pthread_create'
/usr/bin/ld: src.c:(.text+0x52): undefined reference to `pthread_detach'
/usr/bin/ld: src.c:(.text+0x63): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_cc0d0.dir/build.make:87: cmTC_cc0d0] Fehler 1
make[1]: Verzeichnis „/KubuntuDaten/ws_moveit/build/catkin_tools_prebuild/CMakeFiles/CMakeTmp“ wird verlassen
make: *** [Makefile:121: cmTC_cc0d0/fast] Fehler 2

Source file was:
#include <pthread.h>

void* test_func(void* data)
  return data;

int main(void)
  pthread_t thread;
  pthread_create(&thread, NULL, test_func, NULL);
  pthread_join(thread, NULL);
  pthread_atfork(NULL, NULL, NULL);

  return 0;

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /KubuntuDaten/ws_moveit/build/catkin_tools_prebuild/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_bbc34/fast && /usr/bin/make -f CMakeFiles/cmTC_bbc34.dir/build.make CMakeFiles/cmTC_bbc34.dir/build
make[1]: Verzeichnis „/KubuntuDaten/ws_moveit/build/catkin_tools_prebuild/CMakeFiles/CMakeTmp“ wird betreten
Building C object CMakeFiles/cmTC_bbc34.dir/CheckFunctionExists.c.o
/usr/lib/ccache/cc   -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_bbc34.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.16/Modules/CheckFunctionExists.c
Linking C ...
edit retag flag offensive close merge delete


The above link mentions this for ROS Neotic -

Note August 2020 For Noetic there is currently an issue with catkin_tools and the workaround is:

pip3 install git+

Did you check that?

skpro19 gravatar image skpro19  ( 2020-11-16 12:54:08 -0600 )edit

Yes, I did. There was another issue with ros-noetic-fcl, which I installed from the ros-testing repo.

GUENNI gravatar image GUENNI  ( 2020-11-17 01:15:51 -0600 )edit

Can you please check if you have all the dependencies installed? See this question.

skpro19 gravatar image skpro19  ( 2020-11-17 03:28:42 -0600 )edit

I repeated the check & installation of dependencies with rosdep, according to the installation doc and @gvdhoorn, repeated the catkin config. Still have the same errror.

GUENNI gravatar image GUENNI  ( 2020-11-17 04:52:12 -0600 )edit

In Cmake logs I found errors and add them above. Because I am not deep enough in these software packages I am not shure what they mean.

GUENNI gravatar image GUENNI  ( 2020-11-17 05:40:19 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2021-01-06 04:15:56 -0600

GUENNI gravatar image

Found the reason. In python3/dist-packages were remains of an empy package. After a complete removal of /opt/ros/noetic and a new installation everything is clean and running.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2020-11-16 12:03:53 -0600

Seen: 246 times

Last updated: Jan 06 '21