Docker Windows “DllNotFoundException: fmodstudioL”

Ok I’m facing a super strange behavior. Seems like this is a recurrent issue with fmod library. Here is the log of my build machine.

Unity 2021.3.28f1
fmod 2.02.13
We are trying to build in a GitLab Runner with docker windows executor using an GameCI image

The weird thing is that it some times work, I even disable the cache and made sure that the cache produced by previous builds would not work and made sure that there were no changes on the build machine before trying to do a build.

Asset Pipeline Refresh: Total: 0.315 seconds - Initiated by StopAssetImportingV2(NoUpdateAssetOptions)
	Summary:
		Imports: total=3 (actual=3, local cache=0, cache server=0)
		Asset DB Process Time: managed=0 ms, native=267 ms
		Asset DB Callback time: managed=14 ms, native=32 ms
		Scripting: domain reloads=0, domain reload time=0 ms, compile time=0 ms, other=0 ms
		Project Asset Count: scripts=11877, non-scripts=7116
		Asset File Changes: new=3, changed=3, moved=0, deleted=0
		Scan Filter Count: 7
	InvokeBeforeRefreshCallbacks: 1.356ms
	ApplyChangesToAssetFolders: 0.114ms
	Scan: 8.531ms
	OnSourceAssetsModified: 0.130ms
	InitializeImportedAssetsSnapshot: 108.663ms
	GetAllGuidsForCategorization: 1.387ms
	CategorizeAssets: 24.162ms
	ImportOutOfDateAssets: 147.790ms (8.230ms without children)
		ImportManagerImport: 130.697ms (120.333ms without children)
			ImportInProcess: 10.304ms
			UpdateCategorizedAssets: 0.061ms
		ReloadImportedAssets: 0.003ms
		EnsureUptoDateAssetsAreRegisteredWithGuidPM: 5.423ms
		InitializingProgressBar: 0.013ms
		PostProcessAllAssetNotificationsAddChangedAssets: 1.979ms
		OnDemandSchedulerStart: 1.446ms
	ReloadSourceAssets: 2.933ms
	UnloadImportedAssets: 2.166ms
	PostProcessAllAssets: 39.104ms
	Hotreload: 6.931ms
	GatherAllCurrentPrimaryArtifactRevisions: 1.059ms
	UnloadStreamsBegin: 0.399ms
	LoadedImportedAssetsSnapshotReleaseGCHandles: 6.821ms
	GetLoadedSourceAssetsIDs: 8.129ms
	GetLoadedSourceAssetsSnapshot: 3.657ms
	PersistCurrentRevisions: 1.150ms
	UnloadStreamsEnd: 0.122ms
	GenerateScriptTypeHashes: 0.291ms
	Untracked: -10.069ms
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/fmodstudioL
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/fmodstudioL.dll
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/fmodstudioL.dll
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/fmodstudioL
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/libfmodstudioL
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/libfmodstudioL.dll
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/libfmodstudioL.dll
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/libfmodstudioL
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/fmodstudioL
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/fmodstudioL.dll
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/fmodstudioL.dll
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/fmodstudioL
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/libfmodstudioL
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/libfmodstudioL.dll
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/libfmodstudioL.dll
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/libfmodstudioL
DllNotFoundException: fmodstudioL assembly:<unknown assembly> type:<unknown type> member:(null)
  at (wrapper managed-to-native) FMOD.Memory.FMOD5_Memory_GetStats(int&,int&,bool)
  at FMOD.Memory.GetStats (System.Int32& currentalloced, System.Int32& maxalloced, System.Boolean blocking) [0x00000] in C:\builds\polygon\rsml\project\Assets\Assemblies\Thirdparty\FMOD\src\fmod.cs:991 
  at FMODUnity.RuntimeUtils.EnforceLibraryOrder () [0x00000] in C:\builds\polygon\rsml\project\Assets\Assemblies\Thirdparty\FMOD\src\RuntimeUtils.cs:543 
  at FMODUnity.EditorUtils.CreateSystem () [0x0000a] in C:\builds\polygon\rsml\project\Assets\Assemblies\Thirdparty\FMOD\src\Editor\EditorUtils.cs:510 
  at FMODUnity.EditorUtils.get_System () [0x0000c] in C:\builds\polygon\rsml\project\Assets\Assemblies\Thirdparty\FMOD\src\Editor\EditorUtils.cs:597 
  at FMODUnity.EventManager.UpdateCache () [0x00269] in C:\builds\polygon\rsml\project\Assets\Assemblies\Thirdparty\FMOD\src\Editor\EventManager.cs:179 
  at FMODUnity.EventManager.RefreshBanks () [0x00000] in C:\builds\polygon\rsml\project\Assets\Assemblies\Thirdparty\FMOD\src\Editor\EventManager.cs:33 
  at FMODUnity.EventManager.BuildTargetChanged () [0x00000] in C:\builds\polygon\rsml\project\Assets\Assemblies\Thirdparty\FMOD\src\Editor\EventManager.cs:1045 
  at FMODUnity.EventManager+<>c.<.cctor>b__16_0 () [0x00000] in C:\builds\polygon\rsml\project\Assets\Assemblies\Thirdparty\FMOD\src\Editor\EventManager.cs:571 
  at FMODUnity.BuildStatusWatcher.SetBuildInProgress (System.Boolean inProgress) [0x0003c] in C:\builds\polygon\rsml\project\Assets\Assemblies\Thirdparty\FMOD\src\Editor\EditorUtils.cs:1669 
  at FMODUnity.BuildStatusWatcher+BuildProcessor.OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport report) [0x00000] in C:\builds\polygon\rsml\project\Assets\Assemblies\Thirdparty\FMOD\src\Editor\EditorUtils.cs:1695 
  at UnityEditor.Build.BuildPipelineInterfaces+<>c__DisplayClass16_0.<OnBuildPreProcess>b__1 (UnityEditor.Build.IPreprocessBuildWithReport bpp) [0x00000] in <308d48a21a3e462ba091bd758b25b1e6>:0 
  at UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPair[T1,T2] (System.Collections.Generic.List`1[T] oneInterfaces, System.Action`1[T] invocationOne, System.Collections.Generic.List`1[T] twoInterfaces, System.Action`1[T] invocationTwo, System.Boolean exitOnFailure) [0x000ff] in <308d48a21a3e462ba091bd758b25b1e6>:0 
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEditor.Build.BuildPipelineInterfaces:InvokeCallbackInterfacesPair(List`1, Action`1, List`1, Action`1, Boolean)
UnityEditor.Build.BuildPipelineInterfaces:OnBuildPreProcess(BuildReport)
UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[], Boolean)
UnityEditor.BuildPipeline:BuildPlayerInternal(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[])
UnityEditor.BuildPipeline:BuildPlayer(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[])
UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions)
polygon.Utility_Editor.BuildPipeline.BuildLauncher:BuildPlayer(Boolean, Boolean, Boolean) (at Assets\Assemblies\polygon\Utility Editor\BuildPipeline\BuildLauncher.cs:176)
polygon.Utility_Editor.BuildPipeline.<BuildStepsAsync>d__11:MoveNext() (at Assets\Assemblies\polygon\Utility Editor\BuildPipeline\BuildLauncher.cs:116)
polygon.Utility_Editor.BuildPipeline.BuildLauncher:BuildStepsAsync(Boolean, Boolean, Boolean, Boolean, Boolean)
polygon.Utility_Editor.BuildPipeline.<BuildPlayerCleanAsync>d__8:MoveNext() (at Assets\Assemblies\polygon\Utility Editor\BuildPipeline\BuildLauncher.cs:68)
polygon.Utility_Editor.BuildPipeline.BuildLauncher:BuildPlayerCleanAsync(Boolean, Boolean)
polygon.Utility_Editor.BuildPipeline.<Build>d__0:MoveNext() (at Assets\Assemblies\polygon\Utility Editor\BuildPipeline\Builder.cs:16)
System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start(<Build>d__0&)
polygon.Utility_Editor.BuildPipeline.Builder:Build()

(Filename: Assets/Assemblies/Thirdparty/FMOD/src/fmod.cs Line: 991)

DisplayProgressNotification: Build Failed
Error building Player: DllNotFoundException: fmodstudioL assembly:<unknown assembly> type:<unknown type> member:(null)
Unloading 3 Unused Serialized files (Serialized files now loaded: 0)
Unloading 278 unused Assets / (1.2 MB). Loaded Objects now: 9725.
Memory consumption went from 239.6 MB to 238.4 MB.
Total: 37.535500 ms (FindLiveObjects: 1.709000 ms CreateObjectMapping: 1.909700 ms MarkObjects: 32.791900 ms  DeleteObjects: 1.122500 ms)

Build Finished, Result: Failure.
Cancelling DisplayDialog: Build Result Build Failed
Time: 0 hours 0 minutes
Errors: 2
Warnings: 0

I already checked the import settings and everthing looks right…

The only thing that I noticed compared with previous versions of unity is that there is now a Editor section for the dlls and you can not select weather it is x86 or x64_86.

for x86 the setting is this

the other settings look right

1 Like

Someone is reporting a similar issue also on batch mode with other library
using unity3d 2021.3.27f1 but in Linux

Unity 269749

Well I downgraded to 2021.3.15f1 and the issue is also there :pensive:

I don’t know if this is related but this part of the log also seems suspicious.

I compared the log in my machine and the one on docker and this something I do not see in my machine

Refreshing native plugins compatible for Editor in 6.57 ms, found 14 plugins.
Starting: C:\Program Files\Unity\Hub\Editor\2021.3.15f1\Editor\Data\bee_backend.exe --profile="Library/Bee/backend_profiler0.traceevents" --stdin-canary --dagfile="Library/Bee/1900b0aE.dag" --continue-on-failure ScriptAssemblies
WorkingDir: C:/builds/projects/rsml/project
ExitCode: 4 Duration: 2s231ms
[             ] Require frontend run.  Library/Bee/1900b0aE.dag couldn't be loaded

I don’t have a solution for you, sorry. The fact that it actually works for you sometimes suggests that it’s an issue with your build infrastructure not your Unity project or FMOD. I suspect it’s something to do with Unity running in Gitlab Runner and/or docker but, beyond that, I have no further suggestions.

I know other people are successfully using game-ci with FMOD but I’m not aware of any guides/tutorials and we certainly don’t have an official one ourselves.

Hi @Andrew

Thanks for the reply, I created a test project where I only have fmod with a simple example bank.

I was able to reproduce it 100% with this sample project.

I can provide you with the project and also the dockerfiles that I used for it as well for the gitlab-ci.yml and gitlab-runner config.toml file.

I just tried to downgrade Fmod version from v2.02.13 to v2.02.09 but no difference I still get the same error.

@Andrew

I created a post with all the details the sample project and the config files.

https://forum.unity.com/threads/build-script-fails-only-in-batch-mode-when-running-in-a-docker-windows-container.1470294/

Why is Unity trying to load from this path?

C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/libfmodstudioL.dll

I would expect that all the plug-ins stuff would be on my project directory right?

Like under Library

I did some progress… so the reason Unity was failing to load the libfmodstudioL.dll was because my docker image was missing a DLL.

image

After adding this DLL to the docker image one of the errors went away but now I have new issue still related to FMOD.

Any idea what could be producing this error?

FMOD Studio: Encountered Error: ERR_OUTPUT_INIT Error initializing output device.

(Filename: Assets/Assemblies/Thirdparty/FMOD/src/RuntimeUtils.cs Line: 585)

FMOD Studio: Encountered Error: ERR_INVALID_HANDLE An invalid object handle was used.

(Filename: Assets/Assemblies/Thirdparty/FMOD/src/RuntimeUtils.cs Line: 585)

FMOD Studio: Encountered Error: ERR_INVALID_PARAM An invalid parameter was passed to this function.

(Filename: Assets/Assemblies/Thirdparty/FMOD/src/RuntimeUtils.cs Line: 585)

FMOD Studio: Encountered Error: ERR_INVALID_HANDLE An invalid object handle was used.

(Filename: Assets/Assemblies/Thirdparty/FMOD/src/RuntimeUtils.cs Line: 585)

FMOD Studio: Encountered Error: ERR_INVALID_PARAM An invalid parameter was passed to this function.

(Filename: Assets/Assemblies/Thirdparty/FMOD/src/RuntimeUtils.cs Line: 585)

FMOD Studio: Encountered Error: ERR_INVALID_PARAM An invalid parameter was passed to this function.

(Filename: Assets/Assemblies/Thirdparty/FMOD/src/RuntimeUtils.cs Line: 585)

FMOD Studio: Encountered Error: ERR_INVALID_PARAM An invalid parameter was passed to this function.

(Filename: Assets/Assemblies/Thirdparty/FMOD/src/RuntimeUtils.cs Line: 585)

FMOD Studio: Encountered Error: ERR_INVALID_HANDLE An invalid object handle was used.

(Filename: Assets/Assemblies/Thirdparty/FMOD/src/RuntimeUtils.cs Line: 585)

FMOD: Bank refresh failed: FMODBanks/Desktop\Master.strings.bank is not a valid bank.

(Filename: Assets/Assemblies/Thirdparty/FMOD/src/RuntimeUtils.cs Line: 593)

DisplayProgressNotification: Build Failed
Error building Player: 9 errors

full_log.txt (31.5 KB)

That’s a good find Leon, thank you.

We can fix the missing dll issue on our end by loading it dynamically. We’ll implement this fix in 2.02.18.

As for the next error that you’ve uncovered, can you run your build again but with more logging enabled please? In the FMOD Settings in Unity, set “Logging Level” to “Log” and make sure “Enable API Error Logging” is checked and send us the resulting log. This will tell us specifically what’s failing so we can change our code to handle it more gracefully and get another fix in for 2.02.18.

But, in the meantime, you can probably work around these issues by a). Making sure that msacm.dll is present (which you have already done) and b). Adding this snippet of code to Assets\Plugins\FMOD\src\Editor\EditorUtils.cs in CreateSystem() where we call system.initialize :

Replace this line :

            CheckResult(system.initialize(256, FMOD.Studio.INITFLAGS.ALLOW_MISSING_PLUGINS | FMOD.Studio.INITFLAGS.SYNCHRONOUS_UPDATE, FMOD.INITFLAGS.NORMAL, IntPtr.Zero));

With these lines :

            result = system.initialize(256, FMOD.Studio.INITFLAGS.ALLOW_MISSING_PLUGINS | FMOD.Studio.INITFLAGS.SYNCHRONOUS_UPDATE, FMOD.INITFLAGS.NORMAL, IntPtr.Zero);
            if (result != FMOD.RESULT.OK)
            {
                lowlevel.setOutput(FMOD.OUTPUTTYPE.NOSOUND);
                system.initialize(256, FMOD.Studio.INITFLAGS.ALLOW_MISSING_PLUGINS | FMOD.Studio.INITFLAGS.SYNCHRONOUS_UPDATE, FMOD.INITFLAGS.NORMAL, IntPtr.Zero);
            }
1 Like

Thanks @Andrew

I was starting to lose hope :slight_smile:

I added the logs that you requested and applied the patch you provided and I still get the latest errors.

after_patch_log.txt (150.9 KB)

I wonder if it might be related to the docker container not having any actual audio device :thinking:

Hi, just to close this ticket at the end I was not able to use GameCI images.

I had to create my own Docker images from scratch by using

mcr.microsoft.com/windows:1809

Now FMOD is not throwing any error.

The only thing I can confirm is that the other docker image didn’t have the Windows Audio Service active might be related to the latest errors.

@Andrew so the conclusion is that the current version of FMOD does not work with some of the Windows Docker images that Microsoft provide.

The GameCI images for at Windows also do not work. I let them know and maybe there is enough interest from them to create a compatible image for FMOD.

:v: :sunglasses:

Nah, we don’t like that conclusion.

We believe we’ve got fixes for both the issues you ran into and we’re working to get them into a future release. Thanks for your sleuthing and detailed repro info.

Cheers

1 Like

Great let me know if I can help you further in anyway.

:slight_smile:

1 Like

We’re hitting this issue too. Can you confirm that this has been addressed in the most recent release? We’re still on FMOD Unity 2.02.09

The missing msacm32.dll issue was fixed in 2.02.18. The other issue is scheduled to be fixed in 2.02.21. I’ve logged your interest in our internal tracker.

I’m using FMOD 2.02.21 and I’m running into the same issue. Building my project headless on a windows build machine results on the following error:

FMOD Studio: Encountered Error: ERR_OUTPUT_INIT Error initializing output device.

Incidentally, the audio banks are never copied to the StreamingAssets (which is where I want them to be).

I tried making the following call in my build process:

FMODUnity.RuntimeManager.CoreSystem.setOutput(OUTPUTTYPE.NOSOUND);

with no success…

We are currently working on a fix for this and hope to have it out in the next release.

Running into the same issue using GameCI.

  1. I tried enabling Windows audio service.
  2. Tried installing a 3rd party audio service (Scream)
  3. Tried adding the NoAudio tag in the initialization of the game (doubt I did this part wrong.)

If it’s a bug/ issue that Fmod can fix, then I will just keep an eye on this thread. Thanks a bunch