鱼香ROS社区
    • 版块
    • 最新
    • 未解决
    • 已解决
    • 群组
    • 注册
    • 登录
    紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
    提问前必看的发帖注意事项: 社区问答规则(小鱼个人)更新 | 高质量帖子发布指南

    colcon build报错

    已定时 已固定 已锁定 已移动
    动手学ROS2
    colcon build报错 编译出现错误
    2
    2
    175
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • 1
      1351305422
      最后由 编辑

      zztg@zztg:~/Camera_Deep_WS$ colcon build
      [0.193s] ERROR:colcon.colcon_core.package_identification:Exception in package identification extension 'ros' in 'src/OrbbecSDK_ROS2/orbbec_camera_msgs': 'utf-8' codec can't decode byte 0x80 in position 132: invalid start byte
      Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/colcon_core/package_identification/init.py", line 144, in _identify
      retval = extension.identify(_reused_descriptor_instance)
      File "/usr/lib/python3/dist-packages/colcon_ros/package_identification/ros.py", line 55, in identify
      pkg, build_type = get_package_with_build_type(str(desc.path))
      File "/usr/lib/python3/dist-packages/colcon_ros/package_identification/ros.py", line 166, in get_package_with_build_type
      pkg = _get_package(path)
      File "/usr/lib/python3/dist-packages/colcon_ros/package_identification/ros.py", line 183, in _get_package
      pkg = parse_package(path)
      File "/usr/lib/python3/dist-packages/catkin_pkg/package.py", line 583, in parse_package
      xml, filename = _get_package_xml(path)
      File "/usr/lib/python3/dist-packages/catkin_pkg/package.py", line 525, in _get_package_xml
      return f.read(), filename
      File "/usr/lib/python3.8/codecs.py", line 322, in decode
      (result, consumed) = self._buffer_decode(data, self.errors, final)
      UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 132: invalid start byte

      [0.194s] ERROR:colcon.colcon_core.package_identification:Exception in package identification extension 'ros' in 'src/OrbbecSDK_ROS2/orbbec_description': 'utf-8' codec can't decode byte 0x80 in position 132: invalid start byte
      Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/colcon_core/package_identification/init.py", line 144, in _identify
      retval = extension.identify(_reused_descriptor_instance)
      File "/usr/lib/python3/dist-packages/colcon_ros/package_identification/ros.py", line 55, in identify
      pkg, build_type = get_package_with_build_type(str(desc.path))
      File "/usr/lib/python3/dist-packages/colcon_ros/package_identification/ros.py", line 166, in get_package_with_build_type
      pkg = _get_package(path)
      File "/usr/lib/python3/dist-packages/colcon_ros/package_identification/ros.py", line 183, in _get_package
      pkg = parse_package(path)
      File "/usr/lib/python3/dist-packages/catkin_pkg/package.py", line 583, in parse_package
      xml, filename = _get_package_xml(path)
      File "/usr/lib/python3/dist-packages/catkin_pkg/package.py", line 525, in _get_package_xml
      return f.read(), filename
      File "/usr/lib/python3.8/codecs.py", line 322, in decode
      (result, consumed) = self._buffer_decode(data, self.errors, final)
      UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 132: invalid start byte

      [0.196s] ERROR:colcon.colcon_core.package_identification:Exception in package identification extension 'ros' in 'src/yahboomcar_astra': 'utf-8' codec can't decode byte 0x80 in position 132: invalid start byte
      Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/colcon_core/package_identification/init.py", line 144, in _identify
      retval = extension.identify(_reused_descriptor_instance)
      File "/usr/lib/python3/dist-packages/colcon_ros/package_identification/ros.py", line 55, in identify
      pkg, build_type = get_package_with_build_type(str(desc.path))
      File "/usr/lib/python3/dist-packages/colcon_ros/package_identification/ros.py", line 166, in get_package_with_build_type
      pkg = _get_package(path)
      File "/usr/lib/python3/dist-packages/colcon_ros/package_identification/ros.py", line 183, in _get_package
      pkg = parse_package(path)
      File "/usr/lib/python3/dist-packages/catkin_pkg/package.py", line 583, in parse_package
      xml, filename = _get_package_xml(path)
      File "/usr/lib/python3/dist-packages/catkin_pkg/package.py", line 525, in _get_package_xml
      return f.read(), filename
      File "/usr/lib/python3.8/codecs.py", line 322, in decode
      (result, consumed) = self._buffer_decode(data, self.errors, final)
      UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 132: invalid start byte

      Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/lib/python3.8/distutils/core.py", line 215, in run_setup
      exec(f.read(), g)
      ValueError: source code string cannot contain null bytes
      [0.372s] ERROR:colcon.colcon_core.package_identification:Exception in package identification extension 'python_setup_py' in 'src/yahboomcar_visual': Command '['/usr/bin/python3', '-c', 'import sys;from contextlib import suppress;exec("with suppress(ImportError): from setuptools.extern.packaging.specifiers import SpecifierSet");exec("with suppress(ImportError): from 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 144, 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 249, 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 296, in get_setup_information
      result = subprocess.run(
      File "/usr/lib/python3.8/subprocess.py", line 516, in run
      raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['/usr/bin/python3', '-c', 'import sys;from contextlib import suppress;exec("with suppress(ImportError): from setuptools.extern.packaging.specifiers import SpecifierSet");exec("with suppress(ImportError): from 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.

      Starting >>> orbbec_camera_msgs
      Starting >>> orbbec_description
      Starting >>> ros2_orbslam
      Starting >>> yahboomcar_KCFTracker
      Starting >>> yahboomcar_mediapipe
      Starting >>> yahboomcar_msgs
      Starting >>> yahboomcar_slam
      Failed <<< orbbec_camera_msgs [0.19s, exited with code 1]
      Failed <<< orbbec_description [0.18s, exited with code 1]
      Failed <<< yahboomcar_KCFTracker [0.18s, exited with code 1]
      Aborted <<< yahboomcar_mediapipe [0.17s]
      Aborted <<< ros2_orbslam [1.07s]
      Aborted <<< yahboomcar_msgs [1.27s]
      Aborted <<< yahboomcar_slam [1.42s]

      Summary: 0 packages finished [1.79s]
      3 packages failed: orbbec_camera_msgs orbbec_description yahboomcar_KCFTracker
      4 packages aborted: ros2_orbslam yahboomcar_mediapipe yahboomcar_msgs yahboomcar_slam
      1 package had stderr output: ros2_orbslam
      1 package not processed

      1 条回复 最后回复 回复 引用 0
      • 小伊小
        机器人小伊
        最后由 编辑

        从您提供的错误信息来看,主要问题在于 colcon build 过程中尝试读取和解析某些 ROS 包的 package.xml 文件时遇到了编码问题。错误提示 'utf-8' codec can't decode byte 0x80 in position 132: invalid start byte 表明在解析这些文件时,Python 解释器无法用 UTF-8 编码来解码某些字节。这通常意味着 package.xml 文件可能被错误地保存为其他编码格式,或者文件已损坏。

        此外,还有一个关于 setup.py 的错误,这可能是因为文件包含了无法用 UTF-8 解码的 null 字节。

        以下是一些可能的解决步骤:

        1. 检查 package.xml 文件的编码:

          • 使用文本编辑器(如 VSCode, Sublime Text, 或 Notepad++)打开出错的 package.xml 文件。
          • 查看并确认文件的编码是否为 UTF-8。如果不是,尝试将文件保存为 UTF-8 编码。
          • 检查文件是否有不可见的特殊字符或损坏的部分。
        2. 清理和修复 setup.py 文件:

          • 打开 src/yahboomcar_visual 目录下的 setup.py 文件。
          • 检查文件中是否有 null 字节(通常是不可见的,但可以通过一些高级文本编辑器检测)。
          • 确保文件是干净且正确编码为 UTF-8。
        3. 重新生成或恢复 package.xml 和 setup.py:

          • 如果可能,尝试从源代码管理(如 Git)或其他备份中恢复这些文件。
          • 对于 ROS 包,如果 package.xml 文件丢失或损坏,可以重新使用 catkin_create_pkg 或 ros2 pkg create 命令来生成新的包结构。
        4. 使用命令行工具检查文件:

          • 在 Linux 上,你可以使用 file 命令来检查文件的编码类型,例如:file -bi package.xml。
          • 使用 iconv 或其他工具尝试转换文件编码。
        5. 清理和重建工作空间:

          • 在工作空间中运行 colcon clean 来清理之前的构建结果。
          • 再次尝试 colcon build。

        如果上述步骤仍然无法解决问题,可能需要更深入地检查 ROS 包的源代码或寻求从包的维护者那里获取帮助。


        以上为生成回答,仅供参考~

        我是小伊,已接入ChatGpt,所有回复,仅供参考~

        1 条回复 最后回复 回复 引用 0
        • 第一个帖子
          最后一个帖子
        皖ICP备16016415号-7
        Powered by NodeBB | 鱼香ROS