UnrealBuildTool: The filename or extension is too long

Hi there.

error: The filename or extension is too long

caused by:
D:/android-ndk-r13\toolchains/llvm\prebuilt/windows\bin/clang++.exe

args:

Log.txt

Some people say that setting flag LOCAL_SHORT_COMMANDS in android.mk could help… But how to set this flag without changing engine source? As is know UE generates makefile dynamically?

Any fix?

Hello -link-,

Could you upload the full log file from the packaging process itself? This can be found in the project’s directory under Saved/Logs. It should be a .txt file with the same name as the project. This could just be an asset whose name is over the limit allowed.

Hello Matthew,

log file

It doesn’t seem like the error is being listed in this log. It may of been on this line but it doesn’t seem like it’s picking up the special characters: UnrealBuildTool: ����ࠡ�⠭��� �᪫�祭��:

Could you upload the log that it suggests taking a look at? You can find that information on this line:

[2016.12.26-06.07.38:008][319]UATHelper: Packaging (Android (ETC2)): Program.Main: ERROR: AutomationTool terminated with exception: AutomationTool.CommandUtils+CommandFailedException: Command failed (Result:-532462766): D:\Program Files (x86)\Epic Games\4.14\Engine\Binaries\DotNET\UnrealBuildTool.exe Cubitu Android Development -Project=C:\Projects\Cubitu\Cubitu.uproject C:\Projects\Cubitu\Cubitu.uproject -remoteini=“C:\Projects\Cubitu” -noxge -NoHotReload -ignorejunk. See logfile for details: ‘UnrealBuildTool-2016.12.26-09.07.23.txt’

File contains the same special characters).

Running UnrealBuildTool with arguments from log file under debugger gives me error “The filename or extension is too long”.

After some search ive discovered that UnrealBuildTool generates bundle of commands that do compile/link/other actions. When command (witch is just a string that passed to shell execute) exeeds 32767 characters it fails.

Partial workaround - reduce paths. But what about large projects?

This seems like a more than reasonable length. It would require a lot of nested folders with very long names to reach a 32,767 character length. Our internal game projects don’t even come close to this limit so it’s something you’ll just need to account for.

Matthew, my wrong.

One of my plugins was declared as runtime but in build dependencies it had reference to UnrealEd.

I don’t have particularly deep projects and hit the same issue. The commands required just get huge. There’s got to be a fix that can be implemented for this. Project name is 7 characters. I’ve just got Project/Source/UnrealProj (tokens not actual names, it’s shorter than that. So by the time you hit a non-root directory, the rest of the depth comes from Unreal project setup.

oh, and the bulk of the length comes from the unreal engine install directory. “C:/Program Files/Epic Games/4.14/Engine/Binaries/Android”, “C:/Program Files/Epic Games/4.14/Engine/Source/ThirdParty/” plus additional directories on those take up by far the bulk of the command.

So, changing the install to a shorter path wasn’t it for this case. After the change it was <8000 characters and still failing hitting an exception in the windows APIs about file length. Building the engine from source to get a proper callstack to look through and narrow it down.

Hello skyphyr,

File path length didn’t end up being this user’s issue, as shown in his answer below, this was caused by him having dependencies referencing UnrealEd, which is an editor-only module. This blocks you from being able to package. If you’re experiencing the same issue, can you check to see if you have the same problem? If not, please feel free to make your own post with more information.