- Home /
How exactly do I specify an IL2CPP compiler flag?
I'm trying to produce a WebGL build of my application. I'm running into an issue during IL2CPP:
note: use -fbracket-depth=N to increase maximum nesting level
1 error generated.
ERROR:root:compiler frontend failed to generate LLVM bitcode, halting
I have tried creating an editor script:
using UnityEditor;
public class CompilerFlags : Editor
{
void OnInit()
{
PlayerSettings.SetAdditionalIl2CppArgs("--compiler-flags=\"-fbracket-depth=1024\"");
}
}
I have also tried specifying -fbracket-depth=1024 in the "Scripting Define Symbols" in the PlayerSettings (see below) along with other variations including "-DIL2CPP_ADDITIONAL_ARGS=1:-fbracket-depth=1024", "IL2CPP_ADDITIONAL_ARGS=1:-fbracket-depth=1024", "IL2CPP_ADDITIONAL_ARGS:-fbracket-depth=1024"
Additionally, I have also tried adding this flag to the emscripten.config file (in C:\Program Files\Unity\Hub\Editor\2019.2.17f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\emscripten.config)
import os
LLVM_ROOT=os.getenv('LLVM')
NODE_JS=[os.getenv('NODE'),'--stack_size=8192','--max-old-space-size=4096','--fbracket-depth=1024']
EMSCRIPTEN_ROOT=os.getenv('EMSCRIPTEN')
SPIDERMONKEY_ENGINE = ''
V8_ENGINE = ''
TEMP_DIR = os.getenv('EMSCRIPTEN_TMP')
BINARYEN_ROOT = os.getenv('BINARYEN')
COMPILER_ENGINE = NODE_JS
JS_ENGINES = [NODE_JS]
JAVA = ''
The problem is, for all these variations I've tried, I can't see the compiler flag show up in my log when the build fails, so I'm assuming it's not actually being utilized by the compiler. What am I doing wrong/what alternatives do you have for setting this compiler flag?
To make things more interesting, if I don't make any of these modifications and instead check the box for a "Development Build" in the build settings, the build succeeds. Mind Blown
Notes: I'm running on Windows 10 with Unity 2019.2.17f1
I don't see a way that you can do this. The --compiler-flags=
option should work, but since it does not, I don't see any other options. Can you submit a bug report for this issue? This is something we should correct.