Using the cross-compile option on Windows, I am attempting to build a plugin that uses a ThirdParty .so. I used the template to create the plugin from the editor. In MyPlugin.Build.cs I have added in a dependency for MWLibrary:
PublicDependencyModuleNames.AddRange(
new string[] {
"Core",
"RenderCore",
"ShaderCore",
"RHI",
"Landscape",
"MWLibrary",
"Projects"
// ... add other public dependencies that you statically link with here ...
}
);
Then MWLibrary.Build.cs is this:
using System.IO;
using UnrealBuildTool;
using System.Diagnostics;
using System.Collections.Generic;
public class MWLibrary : ModuleRules
{
public MWLibrary(ReadOnlyTargetRules Target) : base(Target)
{
Type = ModuleType.External;
if (Target.Platform == UnrealTargetPlatform.Win64 || Target.Platform == UnrealTargetPlatform.Win32 ||
Target.Platform == UnrealTargetPlatform.Mac || Target.Platform == UnrealTargetPlatform.Linux)
{
bool bDebug = (Target.Configuration == UnrealTargetConfiguration.Debug && Target.bDebugBuildsActuallyUseDebugCRT);
string LibDir = Path.Combine(ModuleDirectory, "LiveIODeploy");
string Platform;
string LibExtension;
switch (Target.Platform)
{
case UnrealTargetPlatform.Win64:
Platform = "win64";
LibExtension = bDebug ? ".d.lib" : ".lib";
break;
case UnrealTargetPlatform.Mac:
Platform = "maci64";
LibExtension = ".dylib";
break;
case UnrealTargetPlatform.Linux:
Platform = "glnxa64";
LibExtension = bDebug ? ".so.dbg" : ".so";
break;
default:
return;
}
LibDir = Path.Combine(LibDir, Platform);
PublicLibraryPaths.Add(LibDir);
PublicIncludePaths.Add(Path.Combine(ModuleDirectory, "LiveIODeploy", "include"));
List<string> ReqLibraryNames = new List<string>();
if (Target.Platform == UnrealTargetPlatform.Win64)
{
ReqLibraryNames.AddRange
(
new string[] {
"mwlive_core",
"mwlive_utils"
});
}
else if (Target.Platform == UnrealTargetPlatform.Mac)
{
ReqLibraryNames.AddRange
(
new string[] {
"libmwlive_core",
"libmwlive_utils"
});
}
else if (Target.Platform == UnrealTargetPlatform.Linux)
{
ReqLibraryNames.AddRange
(
new string[] {
"libmwlive_core",
"libmwlive_utils"
});
}
foreach (string LibraryName in ReqLibraryNames)
{
string LibName = Path.Combine(LibDir, LibraryName + LibExtension);
PublicAdditionalLibraries.Add(LibName);
PublicDelayLoadDLLs.Add(LibraryName + LibExtension);
RuntimeDependencies.Add(LibName);
}
}
}
}
When linking I see the following:
2>C:\UnrealToolchains\v11_clang-5.0.0-centos7\x86_64-unknown-linux-gnu\bin\ld.lld.exe : error : undefined symbol: live::core::PublisherSharedMemory::getParticipantPublisherSharedMemory(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, unsigned long)
2>>>> referenced by SdCamera.cpp:36 (J:\VrtlEnv\Plugins\MWSimulation\Source\MWSimulation\Private\SdCamera.cpp:36)
2>>>> Module.MWSimulation.cpp.o:(ASdCamera::CreateSettingsTopicReader()) in archive J:/VrtlEnv/Plugins/MWSimulation/Binaries/Linux/libUE4-MWSimulation.a
2>clang++.exe : error : linker command failed with exit code 1 (use -v to see invocation)
2>UnrealBuildTool : error : UBT ERROR: Failed to produce item: J:\VrtlEnv\Binaries\Linux\VrtlEnv
Have I missed something or did it incorrectly? Thanks!