I’m building a UE5.3 application using UAT BuildCookRun. For Mac, when I try to build a universal binary per the documentation: -specifiedarchitecture=arm64+x86_6
I get the following build error when a module loads a precompiled library:
Unable to instantiate module 'CSpice_Library': Asking CppCompileEnvironment for a single Architecture, but it has multiple Architectures (arm64, x64). This indicates logic needs to be updated
I see what it’s getting at but I can’t find any reference to this error or how I would configure the build for this. I have both x86_64 and arm64 versions of the library at lib/Mac/cspice.a
and lib/Mac/arm/cspice.a
respectively. Here is how the library is selected in its Build.cs:
public class CSpice_Library : ModuleRules
{
public CSpice_Library(ReadOnlyTargetRules Target) : base(Target)
{
string libFile = CSpiceLibPath(Target);
...
}
static public string CSpiceLibPath(ReadOnlyTargetRules targetRules)
{
string relativePathToCSpiceLib = RelativePathToCSpiceLibraries + targetRules.Platform.ToString();
string libName = "/cspice.lib";
if (targetRules.Platform == UnrealTargetPlatform.Mac)
{
libName = "/cspice.a";
if (targetRules.Architecture == UnrealArch.Arm64)
{
relativePathToCSpiceLib += "/arm";
}
}
...
relativePathToCSpiceLib += libName;
return Path.Combine(targetRules.ProjectFile.Directory.FullName, relativePathToCSpiceLib);
}
This all checks out, but I don’t know how this relates to “asking CppCompileEnvironment for a single architecture”. Is this the logic in question, and how do you configure multiple versions of a library for a universal build?