Error building Foxy: relocation R_X86_64_PC32 against symbol `_PyRuntime' (Focal)

asked 2021-08-25 17:04:14 -0500

Jose-Araujo gravatar image

updated 2021-08-26 01:43:30 -0500

gvdhoorn gravatar image

I'm installing ROS2 Foxy, and when a run the command:

> cd ~/ros2_foxy/
> colcon build --symlink-install

I had the error:

     Starting >>> rosidl_typesupport_c
    Finished <<< rviz_rendering [4.45s]            
    Starting >>> rmw_connext_cpp
    Finished <<< rmw_connext_cpp [0.81s]           
    Starting >>> rosidl_generator_cpp
    Finished <<< rosidl_typesupport_c [1.95s]      
    Starting >>> rosidl_typesupport_cpp                          
    Finished <<< rosidl_generator_cpp [1.93s]                                    
    Starting >>> rosidl_generator_py                                       
    Finished <<< rosidl_typesupport_cpp [2.12s]    
    Starting >>> launch_xml       
    --- stderr: rosidl_generator_py                
    /usr/bin/ld: /usr/local/lib/libpython3.8.a(_warnings.o): relocation R_X86_64_PC32 against symbol `_PyRuntime' can not be used when making a shared object; recompile with -fPIC
    /usr/bin/ld: final link failed: bad value
    collect2: error: ld returned 1 exit status
    make[2]: *** [CMakeFiles/rosidl_generator_py_custom__python.dir/build.make:256: rosidl_generator_py/rosidl_generator_py/librosidl_generator_py_custom__python.so] Error 1
    make[1]: *** [CMakeFiles/Makefile2:329: CMakeFiles/rosidl_generator_py_custom__python.dir/all] Error 2
    make: *** [Makefile:141: all] Error 2
    ---
    Failed   <<< rosidl_generator_py [2.51s, exited with code 2]
    Aborted  <<< launch_xml [2.77s]                               
    
    Summary: 117 packages finished [1min 33s]
      1 package failed: rosidl_generator_py
      1 package aborted: launch_xml
      1 package had stderr output: rosidl_generator_py
      191 packages not processed
    

What can I do to solve this error??

edit retag flag offensive close merge delete

Comments

How did you install python3.8? I think you don't use apt.

Also, it is recommended to attach the error as text, not as an image.

miura gravatar image miura  ( 2021-08-25 19:13:06 -0500 )edit

Did you download from apt on ros2?

what happen after you type this in terminal /source /opt/ros/foxy/setup.bash?

also whats the output of python3 --version?

kak13 gravatar image kak13  ( 2021-08-25 20:15:36 -0500 )edit

When I update the Ubuntu 18 to Ubuntu 20, the python3 it was install.

source /opt/ros/foxy/setup.bash => bash: /opt/ros/foxy/setup.bash: No such file or directorypython3 --version => Python 3.8.10

Jose-Araujo gravatar image Jose-Araujo  ( 2021-08-25 21:45:58 -0500 )edit

bash: /opt/ros/foxy/setup.bash: No such file or directory

THis means you don't have foxy installed. Try re-install foxy

kak13 gravatar image kak13  ( 2021-08-25 21:47:19 -0500 )edit
1

@Jose-Araujo: could you clarify why you want to build Foxy from source? There isn't really any immediate need when you are running Ubuntu 20.04. Or is this non amd64?

@kak13:

bash: /opt/ros/foxy/setup.bash: No such file or directory

THis means you don't have foxy installed. Try re-install foxy

I'm sort-of assuming @Jose-Araujo knows that. His build is failing, that would seem to be the main problem here.

Additionally, the default install location for a from-source build would be $colcon_ws/install, not /opt/ros.

gvdhoorn gravatar image gvdhoorn  ( 2021-08-26 01:44:31 -0500 )edit

I must be confused with colcon build then.

I assume that colcon build relies on /opt/ros/foxy/setup.bash to continue the colcon build.

My bad, Jose haha

kak13 gravatar image kak13  ( 2021-08-26 02:02:35 -0500 )edit
1

@gvdhoom: so I follow this instructions https://docs.ros.org/en/foxy/Installa.... The recommended it's that https://docs.ros.org/en/foxy/Installa...

Jose-Araujo gravatar image Jose-Araujo  ( 2021-08-26 14:52:38 -0500 )edit

Well, what is your purpose?

You could have a good reason for wanting to compile everything from sources, but if you can't think of any, you'd probably be better of with an installation using apt. So that would indeed be the second link you shared.

gvdhoorn gravatar image gvdhoorn  ( 2021-08-27 01:40:48 -0500 )edit