Linux native build from source: small bug in FPaths::MakePathRelativeTo

After following the good documentation at A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums :

make SlateViewer fails with a


Assertion failed: IsValidIndex(Index) [File:Runtime/Core/Public/Containers/UnrealString.h] [Line: 203]
String index out of bounds: Index 1 from a string with a length of 1
error.

After debugging it through gdb, I found the error to point to:

#3  FPaths::MakePathRelativeTo (InPath=…, InRelativeTo=)
at /1/install/UnrealEngine/Engine/Source/Runtime/Core/Private/Misc/Paths.cpp:727

the problem being the fact that my path starts with a single character (/1) and the code assumes there will always be at least two characters.

It’s probably a very isolated case.

Workaround: mount your 1-character root dir under a different path. (/opt/install works, for example).

Hey -

What Linux environment are you working in? I tried to clone the 4.9 branch into a folder that was one character in length and was able to complete “make SlateViewer” with no error. This was using Ubuntu 15.04. What steps did you take before running make SlateViewer?

Cheers

Hey , I’m on Ubuntu 14.10 with a lowlatency kernel, but normally it shouldn’t matter, as the code
does a simple string check.

TargetArray[0][1] == TEXT(':')

The out of bounds assertion only happens if the FIRST directory in the path is a one-letter dir, as the path gets parsed into TargetArray and only the first step gets verified (probably because of “C:” constructions).

Hey -

What is the file path that you’re using that has this issue? I’ve tried cloning the engine into a folder located in a/1/UnrealEngine and there was no issue with cloning/building the engine. Could you also post the entire terminal output from when the build failed?

Hi ,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.

Hi, sorry for the delay (and the lack of harddisk space :slight_smile: ), I can still reproduce the bug:

Under /1/install/UnrealEngine :
(I have a different partition mounted on /1, but I don’t think that should make a difference)

./GenerateProjectFiles.sh  2>project1.txt 1>&2
make SlateViewer ARGS=-clean 2>build1.txt 1>&2 
make SlateViewer 2>>build1.txt 1>&2

Under /opt/install/UnrealEngine :
(after sudo mount -o bind /1/install /opt/install)

./GenerateProjectFiles.sh  2>projectopt.txt 1>&2
make SlateViewer ARGS=-clean 2>buildopt.txt 1>&2 
make SlateViewer 2>>buildopt.txt 1>&2

I am getting the same error trying to start UE editor from NFS user directory. The directory mounted under /u/home.
Here is the error:
[1454][username@machine-name:/Users/Shared/UnrealEngine/4.9/Engine/Binaries/Mac]$ ./UE4Editor.app/Contents/MacOS/UE4Editor
Assertion failed: IsValidIndex(Index) [File:Runtime/Core/Public/Containers/UnrealString.h] [Line: 203]
String index out of bounds: Index 1 from a string with a length of 1

It is UE4.9.1 on OS X 10.10.5

Hey -

I’ve entered a bug report (UE-21691) to investigate this issue. For now the best solution would be to either increase the length of the folder name where the engine is located or to place that folder inside another folder with a longer name.

Cheers

Looks like this might happen on people with old versions of Windows who are cross-compiling and using Windows 10 Linux subsystem. Mine put my files in /mnt/c/ while my partners was just /c/.