Funny you should ask!
As it happen, I just spent a whole week trying to understand this, and I finally have it figured out.
The TLDR; is, go here, look at this: GitHub - shadowmint/ue4-static-plugin: A sample static plugin for the unreal engine that imports a C++ and rust library and links them statically.
The longer version is:
Yes, the static guide isn’t very helpful, but it covers the basic things you need to do:
-
Have a set of local .cpp files in your plugin
-
Call PublicAdditionalLibraries.Add(full_library_path);
-
Call PublicIncludePaths.Add(full_include_path);
Notice (1). (1) is important. See, plugins are actually compiled into dynamic libraries that sit in the Plugins/Foo/Binaries folder, and are linked into your project.
If you have no local .cpp files, no matter how many external dependencies you have, you never trigger the UBT to create a local shared library that references all those tasty external symbols you need.
Finally, also note that the UBT silently consumes errors. You will almost certainly want to go and apply this patch:
diff --git a/Engine/Source/Programs/UnrealBuildTool/Mac/MacToolChain.cs b/Engine/Source/Programs/UnrealBuildTool/Mac/MacToolChain.cs
index 582fef0..9f5336f 100644
--- a/Engine/Source/Programs/UnrealBuildTool/Mac/MacToolChain.cs
+++ b/Engine/Source/Programs/UnrealBuildTool/Mac/MacToolChain.cs
@@ -149,6 +149,7 @@ namespace UnrealBuildTool
{
string Result = "";
+ Result += " -v";
Result += " -fmessage-length=0";
Result += " -pipe";
Result += " -fpascal-strings";
@@ -602,6 +603,7 @@ namespace UnrealBuildTool
public override FileItem LinkFiles(LinkEnvironment LinkEnvironment, bool bBuildImportLibraryOnly)
{
+ Log.TraceError("Performing a build");
bool bIsBuildingLibrary = LinkEnvironment.Config.bIsBuildingLibrary || bBuildImportLibraryOnly;
// Create an action that invokes the linker.
@@ -622,6 +624,7 @@ namespace UnrealBuildTool
string Linker = bIsBuildingLibrary ? MacArchiver : MacLinker;
string LinkCommand = "xcrun " + Linker + VersionArg + " " + (bIsBuildingLibrary ? GetArchiveArguments_Global(LinkEnvironment) : GetLinkArguments_Global(LinkEnvironment));
+ Log.TraceError(LinkCommand);
// Tell the action that we're building an import library here and it should conditionally be
// ignored as a prerequisite for other actions
@@ -886,6 +889,7 @@ namespace UnrealBuildTool
// Only execute linking on the local Mac.
LinkAction.bCanExecuteRemotely = false;
+ Log.TraceError(LinkCommand);
LinkAction.StatusDescription = Path.GetFileName(OutputFile.AbsolutePath);
LinkAction.OutputEventHandler = new DataReceivedEventHandler(RemoteOutputReceivedEventHandler);
To have it verbosely log the output of builds, so you can see what’s going on on OSX. On windows, you’re basically screwed. Good luck!