game-ci / unity-builder

Build Unity projects for different platforms

Home Page:https://github.com/marketplace/actions/unity-builder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Linux IL2CPP build failure with nested generics

timcassell opened this issue · comments

Bug description

Using nested generic structs with 4 levels, then building StandaloneLinux64 with IL2CPP backend and IL2CPP Code Generation set to "Faster runtime" causes the build to fail with no disk space.

How to reproduce

Paste this script into a Unity project, then build on github actions with Linux IL2CPP using any Unity version (I repro'd on 2019.4.40 and 6000.0.5).

Code

using UnityEngine;

public class GenericBuilder : MonoBehaviour
{
    void Start()
    {
        var result = new ResultBuilder()
            .Add(42)
            .Add(1.5f)
            .Add(true)
            .GetResult();
        Debug.Log($"Result: {result.value}");
    }
}

public struct Result<T>
{
    public T value;

    public Result(T value) => this.value = value;
}

public struct ResultBuilder
{
    public ResultBuilder<Value<T1>> Add<T1>(T1 value)
        => new(new Value<T1>(value));
}

public struct ResultBuilder<T1>
{
    private T1 result;

    public ResultBuilder(T1 result) => this.result = result;

    public ResultBuilder<T1, Value<T2>> Add<T2>(T2 value)
        => new((result, new Value<T2>(value)));
}

public struct ResultBuilder<T1, T2>
{
    private (T1, T2) result;

    public ResultBuilder((T1, T2) result) => this.result = result;

    public ResultBuilder<(T1, T2), Value<T3>> Add<T3>(T3 value)
        => new((result, new Value<T3>(value)));

    public Result<(T1, T2)> GetResult()
        => new(result);
}

public struct Value<T>
{
    public T value;

    public Value(T value) => this.value = value;

    public override string ToString()
        => "{" + value + "}";
}

Expected behavior

Build completes without error.

Additional details

The build completes successfully with StandaloneWindows64.
The build completes successfully with IL2CPP Code Generation set to "Faster (smaller) builds".
The build completes successfully with only 3 nested levels of generic structs.

Additional details 2

I first reported this bug to Unity. This was their response:

We tried to reproduce this again on other Linux systems which we do support, but had no luck. This looks like a unity-builder issue, as this is not reproduced anywhere else. Additionally, Unity does not currently support builds on headless Linux installations, containerized or otherwise.

You can try reporting it to them here: https://github.com/game-ci/unity-builder/issues.

If they confirm that this issue is not due to unity-builder, please reply to this ticket, so that it is reopened, and I’ll resume my discussion with our developers.

I was able to build it with no errors. You might've run out of disk space when running it on the runner since they don't have much free space by default. You'll either need a bigger runner or have a step to clear disk space before the build starts, like the Android example build workflow does since Android generally fails from lack of disk space.

Where is that android example?

Awesome, it worked after I added the jlumbroso/free-disk-space action.