I get an error about long paths on Windows when I try to build the project. What can I do?
The names of the files and directories in the OpenJAUS SDK can be quite long. A significant portion of the code in the SDK is generated from JSIDL (of which we have no control), and we do our best to make the code readable and easy to navigate. As such, we try to avoid the use of abbreviations in the names of the files and directories. These long names can cause issues on Windows when the total path length exceeds the maximum allowed length of 260 characters. If you encounter this issue, there are a few things you can do to work around it.
Tip 1: Enabled long paths in Windows
Newer versions of Windows support long paths, but they are disabled by default. To enable long paths, you can use the Group Policy Editor or the Registry Editor. See more information here.
Tip 2: Start with the shortest path possible
Start with the shortest path possible. For example, instead of cloning the repository to C:\Users\your-username\Documents\path\to\your\project
, clone it to C:\path\to\your\project
or simply C:\openjaus
. This will help keep the total path length down.
Tip 3: Map the directory to a drive letter
If the path is still too long, you can try mapping the directory to a drive letter using the subst
command.
For example, to map the directory C:\path\to\your\project
to the drive letter Z:
, run the following command:
subst Z: C:\path\to\your\project
Then, navigate to the Z:
drive and run the build command from there.
Learn more about the subst
command here.
NOTE
The default install location for final binaries is side-by-side with the {iop-sdk folder}
, i.e. {iop-sdk folder}/../install
. As such, if you map the {iop-sdk folder}
to a drive letter directly, you will need to change the install location. You can set an explict location using CMAKE_INSTALL_PREFIX
, e.g. -DCMAKE_INSTALL_PREFIX=C:/path/to/your/install
or you disable the default openjaus install location using OJ_USE_DEFAULT_INSTALL_DIR
, e.g. -DOJ_USE_DEFAULT_INSTALL_DIR=OFF
.
Disabling the default openjaus install location will install the files to the CMake default location unless a custom location is set.