Building Unity Windows/MacOS player on Linux references wrong libraries?

Hi,

Just a heads up, build a Windows player on a Linux machine does not work with the current Unity integration. I get errors like these during build time:

Refreshing native plugins compatible for Editor in 41.29 ms, found 7 plugins.
Couldn’t open Assets/External/FMOD/Plugins/x86_64/libfmodstudio.so, error: libfmod.so: cannot open shared object file: No such file or directory
FMOD.Memory:GetStats(Int32&, Int32&) (at Assets/External/FMOD/Plugins/FMOD/Wrapper/fmod.cs:1810)
FMOD.Memory:GetStats(Int32&, Int32&) (at Assets/External/FMOD/Plugins/FMOD/Wrapper/fmod.cs:1809)
FMODUnity.RuntimeUtils:EnforceLibraryOrder() (at Assets/External/FMOD/Plugins/FMOD/RuntimeUtils.cs:391)
FMODUnity.EditorUtils:CreateSystem() (at Assets/External/FMOD/Plugins/Editor/FMOD/EditorUtils.cs:247)
FMODUnity.EditorUtils:get_System() (at Assets/External/FMOD/Plugins/Editor/FMOD/EditorUtils.cs:322)
FMODUnity.EventManager:UpdateCache() (at Assets/External/FMOD/Plugins/Editor/FMOD/EventManager.cs:129)
CustomBuild:UpdateFMODBanks() (at Assets/Scripts/Editor/CustomBuild/CustomBuild.cs:100)
CustomBuild:GenerateWindows64Build() (at Assets/Scripts/Editor/CustomBuild/CustomBuild.cs:63)

I think this is because some #defines in fmod.cs (and perhaps also RuntimeUtils.cs) have arguments in the wrong order.

More specifically, there is this block:

/*
    FMOD version number.  Check this against FMOD::System::getVersion / System_GetVersion
    0xaaaabbcc -> aaaa = major version number.  bb = minor version number.  cc = development version number.
*/
public class VERSION
{
    public const int    number = 0x00010906;

#if (UNITY_IPHONE || UNITY_TVOS || UNITY_SWITCH) && !UNITY_EDITOR
public const string dll = “__Internal”;
#elif (UNITY_PS4) && !UNITY_EDITOR
public const string dll = “libfmod”;
#elif (UNITY_PS4) && DEVELOPMENT_BUILD
public const string dll = “libfmodL”;
#elif (UNITY_PSP2 || UNITY_WIIU) && !UNITY_EDITOR
public const string dll = “libfmodstudio”;
#elif (UNITY_EDITOR_WIN) || (UNITY_STANDALONE_WIN && DEVELOPMENT_BUILD)
public const string dll = “fmodstudiol”;
#elif (UNITY_EDITOR_OSX) || (UNITY_STANDALONE_OSX && DEVELOPMENT_BUILD)
public const string dll = “fmodstudioL”;
#elif (UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN)
public const string dll = “fmodstudio”;
#elif (UNITY_EDITOR_LINUX) || ((UNITY_STANDALONE_LINUX || UNITY_ANDROID || UNITY_XBOXONE) && DEVELOPMENT_BUILD)
public const string dll = “fmodL”;
#else
public const string dll = “fmod”;
#endif
}

When building a player on a Linux machine and targetting Windows, both UNITY_EDITOR_LINUX and UNITY_STANDALONE_WIN will be set when Unity is compiling code for use within the editor. Some #elifs need to be moved around so that UNITY_EDITOR_{WIN,OSX,LINUX} always are detected before UNITY_STANDALONE_{WIN,OSX,LINUX}. Specifically, this block:

#elif (UNITY_EDITOR_LINUX) || ((UNITY_STANDALONE_LINUX || UNITY_ANDROID || UNITY_XBOXONE) && DEVELOPMENT_BUILD)
public const string dll = “fmodL”;

… should be before this block:

#elif (UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN)
public const string dll = “fmodstudio”;

With that change, I am able to build a Windows player on a Linux machine.

Thanks for bringing this to our attention, I will get this fix added for the next release.