ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Building ROS2 Rolling from source: issues with gfortran / lit

asked 2023-01-24 13:22:18 -0600

achille gravatar image

updated 2023-01-24 14:14:41 -0600

I am trying to compile ROS2 from source on Docker (for development purposes) but am running into several issues while doing so. Any pointers at what might be wrong here?

  • Operating System:
    • Ubuntu22.04 (Jammy)
  • Installation type:
    • source
  • Version or commit hash:

Steps to reproduce issue

Essentially follow the instructions at Linux Development Setup for Rolling. I created a Dockerfile that executes these in this gist

Expected behavior

Build completes and the example can be run inside the container

Actual behavior

colcon build --symlink-install fails at FortranCInterface which seems to be a CMake dependency.

Before that, I get several variations of this error which seems unrelated:


Traceback (most recent call last):
   File "<string>", line 1, in <module>
   File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 10, in <module>
     import distutils.core
   File "/usr/lib/python3/dist-packages/numpy/distutils/__init__.py", line 24, in <module>
     from . import ccompiler
   File "/usr/lib/python3/dist-packages/numpy/distutils/ccompiler.py", line 9, in <module>
     from distutils.ccompiler import (
 ImportError: cannot import name 'compiler_class' from partially initialized module 'distutils.ccompiler' (most likely due to a circular import) (/usr/lib/python3/dist-packages/numpy/distutils/ccompiler.py)
 [1.143s] ERROR:colcon.colcon_core.package_identification:Exception in package identification extension 'python_setup_py' in 'lib/python3/dist-packages/numpy': Command '['/usr/bin/python3', '-c', "import sys;from setuptools.extern.packaging.specifiers import SpecifierSet;from distutils.core import run_setup;dist = run_setup(    'setup.py', script_args=('--dry-run',), stop_after='config');skip_keys = ('cmdclass', 'distclass', 'ext_modules', 'metadata');data = {    key: value for key, value in dist.__dict__.items()     if (        not key.startswith('_') and         not callable(value) and         key not in skip_keys and         key not in dist.display_option_names    )};data['metadata'] = {    k: v for k, v in dist.metadata.__dict__.items()     if k not in ('license_files', 'provides_extras')};sys.stdout.buffer.write(repr(data).encode('utf-8'))"]' returned non-zero exit status 1.
 Traceback (most recent call last):
   File "/usr/lib/python3/dist-packages/colcon_core/package_identification/__init__.py", line 142, in _identify
     retval = extension.identify(_reused_descriptor_instance)
   File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 48, in identify
     config = get_setup_information(setup_py)
   File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 241, in get_setup_information
     _setup_information_cache[hashable_env] = _get_setup_information(
   File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 281, in _get_setup_information
     result = subprocess.run(
   File "/usr/lib/python3.10/subprocess.py", line 524, in run
     raise CalledProcessError(retcode, process.args,
 subprocess.CalledProcessError: Command '['/usr/bin/python3', '-c', "import sys;from setuptools.extern.packaging.specifiers import SpecifierSet;from distutils.core import run_setup;dist = run_setup(    'setup.py', script_args=('--dry-run',), stop_after='config');skip_keys = ('cmdclass', 'distclass', 'ext_modules', 'metadata');data = {    key: value for key, value in dist.__dict__.items()     if (        not key.startswith('_') and         not callable(value) and         key not in skip_keys and         key not in dist.display_option_names    )};data['metadata'] = {    k: v for k, v in dist.metadata.__dict__.items()     if k not in ('license_files', 'provides_extras')};sys.stdout.buffer.write(repr(data).encode('utf-8'))"]' returned non-zero exit status 1.

Compilation finally fails with the following:


 Starting >>> IntelFortranImplicit
 -- stderr: FortranCInterface
 CMake Error at CMakeLists ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-01-24 18:17:08 -0600

updated 2023-01-24 18:18:53 -0600

You're executing a colcon operation in the root of the container's filesystem.

The default value for colcon's --base-paths argument is actually ., not src. This is why colcon marks the build, install, and log subdirectories of the workspace with COLCON_IGNORE.

You could modify the colcon invocation with --base-paths src, but it would be better to create an empty subdirectory in the container to to serve as the workspace rather than dumping all of these files directly in /.

To explain why this is failing, colcon is crawling the entire filesystem and finds things that look an awful lot like packages, and then it tries to build them and unsurprisingly fails to do so.

EDIT:Here's the section of the installation instructions where a new directory is created for the workspace: https://docs.ros.org/en/rolling/Insta...

edit flag offensive delete link more

Comments

Great find, thanks! It's curious to me that the default isn't src but perhaps there's an explanation for that.

achille gravatar image achille  ( 2023-01-25 13:05:32 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2023-01-24 13:22:18 -0600

Seen: 141 times

Last updated: Jan 24 '23