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

    microROS依赖无法构建

    已定时 已固定 已锁定 已移动
    MicroROS
    micro-ros stm32 ubundu24.04 platformio编译报错
    2
    3
    359
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • U
      unicorn
      最后由 编辑

      开发环境:Ubuntu24.04,板型STM32F407ZG,开发框架PlatformIO + Arduino

      目的:在开发板上安装microROS以实现和树莓派之间的串口通信

      问题:在platformio中增加lib_deps之后microROS依赖无法构建

      详细:
      期末课程设计选用了树莓派5,然后发现树莓派5上能装的Ubuntu就只有24.04,别的版本试了多少次了根本装不上去,只能接着做了,然后开发板买了块便宜的STM32F407ZG,上面只有串口能用,于是想用串口和树莓派通信
      目前底盘和电机驱动板基本功能都完成了,树莓派和雷达也都正常,树莓派上的microAgent也按照小鱼的教程安装成功,但是到开发板这里安装microROS时出了问题,不管是用小鱼在gitee上的依赖包(lib_deps=https://gitee.com/ohhuo/micro_ros_platformio.git)
      还是Github上的(lib_deps=https://github.com/micro-ROS/micro_ros_platformio.git)都不能成功构建依赖

      gitee的报错代码如下

      Processing black_f407zg (platform: ststm32; board: black_f407zg; framework: arduino)
      --------------------------------------------------------------------------------------------------------------------------------------------------------
      Verbose mode can be enabled via `-v, --verbose` option
      CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/black_f407zg.html
      PLATFORM: ST STM32 (18.0.0) > Black STM32F407ZG
      HARDWARE: STM32F407ZGT6 168MHz, 128KB RAM, 1MB Flash
      DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink, stlink)
      PACKAGES:
       - framework-arduinoststm32 @ 4.20900.0 (2.9.0)
       - framework-cmsis @ 2.50900.0 (5.9.0)
       - toolchain-gccarmnoneeabi @ 1.120301.0 (12.3.1)
      LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
      LDF Modes: Finder ~ chain, Compatibility ~ soft
      Installing importlib-resources with pip at PlatformIO environment
      C:\Users\16371\.platformio\penv\Scripts\python.exe -m pip install importlib-resources
      Requirement already satisfied: importlib-resources in c:\users\16371\.platformio\penv\lib\site-packages (6.4.5)
      Installing pyyaml with pip at PlatformIO environment
      C:\Users\16371\.platformio\penv\Scripts\python.exe -m pip install pyyaml
      Requirement already satisfied: pyyaml in c:\users\16371\.platformio\penv\lib\site-packages (6.0.2)
      Installing markupsafe==2.0.1 with pip at PlatformIO environment
      C:\Users\16371\.platformio\penv\Scripts\python.exe -m pip install markupsafe==2.0.1
      Requirement already satisfied: markupsafe==2.0.1 in c:\users\16371\.platformio\penv\lib\site-packages (2.0.1)
      Configuring black_f407zg with transport serial
      micro-ROS already built
      Found 15 compatible libraries
      Scanning dependencies...
      Dependency Graph
      |-- micro_ros_platformio @ 0.0.1+sha.1ae444b
      Building in release mode
      Linking .pio\build\black_f407zg\firmware.elf
      c:/users/16371/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: skipping incompatible .pio/libdeps/black_f407zg/micro_ros_platformio/libmicroros\libmicroros.a when searching for -lmicroros
      c:/users/16371/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: cannot find -lmicroros: No such file or directory
      collect2.exe: error: ld returned 1 exit status
      *** [.pio\build\black_f407zg\firmware.elf] Error 1
      

      更改为github后有以下输出

      Resolving black_f407zg dependencies...
      Removing unused dependencies...
      Library Manager: Removing micro_ros_platformio @ 0.0.1+sha.1ae444b
      Library Manager: micro_ros_platformio@0.0.1+sha.1ae444b has been removed!
      Library Manager: Installing git+https://github.com/micro-ROS/micro_ros_platformio.git
      git version 2.46.0.windows.1
      Cloning into 'C:\Users\16371\.platformio\.cache\tmp\pkg-installing-nhn56hfd'...
      
      Library Manager: micro_ros_platformio@0.0.1+sha.ed22dfe has been installed!
      Updating metadata for the vscode IDE...
      UserSideException: Processing black_f407zg (platform: ststm32; board: black_f407zg; framework: arduino)
      --------------------------------------------------------------------------------
      Verbose mode can be enabled via `-v, --verbose` option
      CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/black_f407zg.html
      PLATFORM: ST STM32 (18.0.0) > Black STM32F407ZG
      HARDWARE: STM32F407ZGT6 168MHz, 128KB RAM, 1MB Flash
      DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink, stlink)
      PACKAGES: 
       - framework-arduinoststm32 @ 4.20900.0 (2.9.0) 
       - framework-cmsis @ 2.50900.0 (5.9.0) 
       - toolchain-gccarmnoneeabi @ 1.120301.0 (12.3.1)
      LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
      LDF Modes: Finder ~ chain, Compatibility ~ soft
      Installing importlib-resources with pip at PlatformIO environment
      C:\Users\16371\.platformio\penv\Scripts\python.exe -m pip install importlib-resources
      Requirement already satisfied: importlib-resources in c:\users\16371\.platformio\penv\lib\site-packages (6.4.5)
      Installing pyyaml with pip at PlatformIO environment
      C:\Users\16371\.platformio\penv\Scripts\python.exe -m pip install pyyaml
      Requirement already satisfied: pyyaml in c:\users\16371\.platformio\penv\lib\site-packages (6.0.2)
      Installing markupsafe==2.0.1 with pip at PlatformIO environment
      C:\Users\16371\.platformio\penv\Scripts\python.exe -m pip install markupsafe==2.0.1
      Requirement already satisfied: markupsafe==2.0.1 in c:\users\16371\.platformio\penv\lib\site-packages (2.0.1)
      Installing empy==3.3.4 with pip at PlatformIO environment
      C:\Users\16371\.platformio\penv\Scripts\python.exe -m pip install empy==3.3.4
      Requirement already satisfied: empy==3.3.4 in c:\users\16371\.platformio\penv\lib\site-packages (3.3.4)
      Configuring black_f407zg with transport serial
      Downloading micro-ROS dev dependencies
      	 - Downloaded ament_cmake
      	 - Downloaded ament_lint
      	 - Downloaded ament_package
      	 - Downloaded googletest
      	 - Downloaded ament_cmake_ros
      	 - Downloaded ament_index
      Building micro-ROS dev dependencies
      UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb2 in position 4: invalid start byte:
        File "C:\Users\16371\.platformio\penv\Lib\site-packages\platformio\builder\main.py", line 173:
          env.SConscript("$BUILD_SCRIPT")
        File "C:\Users\16371\.platformio\packages\tool-scons\scons-local-4.8.1\SCons\Script\SConscript.py", line 620:
          return _SConscript(self.fs, *files, **subst_kw)
        File "C:\Users\16371\.platformio\packages\tool-scons\scons-local-4.8.1\SCons\Script\SConscript.py", line 280:
          exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
        File "C:\Users\16371\.platformio\platforms\ststm32\builder\main.py", line 120:
          target_elf = env.BuildProgram()
        File "C:\Users\16371\.platformio\packages\tool-scons\scons-local-4.8.1\SCons\Util\envs.py", line 252:
          return self.method(*nargs, **kwargs)
        File "C:\Users\16371\.platformio\penv\Lib\site-packages\platformio\builder\tools\piobuild.py", line 62:
          env.ProcessProjectDeps()
        File "C:\Users\16371\.platformio\packages\tool-scons\scons-local-4.8.1\SCons\Util\envs.py", line 252:
          return self.method(*nargs, **kwargs)
        File "C:\Users\16371\.platformio\penv\Lib\site-packages\platformio\builder\tools\piobuild.py", line 152:
          plb = env.ConfigureProjectLibBuilder()
        File "C:\Users\16371\.platformio\packages\tool-scons\scons-local-4.8.1\SCons\Util\envs.py", line 252:
          return self.method(*nargs, **kwargs)
        File "C:\Users\16371\.platformio\penv\Lib\site-packages\platformio\builder\tools\piolib.py", line 1202:
          project.install_dependencies()
        File "C:\Users\16371\.platformio\penv\Lib\site-packages\platformio\builder\tools\piolib.py", line 987:
          if _is_builtin(spec):
        File "C:\Users\16371\.platformio\penv\Lib\site-packages\platformio\builder\tools\piolib.py", line 979:
          for lb in self.env.GetLibBuilders():
        File "C:\Users\16371\.platformio\packages\tool-scons\scons-local-4.8.1\SCons\Util\envs.py", line 252:
          return self.method(*nargs, **kwargs)
        File "C:\Users\16371\.platformio\penv\Lib\site-packages\platformio\builder\tools\piolib.py", line 1115:
          lb = LibBuilderFactory.new(env, lib_dir)
        File "C:\Users\16371\.platformio\penv\Lib\site-packages\platformio\builder\tools\piolib.py", line 60:
          obj = globals()[clsname](env, path, verbose=verbose)
        File "C:\Users\16371\.platformio\penv\Lib\site-packages\platformio\builder\tools\piolib.py", line 153:
          self.process_extra_options()
        File "C:\Users\16371\.platformio\penv\Lib\site-packages\platformio\builder\tools\piolib.py", line 301:
          self.env.SConscript(
        File "C:\Users\16371\.platformio\packages\tool-scons\scons-local-4.8.1\SCons\Script\SConscript.py", line 620:
          return _SConscript(self.fs, *files, **subst_kw)
        File "C:\Users\16371\.platformio\packages\tool-scons\scons-local-4.8.1\SCons\Script\SConscript.py", line 280:
          exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
        File "D:\Documents\PlatformIO\Projects\robot_motion_control\.pio\libdeps\black_f407zg\micro_ros_platformio\extra_script.py", line 171:
          build_microros()
        File "D:\Documents\PlatformIO\Projects\robot_motion_control\.pio\libdeps\black_f407zg\micro_ros_platformio\extra_script.py", line 113:
          builder.run('{}/metas/{}'.format(main_path, selected_board_meta), cmake_toolchain.path, microros_user_meta)
        File "D:\Documents\PlatformIO\Projects\robot_motion_control\.pio\libdeps\black_f407zg\micro_ros_platformio\microros_utils\library_builder.py", line 64:
          self.build_dev_environment()
        File "D:\Documents\PlatformIO\Projects\robot_motion_control\.pio\libdeps\black_f407zg\micro_ros_platformio\microros_utils\library_builder.py", line 103:
          print("Build dev micro-ROS environment failed: \n {}".format(result.stderr.decode("utf-8")))
      

      求解

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

        您遇到的问题主要涉及到在PlatformIO环境下配置和构建microROS库时的兼容性和依赖问题。从您提供的错误信息来看,有几个关键点需要注意和解决:

        1. 库不兼容问题:

          • 错误信息中提到 .pio/libdeps/black_f407zg/micro_ros_platformio/libmicroros\libmicroros.a 文件不兼容。这通常意味着预编译的库文件与您的目标硬件或编译器不兼容。
        2. UnicodeDecodeError:

          • 这个错误通常发生在尝试用错误的编码方式解码字节流时。在您的案例中,可能是在处理microROS的某些构建脚本或输出时遇到了非UTF-8编码的字符。
        3. 解决步骤:

          • 确保库版本和硬件兼容:检查micro_ros_platformio库是否支持STM32F407ZG。有时库的某些版本可能只支持特定的硬件或编译器版本。
          • 尝试手动构建microROS:由于预编译库可能不兼容,您可以尝试从源代码手动构建microROS。这通常涉及到克隆microROS的仓库,并根据硬件和编译器配置进行构建。
          • 更新PlatformIO和工具链:确保您的PlatformIO和所有相关工具链都是最新的,以支持最新的硬件和库。
          • 修改编码处理:对于UnicodeDecodeError,您可以尝试修改相关的脚本,确保在处理输出时使用正确的编码(如果可能,尝试使用系统默认编码或显式指定为utf-8)。
          • 查看日志和文档:仔细查看PlatformIO和microROS的文档,以及构建过程中的详细日志,以获取更多关于错误的信息。
          • 社区和论坛:访问PlatformIO和microROS的社区论坛,看看是否有其他用户遇到并解决了类似的问题。
        4. 替代方案:

          • 如果上述方法都不可行,您可以考虑使用其他开发框架或工具链,如直接使用STM32CubeMX和Keil/IAR等IDE,这些工具可能提供更好的硬件支持和库兼容性。
        5. 树莓派与STM32的通信:

          • 确保您的STM32开发板上的串口配置正确,并且树莓派上的串口通信程序也正确配置。您可以使用简单的串口通信测试程序来验证这一点。

        希望这些建议能帮助您解决问题!如果问题仍然存在,您可能需要更详细地检查每个步骤,并可能需要更具体的错误信息来进一步诊断问题。


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

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

        1 条回复 最后回复 回复 引用 0
        • U
          unicorn
          最后由 编辑

          查看GitHub上microROS_platformio的readme文件发现它是支持olimex_e407的,这块板的芯片就是f407zg,所以芯片型号上应该没有问题

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