Search Unity

Problem with building project on Linux with il2cpp (2019.3.13f1)

Discussion in 'Linux' started by ColeChittim, May 19, 2020.

  1. ColeChittim

    ColeChittim

    Joined:
    Aug 11, 2011
    Posts:
    59
    Hi, I've been attempting to build my project on Linux (specifically the Lubuntu distribution based on Ubuntu 19.10) using Unity 2019.3.13f1. I can't seem to get the game to build with il2cpp.
    I was getting an error where Clang could not be found so I've done a fresh install of clang and found online this could be fixed by defining your own sysroot which has brought me to a new issue where it appears clang can not exit after completing.

    Here is the MySysroot.cs file I'm using

    Code (CSharp):
    1. using System;
    2.     using System.Collections.Generic;
    3.     using UnityEditor.LinuxStandalone;
    4.     namespace UnityEditor.LinuxStandalone
    5.     {
    6.         public class MySysroot: Sysroot
    7.         {
    8.             public override string Name           => "MySysroot";
    9.             public override string HostPlatform   => "linux";
    10.             public override string HostArch       => "x86_64";
    11.             public override string TargetPlatform => "linux";
    12.             public override string TargetArch     => "x86_64";
    13.             public override bool Initialize() { return true; }
    14.             public override IEnumerable<string> GetIl2CppArguments()
    15.             {
    16.                 yield return "--sysroot-path=/";
    17.                 yield return "--tool-chain-path=/usr/lib/llvm-9";
    18.             }
    19.         }
    20.     }
    And here is the new error I'm getting that involving clang,


    Failed running /home/cole/Unity/Hub/Editor/2019.3.13f1/Editor/Data/il2cpp/build/deploy/net471/il2cpp.exe --convert-to-cpp --emit-null-checks --enable-array-bounds-check --dotnetprofile="unityaot" --compile-cpp --libil2cpp-static --platform="Linux" --architecture="x64" --configuration="ReleasePlus" --outputpath="/home/cole/Jelly Brawl/Temp/StagingArea/Data/Native/GameAssembly.so" --cachedirectory="/home/cole/Jelly Brawl/Assets/../Library/il2cpp_cache" --sysroot-path=/ --tool-chain-path=/usr/lib/llvm-9 --incremental-g-c-time-slice=3 --profiler-report --map-file-parser="/home/cole/Unity/Hub/Editor/2019.3.13f1/Editor/Data/Tools/MapFileParser/MapFileParser" --directory="/home/cole/Jelly Brawl/Temp/StagingArea/Data/Managed" --generatedcppdir="/home/cole/Jelly Brawl/Temp/StagingArea/Data/il2cppOutput"

    stdout:
    Building GameAssembly.so with LinuxClangToolChain
    Output directory: /home/cole/Jelly Brawl/Temp/StagingArea/Data/Native
    Cache directory: /home/cole/Jelly Brawl/Library/il2cpp_cache
    ObjectFiles: 311 of which compiled: 311
    Time Compile: 34933 milliseconds Il2CppInvokerTable.cpp
    Time Compile: 34218 milliseconds Il2CppAttributes.cpp
    Time Compile: 28785 milliseconds Lump_libil2cpp_vm.cpp
    Time Compile: 21839 milliseconds Il2CppTypeDefinitions.c
    Time Compile: 18012 milliseconds Lump_libil2cpp_icalls.cpp
    Time Compile: 14939 milliseconds Unity.TextMeshPro1.cpp
    Time Compile: 13960 milliseconds Generics31.cpp
    Time Compile: 12993 milliseconds Unity.TextMeshPro.cpp
    Time Compile: 12349 milliseconds mscorlib20.cpp
    Time Compile: 12015 milliseconds Unity.TextMeshPro2.cpp
    Total compilation time: 402191 milliseconds.
    il2cpp.exe didn't catch exception: Unity.IL2CPP.Building.BuilderFailedException: /usr/lib/llvm-9/bin/clang++ @/tmp/il2cpp/clangargs_82376A69657FB6F9B2FDF9B01805B4AD.txt

    clang: error: unable to execute command: Killed
    clang: error: linker command failed due to signal (use -v to see invocation)


    My apologies if I'm missing something obvious or this has already been asked. Any help or thoughts are appreciated.
    Thanks

    Edit: Would like to add this is happening on an old laptop I've tried reviving so the specs are pretty subpar. I mention this as I've found online that not having sufficient ram can lead to problems with Clang.
     
  2. ColeChittim

    ColeChittim

    Joined:
    Aug 11, 2011
    Posts:
    59
    Update: Attempted on a virtual machine running Ubuntu 20.04 with double the ram than the original machine and received the same error so I wanted to rule out possibly the specs being insufficient on the laptop that I mentioned at the end of post.

    Still looking for any advice or help
     
    deus0 likes this.
  3. ColeChittim

    ColeChittim

    Joined:
    Aug 11, 2011
    Posts:
    59
    Update: I was finally able to compile a build on the laptop!
    Installing the "Platforms Linux" package from the package manager appeared to fix this for me. I don't know why I needed this package as I can compile fine on MacOS and Windows without their respective platform package and the documentation for this package is sparse and I have no clue what is included.
    This should be marked as a dependency if it's required to compile il2cpp on linux or the documentation should be improved.


    I also disabled safety checks in my Burst settings but I don't believe this was the sole fix.

    Hope this helps someone down the line.

    Edit: What I tried with the package happened to be coincidence I think as it turns out my c++ compiler configuration was just downgraded to debug which caused the build to succeed. I've found also works for release but master is what causes the failure.
    Not sure how to remedy this but for the time being I guess I will only export Release builds for Linux
     
    Last edited: May 21, 2020
    deus0 likes this.
  4. andrews_unity

    andrews_unity

    Unity Technologies

    Joined:
    Dec 11, 2015
    Posts:
    264

    Can you provide more information on the issue you are having? Its not clear whats going on based on your post.
     
  5. Koksny

    Koksny

    Joined:
    Nov 15, 2017
    Posts:
    15
    Is namespace UnityEditor.LinuxStandalone part of Unity 2019.4? I can't in any way make it compile under Linux, it's always missing clang, even though it's properly installed in default path.
     
  6. andrews_unity

    andrews_unity

    Unity Technologies

    Joined:
    Dec 11, 2015
    Posts:
    264
    So we have identified an issue and or hoping to get the fix backported ASAP.
     
    NiirB likes this.
  7. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    476
    We stuck on same issue, fyi.
     
  8. Koksny

    Koksny

    Joined:
    Nov 15, 2017
    Posts:
    15
    I can confirm the issue is not present in Unity 2020 Beta.
     
  9. andrews_unity

    andrews_unity

    Unity Technologies

    Joined:
    Dec 11, 2015
    Posts:
    264
    Yea its being back-ported to 2019.4
     
    NiirB likes this.