ros-industrial / ros_qtc_plugin

ROS Qt Creator Plug-in (https://ros-qtc-plugin.readthedocs.io)
396 stars 213 forks source link

colcon build make params -j4 doesn't work #507

Closed coco-1998-2 closed 1 month ago

coco-1998-2 commented 1 month ago

I am using Qt creator 13.1, ros_qtc_plugin 13. Ubuntu22. ROS2 humble.

When I run Build ROS2 project, my ubuntu 22 always stuck, my cpu has 24 kernel, I checked ROS log, it used -j24 -L24, I want to reduce number of thread then Build ROS2 using colcon build.

In Qt creator - Build & Run - Colcon detail, I can find Colcon Build / CMake / Make parameterinput. I added "--parallel-workers=1" in Colcon Build params input, it has no error. But when I add "-j 4" in Make parameter, and Build in Qt Creator, it fails, "can not find -j in CMake....."

christian-rauch commented 1 month ago

You can pass additional colcon, CMake and Make arguments via the respective options in the Colcon Step.

coco-1998-2 commented 1 month ago

Screenshot from 2024-07-22 09-04-56 I haved added -j4 param in Qt creator, and when I build, it reports error: CMake Error: Unknown argument -j4

I put -j4 in Make argument.

09:04:31: Running steps for project btl_ros_project... 09:04:31: Starting: "/usr/bin/colcon" build --parallel-workers 1 --event-handlers status+ console_start_end+ --cmake-args -G 'CodeBlocks - Unix Makefiles' -DCMAKE_BUILD_TYPE=Debug --make-args -j4 Starting >>> beta_interfaces --- stderr: beta_interfaces CMake Error: Unknown argument -j4 CMake Error: Run 'cmake --help' for all supported options. Traceback (most recent call last): File "/usr/lib/python3/dist-packages/colcon_core/executor/init.py", line 91, in call rc = await self.task(*args, *kwargs) File "/usr/lib/python3/dist-packages/colcon_core/task/init.py", line 93, in call return await task_method(args, **kwargs) File "/usr/lib/python3/dist-packages/colcon_ros/task/ament_cmake/build.py", line 59, in build rc = await extension.build( File "/usr/lib/python3/dist-packages/colcon_cmake/task/cmake/build.py", line 87, in build rc = await self._reconfigure(args, env) File "/usr/lib/python3/dist-packages/colcon_cmake/task/cmake/build.py", line 182, in _reconfigure buildfile = get_buildfile(cmake_cache) File "/usr/lib/python3/dist-packages/colcon_cmake/task/cmake/init.py", line 114, in get_buildfile if 'Visual Studio' in generator: TypeError: argument of type 'NoneType' is not iterable

Failed <<< beta_interfaces [0.01s, exited with code 1]

Summary: 0 packages finished [0.12s] 1 package failed: beta_interfaces 1 package had stderr output: beta_interfaces 2 packages not processed argument of type 'NoneType' is not iterable 09:04:31: The process "/usr/bin/colcon" exited with code 1. Error while building/deploying project btl_ros_project (kit: Desktop) When executing step "Colcon Step" 09:04:31: Elapsed time: 00:00.

christian-rauch commented 1 month ago

Does the generated command line /usr/bin/colcon build --parallel-workers 1 --event-handlers status+ console_start_end+ --cmake-args -G 'CodeBlocks - Unix Makefiles' -DCMAKE_BUILD_TYPE=Debug --make-args -j4 work for you in the terminal outside of Qt Creator?

coco-1998-2 commented 1 month ago

Does the generated command line /usr/bin/colcon build --parallel-workers 1 --event-handlers status+ console_start_end+ --cmake-args -G 'CodeBlocks - Unix Makefiles' -DCMAKE_BUILD_TYPE=Debug --make-args -j4 work for you in the terminal outside of Qt Creator?

I run the command out of Qt, and it doesn't work for me.

(base) coco@coco-YangTianT4900k-93IRB:~/Downloads$ /usr/bin/colcon build --parallel-workers 1 --event-handlers status+ console_start_end+ --cmake-args -G 'CodeBlocks - Unix Makefiles' -DCMAKE_BUILD_TYPE=Debug --make-args -j4
Starting >>> boost_core
--- stderr: boost_core
CMake Error: Unknown argument -j4
CMake Error: Run 'cmake --help' for all supported options.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/colcon_core/executor/__init__.py", line 91, in __call__
    rc = await self.task(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/colcon_core/task/__init__.py", line 93, in __call__
    return await task_method(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/colcon_cmake/task/cmake/build.py", line 87, in build
    rc = await self._reconfigure(args, env)
  File "/usr/lib/python3/dist-packages/colcon_cmake/task/cmake/build.py", line 182, in _reconfigure
    buildfile = get_buildfile(cmake_cache)
  File "/usr/lib/python3/dist-packages/colcon_cmake/task/cmake/__init__.py", line 114, in get_buildfile
    if 'Visual Studio' in generator:
TypeError: argument of type 'NoneType' is not iterable
---
Failed   <<< boost_core [0.03s, exited with code 1]

Summary: 0 packages finished [5.68s]
  1 package failed: boost_core
  1 package had stderr output: boost_core
  193 packages not processed
christian-rauch commented 1 month ago

I run the command out of Qt, and it doesn't work for me.

If this also occurs without using the plugin, then this can hardly be caused by it. It looks like you are mixing your workspace with a "base" virtual environment. Check your Python environment and report colcon errors to the colcon project if you can reproduce them without the Qt Creator plugin.

coco-1998-2 commented 1 month ago

for colcon build command without -j4, it worked correctly for me, both in Qt and out of Qt. image

but when I add -j4, in Qt colcon build - make options, the build failed, both in Qt and out of Qt. image image Does it mean, the plugin -j4 param isn't working correctly? I think it is a plugin bug, doesn't generate command format correctly.

I am using Qt creator 13.1, ros_qtc_plugin 13. Ubuntu22. ROS2 humble.

christian-rauch commented 1 month ago

Does it mean, the plugin -j4 param isn't working correctly? I think it is a plugin bug, doesn't generate command format correctly.

What I mean is that if colcon produces an error outside of the plugin, then this is an error caused by colcon and not the plugin.

However, simply testing with colcon build --make-args -j4 tells me colcon: error: unrecognized arguments: --make-args -j4. I am not sure if this parameter was removed or wrongly added to the UI. @Levi-Armstrong Do you know how this ended up in the UI?

Levi-Armstrong commented 1 month ago

I am assume it was a copy paste, but not a 100% sure.

Levi-Armstrong commented 1 month ago

I do not that it does not exist with colcon and I believe you have to use environment variables if you want to pass make options.