Clear Filters
Clear Filters

How to increase CMAKE_OBJECT_PATH_MAX for ros2genmsg function

84 views (last 30 days)
I am working on windows 10.
I have enabled long paths and confirmed they are enabled in the registry.
I cannot shorten the name or directory path any further. The package name is a little long at 20 characters, but it is a actively worked on externally managed package so I cannot change it.
********* has 198 characters. The maximum full path to an object file is 250 characters (see CMAKE_OBJECT_PATH_MAX). Object file ********* cannot be safely placed under this directory. The build may not work correctly.
the path name in question it wants to use has 238 characters auto generated. This leaves me with 22 characters for whatever directories on my local machine. I am working collaboratively in a series of dropbox folders, so I would prefer not to move it around.
There NEEDs to be a way around this limitation. Please let me know if you have a solution or workaround other than changing the package name and paths.

Accepted Answer

Hari Krishna Kakarla
Hari Krishna Kakarla on 7 Oct 2022
Edited: Hari Krishna Kakarla on 7 Oct 2022
Hi Samuel,
I have enabled long paths by following this link: and confirmed they are enabled in registry after rebooting the machine. The issue persists after doing this work around as well.
I understand that you don't want to shorten your package names or paths. To work around this issue work in a working directory which is does not have a long absolute path to start with. You can also use a tool like "subst" to map your long path to a drive letter. For example in a Windows cmd.exe prompt run:
subst W: <folder path where your custom message packages exists>
And then in MATLAB use W:\ as your working directory and do ros2genmsg in W:\ drive. That should solve your problem. Incase If the issue still persists, please attach the build log of the ros2genmsg.

More Answers (0)


Find more on Custom Message Support in Help Center and File Exchange




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!