How to prevent "file name too long" issue during compilation in Windows

asked 2020-08-01 22:46:40 -0500

sujoykroy gravatar image

Hello,

I am having issue to build a ROS package in windows. I am getting file name too long error. Is there any command line switch in catkin_make to bypass this issue?

Steps to reproduce the issue: On a Windows machine, install ROS noetic as per the instructions stated on http://wiki.ros.org/Installation/Windows.

Open a ROS environment with command like ,
C:\Windows\System32\cmd.exe /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64&& set ChocolateyInstall=c:\opt\chocolatey&& c:\opt\ros\noetic\x64\setup.bat

Assuming that ROS and its related files are in C:\opt\ros\noetic folder, run the following commands in that ROS environment shell.

mkdir C:\opt\ros\noetic\workspace
mkdir C:\opt\ros\noetic\workspace\src
git clone https://github.com/ros-controls/ros_controllers
git clone https://github.com/ros-drivers/four_wheel_steering_msgs
git clone https://github.com/ros-controls/urdf_geometry_parser
catkin_init_workspace
cd ..
catkin_make -DCATKIN_ENABLE_TESTING=0

Near the end of the compilation/building, following message appears,

[ 74%] Built target position_controllers
Scanning dependencies of target rqt_joint_trajectory_controller_rqt_joint_trajectory_controller_exec_install_python
[ 76%] Building CXX object ros_controllers/rqt_joint_trajectory_controller/CMakeFiles/rqt_joint_trajectory_controller_rqt_joint_trajectory_controller_exec_install_python.dir/catkin_generated/add_python_executable/rqt_joint_trajectory_controller_rqt_joint_trajectory_controller_exec_install_python/rqt_joint_trajectory_controller.cpp.obj
rqt_joint_trajectory_controller.cpp
c1xx: fatal error C1081: 'CMakeFiles\rqt_joint_trajectory_controller_rqt_joint_trajectory_controller_exec_install_python.dir\catkin_generated\add_python_executable\rqt_joint_trajectory_controller_rqt_joint_trajectory_controller_exec_install_python\rqt_joint_trajectory_controller.cpp.obj': file name too long
NMAKE : fatal error U1077: 'C:\PROGRA2\MICROS1\2019\COMMUN1\VC\Tools\MSVC\14261.288\bin\Hostx64\x64\cl.exe' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
Invoking "nmake" failed
edit retag flag offensive close merge delete

Comments

@sujoykroy, in order to overcome the path limitation, one can enable the Long Paths support by editing the registry key. You can find more details here.

Sean Yen gravatar image Sean Yen  ( 2020-10-19 18:49:52 -0500 )edit