Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Build error Android with Scripting Backend set to IL2CPP: OpenGL/OpenGL.h not found

Discussion in 'VR' started by masta-yoda, May 3, 2021.

  1. masta-yoda

    masta-yoda

    Joined:
    Apr 19, 2020
    Posts:
    91
    Unable to build an Oculus (Android) platform with Scripting Backend set to IL2CPP. ARM64 architecture is selected in settings. Getting the following error in output:

    Exception: Unity.IL2CPP.Building.BuilderFailedException: In file included from C:\Sources\mycoolgame\Library\Il2cppBuildCache\Android\arm64-v8a\il2cppOutput\glmgr.cpp:7:
    In file included from C:\Sources\mycoolgame\Library\Il2cppBuildCache\Android\arm64-v8a\il2cppOutput/glmgr.h:15:
    C:\Sources\mycoolgame\Library\Il2cppBuildCache\Android\arm64-v8a\il2cppOutput/glmdisplay.h:13:10: fatal error: 'OpenGL/OpenGL.h' file not found
    #include <OpenGL/OpenGL.h>
    ^~~~~~~~~~~~~~~~~
    1 error generated.
    Invocation was: Executable: "C:\Program Files\Unity\Hub\Editor\2021.1.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++"
    Arguments: -DNET_4_0 -DUNITY_AOT -DIL2CPP_MONO_DEBUGGER_DISABLED -DGC_NOT_DLL -DRUNTIME_IL2CPP -DIL2CPP_ENABLE_WRITE_BARRIERS=1 -DIL2CPP_INCREMENTAL_TIME_SLICE=3 -DBASELIB_INLINE_NAMESPACE=il2cpp_baselib -DLINUX -DANDROID -DPLATFORM_ANDROID -D__linux__ -D__STDC_FORMAT_MACROS -DTARGET_ARM64 -I"C:\Program Files\Unity\Hub\Editor\2021.1.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\bdwgc\include" -I"C:\Program Files\Unity\Hub\Editor\2021.1.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\libil2cpp\include" -I"C:\Program Files\Unity\Hub\Editor\2021.1.2f1\Editor\Data\il2cpp\libil2cpp" -I"C:\Program Files\Unity\Hub\Editor\2021.1.2f1\Editor\Data\il2cpp\libil2cpp" -I"C:\Program Files\Unity\Hub\Editor\2021.1.2f1\Editor\Data\il2cpp\external\bdwgc\include" -I"C:\Program Files\Unity\Hub\Editor\2021.1.2f1\Editor\Data\il2cpp\external\xxHash" -I"C:\Program Files\Unity\Hub\Editor\2021.1.2f1\Editor\Data\il2cpp\external\baselib\Include" -I"C:\Program Files\Unity\Hub\Editor\2021.1.2f1\Editor\Data\il2cpp\external\baselib\Platforms\Android\Include" -I"C:\Program Files\Unity\Hub\Editor\2021.1.2f1\Editor\Data\il2cpp\libil2cpp\pch" -I"C:\Sources\mycoolgame\Library\Il2cppBuildCache\Android\arm64-v8a\il2cppOutput" -I"." -c -g -DNDEBUG -fexceptions -fno-limit-debug-info -fdata-sections -ffunction-sections -Wa,--noexecstack -fno-rtti -std=c++11 -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -fno-strict-overflow -fno-addrsig -fPIC -Os -stdlib=libc++ -target aarch64-linux-android21 -D__ANDROID_API__=21 -march=armv8-a -Wno-unused-value "C:\Sources\mycoolgame\Library\Il2cppBuildCache\Android\arm64-v8a\il2cppOutput\glmgr.cpp" -o "C:/Sources/mycoolgame/Library/il2cpp_android_arm64-v8a/il2cpp_cache/E675AF931E38E1C4697630B09DDA77C9.o"
    at Unity.IL2CPP.Building.CppProgramBuilder.BuildAllCppFiles(IEnumerable`1 sourceFilesToCompile, IBuildStatisticsCollector statisticsCollector)
    at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
    at il2cpp.Compilation.CompilationDriver.Run(RuntimePlatform platform, BuildingOptions buildingOptions, ReadOnlyCollection`1 matchedAssemblyMethodSourceFiles)
    at il2cpp.Program.DoRun(String[] args, RuntimePlatform platform, BuildingOptions buildingOptions, Boolean throwExceptions)
    UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at <4f969f18b6984883abf0f762caf9325d>:0)
    UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action`1[T] setupStartInfo) (at <4f969f18b6984883abf0f762caf9325d>:0)
    UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List`1[T] arguments, System.Action`1[T] setupStartInfo) (at <4f969f18b6984883abf0f762caf9325d>:0)
    UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data) (at <4f969f18b6984883abf0f762caf9325d>:0)
    UnityEditorInternal.IL2CPPBuilder.Run () (at <4f969f18b6984883abf0f762caf9325d>:0)
    UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String tempFolder, System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action`1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at <4f969f18b6984883abf0f762caf9325d>:0)
    UnityEditor.Android.PostProcessor.Tasks.RunIl2Cpp.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <cd517df1ccdc42249d6d08ee842341ea>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <cd517df1ccdc42249d6d08ee842341ea>:0)
    UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <cd517df1ccdc42249d6d08ee842341ea>:0)
    UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <cd517df1ccdc42249d6d08ee842341ea>:0)
    UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <4f969f18b6984883abf0f762caf9325d>:0)
    UnityEditor.BuildPipeline:BuildPlayer(String[], String, BuildTarget, BuildOptions)​
     
    Last edited: May 3, 2021
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,896
    This error means there is a file in the project named glmdisplay.h. IL2CPP will pick up .cpp and .h files in the project and attempt to compile them for you. Do you expect this file to be compiled as part of the project?
     
    masta-yoda likes this.
  3. masta-yoda

    masta-yoda

    Joined:
    Apr 19, 2020
    Posts:
    91
    I have searched for that file and found it in the Steam SDK (havesteamworks_sdk_150 folder). I believe it isn't expected to be compiled for the Android platform (Steam is used only for the PC build). Is there a way to exclude the whole folder from being accounted for when the Android platform is active?
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,896
    Yes, this folder or file will show up in the Unity editor as a source plugin. You can find it in the Unity editor and use the Plugin Inspector to disable it on a per-platform basis.
     
    masta-yoda likes this.
  5. masta-yoda

    masta-yoda

    Joined:
    Apr 19, 2020
    Posts:
    91
    I think I found how to see the Plugin Inspector and select platforms. There are plenty of files in that folder and changing these settings for one of them (which is causing the issue) is not helping. I had to select all the files in the glmgr folder and mark them for Android platform exclusion. After that, I was able to compile with IL2CPP enabled. THanks!

    Is there a way to exclude the whole folder or the approach I took is the correct one (select every plugin file and mark for exclusion)

    shot_210503_165323.png
    shot_210503_165242.png
     
  6. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,896
    I don't believe there is a way to exclude an entire folder now, unfortunately.
     
    masta-yoda likes this.
  7. masta-yoda

    masta-yoda

    Joined:
    Apr 19, 2020
    Posts:
    91
    Thanks for the details and quick help! By selecting every plugin in the folder and excluding Android I was able to fix the issue and create an ARM64 build with IL2CPP scripting backend enabled.