Author Topic: UE4 Substance Plugin for Linux  (Read 1815 times)


hello, I'd like to install the plugin for my projects unreal linux,

is it possible to indicate the procedure to follow to run the plugin?
( i have the plugin on my Window computer, and i would like to put my project on my Ue4 Linux computer, my other project work fine without substance, but my main project need this plugins on Linux)

by copying ( the windows substance plugin) directly in the folder plugin of unrealEngine/engine/plugins
( or unreal/plugins, or in my plugins project )   
it happens to detect it in my project but after when I wants to re open the project again for enable the plugin it does not work and I have to delete the plugin so that my project works again.

I also try to recompile the plugin using the engine / batchfile / build.bat but no project works.


someone could explain step by step how to run the plugin under linux ?

I have tried to do it has well, and I cannot make it work under linux. I am using ubuntu 16.04 if that is of any help! Is there any tutorial to help us out. I'm sorry I cannot help you out any further. If you ever find a solution let me know!

Alex


hello , it's been 5 days that I ask for help without success, and yet this seems to be an easy problem to solve given the fact that the plugin Substance for Unreal is apparently compatible under linux,
would a member of the allegorithmic team be kind enough to offer me support to solve my problem since my project development is dependent on the UE4 Substance plugin.


I would need the steps to follow to install the plugin under linux to run my project which is develop on win10.
(just for the display, no development is done under linux)

Thank you

Hi @ant8ine,
Sorry for such a delayed reply!
Going off of the information from your initial post, this sounds like a pathing issue. You mentioned that you are copying the plugin to both your Engine/Plugin folder and your Project/Plugin folder. Does this also include the runtime sub-directory?

The needed path for the plugin needs to be:
<Project or Engine Dir>/Plugins/Runtime/Substance

This is likely building as intended but once the plugin is loaded after being enabled, it does not find the correct paths.

If this doesn't solve the issue, please let me know and I would more than happy to help further!  :D
Also, if this doesn't solve the issue, could you send the UE4 log?

Cheers!
Dan
Software Engineer, Integrations
daniel.stover@allegorithmic.com

I also tried it by first copying the whole windows Plugins/Marketplace folder over to my engine sources and then moving Substance to Plugins/Runtime because of your hint and then back because it doesn't make any difference.

The error i get both times:

Code: [Select]
While compiling /home/kyra/src/UnrealEngine/Engine/Intermediate/Build/BuildRules/UE4Rules.dll:
ERROR: Unable to instantiate module 'SubstanceCore': System.NullReferenceException: Object reference not set to an instance of an object
         at UnrealBuildTool.Rules.SubstanceCore..ctor (UnrealBuildTool.ReadOnlyTargetRules Target) [0x002ac] in <a60a280710e04094b821011025701731>:0
         at (wrapper managed-to-native) System.Reflection.MonoCMethod.InternalInvoke(System.Reflection.MonoCMethod,object,object[],System.Exception&)
         at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in <af74c024b1ed4d568c62853b2f8d84c5>:0
       (referenced via UE4Editor.Target.cs -> Substance.uplugin)
make: *** [Makefile:188: UE4Editor] Error 5


sadly (or gladly, depending on how you look at it; i don't like .NET too much :P) i don't have much experience with all that mono stuff they use for their build tools, so i can't even reliably understand what exactly that trace is telling me is being wrong (note it also seems to be lacking any kind of file paths or line numbers, probably a runtime stacktrace missing some debug symbols?)

if you need any more information about this problem or my particular setup or anything i can help to fix this i'd love to provide it, I really like your products even after just working with them for a very little, and (unlike Windows :P) I'd love to integrate them into my UE4 game development workflow
Last Edit: July 26, 2018, 06:24:11 pm

Hey @nonchip,
Thank you for the update!
I will work on setting up a repro case and seeing if I can produce the same results. If you (or anyone else in the thread) could provide any of the following information, it would greatly help with pinpointing the issue.  :D

Which Linux distro/version are you using?

What is the command you are using to build the plugin?

Are you adding the plugin at the engine or project level?

Did you run generate project files post copy operation?

Regarding your pathing, I am actually not sure how pathing works with the marketplace folder on Linux as there is no launcher/marketplace on Linux. We still handle this path but our source plugins paths should be plugins/runtime/Substance so even though it doesn't solve this issue, I would still recommend keeping the path change.  ;)

As mentioned above, we will look into reproducing the same issue and as soon as I know more, I will post an update here.

Cheers!
Software Engineer, Integrations
daniel.stover@allegorithmic.com

Which Linux distro/version are you using?

void linux (a rolling release distro so no version number, but i can supply individual package versions if you tell me which are relevant), engine version is 4.19.2

What is the command you are using to build the plugin?

I'm literally just calling make in the engine folder, which might be not enough? maybe i need to add the plugin to some ini file or delete the Intermediate folder to clean the objects or something?

Are you adding the plugin at the engine or project level?

Engine level.

Did you run generate project files post copy operation?

oh actually no, i'm gonna try that over night (takes a while to rebuild everything on my rig, my HDD isn't the fastest)

Regarding your pathing, I am actually not sure how pathing works with the marketplace folder on Linux as there is no launcher/marketplace on Linux. We still handle this path but our source plugins paths should be plugins/runtime/Substance so even though it doesn't solve this issue, I would still recommend keeping the path change.  ;)

afaik there's no official handling for the Marketplace folder, and the build process just finds it by it being a subfolder of Plugins. but yeah, i moved it over to Runtime again.

As mentioned above, we will look into reproducing the same issue and as soon as I know more, I will post an update here.
Cheers!

thanks much, if there's any more questions just ask, i'm also gonna update you here with the result of my full rebuild tomorrow :)


EDIT: didn't take as long as expected, because even regenerating the project files fails:
Code: [Select]
# kyra @ t1 in ~/src/UnrealEngine on git:b243bb66ce6 x [1:21:10]
$ ./GenerateProjectFiles.sh

Setting up Unreal Engine 4 project files...

+ xbuild Source/Programs/UnrealBuildTool/UnrealBuildTool.csproj /verbosity:quiet /nologo /p:TargetFrameworkVersion=v4.5 /p:Configuration=Development
+ mono Binaries/DotNET/UnrealBuildTool.exe -projectfiles
WARNING: Exception while generating include data for UE4Editor: Unable to instantiate module 'SubstanceCore': System.NullReferenceException: Object reference not set to an instance of an object
           at UnrealBuildTool.Rules.SubstanceCore..ctor (UnrealBuildTool.ReadOnlyTargetRules Target) [0x002ac] in <a60a280710e04094b821011025701731>:0
           at (wrapper managed-to-native) System.Reflection.MonoCMethod.InternalInvoke(System.Reflection.MonoCMethod,object,object[],System.Exception&)
           at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in <af74c024b1ed4d568c62853b2f8d84c5>:0
         (referenced via UE4Editor.Target.cs -> Substance.uplugin)
Last Edit: July 27, 2018, 01:24:46 am

Hey @nonchip,
Thank you for the information. I will still have to work on getting this setup on a void distro repro.
I was able to build and run our new version of the plugin (for 4.20.0) today on Ubuntu.

Something that I noticed within your log that I didn't catch originally: `Exception while generating include data for UE4Editor:`

With the 4.20.0 plugin update, the one major change is that the plugin is now compliant with the new UE4 IWYU standard for header includes. This update may also solve the issue.

Release post: https://forum.allegorithmic.com/index.php/topic,24955.0.html

If you give this a try, keep us posted on if it solves the issue or not.
Thank you again for the info and we will work on reproducing the issue as soon as possible. :D

Cheers!
Software Engineer, Integrations
daniel.stover@allegorithmic.com

I just tried that update, but it still fails with the same error both in GenerateProjectFiles and make :/
I managed to rebuild the UBT in debug mode though (changed the xbuild line in Engine/Build/BatchFiles/Linux/GenerateProjectFiles.sh to say Debug instead of Development), in the hope of getting more detailed error information, and it stopped raising the error overall.
My guess would be it just can't handle something already halfway built correctly in the Intermediates, failing to realize it has to rebuild the UBT ruleset dll, and changing the UBT build config then forced it to rebuild that because it's a dependency.

now i get different errors unrelated to your plugin when running make (PCH cache Intermediates being broken), after doing a make ARGS=-clean those went away, and i'm waiting for the whole build to go through.

the reflection code generation for the plugin just went through without errors, but the whole complilation+linkage isn't done yet:

Code: [Select]
[2018.07.27-23.12.45:571][  0]LogCompile: Generating code for module 'SubstanceEditor'
[2018.07.27-23.12.45:581][  0]LogCompile: Success: Parsed 288 line(s), 100 statement(s) in 0.01 secs.

I'll post my final build results likely tomorrow around noon, but I'll already say I'm rather optimistic about this, since generating headers should happen after parsing the plugin.

I guess "when in doubt clear the cache" doesn't just apply to websites, but also unified build systems hackily integrated into all kinds of different IDEs like Epic tried to do here (and obviously that can't be as robust as e.g. a plain Makefile, and even THOSE sometimes fail to detect changed sources) :P

And I guess that also means you should stop driving yourself crazy trying to reproduce a void linux setup (at least for now), because setting up UE4 on void was a giant pain in the behind, and i'd rather spare you the experience, since it seemed unrelated to the distro anyway (everything was mono stuff -> pretty cross platform, and seems to have gone away after manually cleaning up the objects and old rules.dll)



EDIT: it still failed the first rebuild (this time while compiling instead of before, so that's progress):
Code: [Select]
------- Build details --------
Using clang (/usr/bin/clang++) version '6.0.1' (string), 6 (major), 0 (minor), 1 (patch)
Using bundled libc++ standard C++ library.
Using lld linker
Using llvm-ar : /usr/bin/llvm-ar
Using fast way to relink  circularly dependent libraries (no FixDeps).
------------------------------
Performing 5 actions (6 in parallel)
[1/5] Compile Module.SubstanceCore.cpp
In file included from /home/kyra/src/UnrealEngine/Engine/Plugins/Runtime/Substance/Intermediate/Build/Linux/B4D820EA/UE4Editor/Development/SubstanceCore/Module.SubstanceCore.cpp:5:
/home/kyra/src/UnrealEngine/Engine/Plugins/Runtime/Substance/Source/SubstanceCore/Private/SubstanceCoreHelpers.cpp:2794:76: error: member access into incomplete type 'UMaterialInstance'
                                for (int32 ParameterIndex = 0; ParameterIndex < MatItr.MaterialInstance->TextureParameterValues.Num(); ++ParameterIndex)
                                                                                                       ^
/home/kyra/src/UnrealEngine/Engine/Source/Runtime/Engine/Public/MaterialShared.h:37:7: note: forward declaration of 'UMaterialInstance'
class UMaterialInstance;
      ^
In file included from /home/kyra/src/UnrealEngine/Engine/Plugins/Runtime/Substance/Intermediate/Build/Linux/B4D820EA/UE4Editor/Development/SubstanceCore/Module.SubstanceCore.cpp:5:
/home/kyra/src/UnrealEngine/Engine/Plugins/Runtime/Substance/Source/SubstanceCore/Private/SubstanceCoreHelpers.cpp:2796:33: error: member access into incomplete type 'UMaterialInstance'
                                        if (MatItr.MaterialInstance->TextureParameterValues[ParameterIndex].ParameterInfo.Name == MatItr.ParameterNames[OutItr->mDesc.mIdentifier.c_str()])
                                                                   ^
/home/kyra/src/UnrealEngine/Engine/Source/Runtime/Engine/Public/MaterialShared.h:37:7: note: forward declaration of 'UMaterialInstance'
class UMaterialInstance;
      ^
In file included from /home/kyra/src/UnrealEngine/Engine/Plugins/Runtime/Substance/Intermediate/Build/Linux/B4D820EA/UE4Editor/Development/SubstanceCore/Module.SubstanceCore.cpp:5:
/home/kyra/src/UnrealEngine/Engine/Plugins/Runtime/Substance/Source/SubstanceCore/Private/SubstanceCoreHelpers.cpp:2798:30: error: member access into incomplete type 'UMaterialInstance'
                                                MatItr.MaterialInstance->TextureParameterValues[ParameterIndex].ParameterValue = Texture;
                                                                       ^
/home/kyra/src/UnrealEngine/Engine/Source/Runtime/Engine/Public/MaterialShared.h:37:7: note: forward declaration of 'UMaterialInstance'
class UMaterialInstance;
      ^
In file included from /home/kyra/src/UnrealEngine/Engine/Plugins/Runtime/Substance/Intermediate/Build/Linux/B4D820EA/UE4Editor/Development/SubstanceCore/Module.SubstanceCore.cpp:10:
/home/kyra/src/UnrealEngine/Engine/Plugins/Runtime/Substance/Source/SubstanceCore/Private/SubstanceSettings.cpp:11:4: warning: field 'DefaultSubstanceOutputSizeY' will be initialized after field 'MaxAsyncSubstancesRenderedPerFrame' [-Wreorder]
        , DefaultSubstanceOutputSizeY(EDefaultSubstanceTextureSize::SIZE_1024)
          ^
/home/kyra/src/UnrealEngine/Engine/Plugins/Runtime/Substance/Source/SubstanceCore/Private/SubstanceSettings.cpp:13:4: warning: field 'SubstanceEngine' will be initialized after field 'AsyncLoadMipClip' [-Wreorder]
        , SubstanceEngine(SET_CPU)
          ^
/home/kyra/src/UnrealEngine/Engine/Plugins/Runtime/Substance/Source/SubstanceCore/Private/SubstanceSettings.cpp:14:4: warning: field 'AsyncLoadMipClip' will be initialized after field 'MemoryBudgetMb' [-Wreorder]
        , AsyncLoadMipClip(3)
          ^
3 warnings and 3 errors generated.
ERROR: UBT ERROR: Failed to produce item: /home/kyra/src/UnrealEngine/Engine/Plugins/Runtime/Substance/Binaries/Linux/libUE4Editor-SubstanceCore.so
Total build time: 49.02 seconds (Local executor: 0.00 seconds)
make: *** [Makefile:188: UE4Editor] Error 5

UMaterialInstance in MaterialInstance.h is declared as:
Code: [Select]
UCLASS(abstract, BlueprintType,MinimalAPI)
class UMaterialInstance : public UMaterialInterface;
while in MaterialShared.h (where you include it from) it's declared incomplete.

just adding the line:
Code: [Select]
#include "Materials/MaterialInstance.h"
//before:
#include "Materials/MaterialExpressionTextureSampleParameter2D.h"
in SubstanceCoreHelpers.cpp fixed this, and the plugin now builds successfully.
Last Edit: July 28, 2018, 11:53:26 am

Hey @nonchip,
Thank you for the update! So glad that you were able to get everything working! I will also get a fix in for this error. If you encounter any additional errors, don't hesitate to reach out.  :D

Cheers!
-Dan
Software Engineer, Integrations
daniel.stover@allegorithmic.com

Sure thing, will do :)
And thanks very much for the quick support :)
way too often you hear "oh you're not on a 6 year old ubuntu? not my problem then" instead :P
Last Edit: July 30, 2018, 08:32:34 pm