Error building Foxy: relocation R_X86_64_PC32 against symbol `_PyRuntime' (Focal)
I'm installing ROS2 Foxy, and when a run the command:
> cd ~/ros2_foxy/
> colcon build --symlink-install
I had the error:
Starting >>> rosidltypesupportc
Finished <<< rvizrendering [4.45s]
Starting >>> rmwconnextcpp
Finished <<< rmwconnextcpp [0.81s]
Starting >>> rosidlgeneratorcpp
Finished <<< rosidltypesupportc [1.95s]
Starting >>> rosidltypesupportcpp
Finished <<< rosidlgeneratorcpp [1.93s]
Starting >>> rosidlgeneratorpy
Finished <<< rosidltypesupportcpp [2.12s]
Starting >>> launchxml
--- stderr: rosidlgeneratorpy
/usr/bin/ld: /usr/local/lib/libpython3.8.a(warnings.o): relocation RX8664PC32 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/rosidlgeneratorpycustompython.dir/build.make:256: rosidlgeneratorpy/rosidlgeneratorpy/librosidlgeneratorpy_custompython.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:329: CMakeFiles/rosidlgeneratorpycustom_python.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
Failed <<< rosidlgeneratorpy [2.51s, exited with code 2]
Aborted <<< launch_xml [2.77s]
Summary: 117 packages finished [1min 33s]
1 package failed: rosidlgeneratorpy
1 package aborted: launchxml
1 package had stderr output: rosidlgenerator_py
191 packages not processed
What can I do to solve this error??
Asked by Jose-Araujo on 2021-08-25 17:04:14 UTC
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.
Asked by miura on 2021-08-25 19:13:06 UTC
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
?Asked by kak13 on 2021-08-25 20:15:36 UTC
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 directory
python3 --version
=>Python 3.8.10
Asked by Jose-Araujo on 2021-08-25 21:45:58 UTC
bash: /opt/ros/foxy/setup.bash: No such file or directory
THis means you don't have foxy installed. Try re-install foxy
Asked by kak13 on 2021-08-25 21:47:19 UTC
@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 nonamd64
?@kak13:
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
.Asked by gvdhoorn on 2021-08-26 01:44:31 UTC
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
Asked by kak13 on 2021-08-26 02:02:35 UTC
@gvdhoom : so I follow this instructions https://docs.ros.org/en/foxy/Installation/Ubuntu-Development-Setup.html. The recommended it's that https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Binary.html?
Asked by Jose-Araujo on 2021-08-26 14:52:38 UTC
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.Asked by gvdhoorn on 2021-08-27 01:40:48 UTC