Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
coco-1998-2 opened this issue Jul 20, 2024 · 9 comments · Fixed by #510
Closed

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

coco-1998-2 opened this issue Jul 20, 2024 · 9 comments · Fixed by #510

Comments

@coco-1998-2
Copy link

coco-1998-2 commented Jul 20, 2024

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
Copy link
Member

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

@coco-1998-2
Copy link
Author

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
Copy link
Member

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
Copy link
Author

coco-1998-2 commented Jul 31, 2024

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
Copy link
Member

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.

@christian-rauch christian-rauch closed this as not planned Won't fix, can't repro, duplicate, stale Jul 31, 2024
@coco-1998-2
Copy link
Author

coco-1998-2 commented Aug 1, 2024

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
Copy link
Member

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
Copy link
Member

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

@Levi-Armstrong
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants