Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

How to use this in the latest 4.12 version of UE4 #24

Closed
jason718 opened this issue Jul 13, 2016 · 12 comments
Closed

How to use this in the latest 4.12 version of UE4 #24

jason718 opened this issue Jul 13, 2016 · 12 comments

Comments

@jason718
Copy link

No description provided.

@adamlerer
Copy link
Contributor

Hi,

The code was written for 4.8, I think there was some work by @marioyc to port it to 4.10 or 4.12, lets see what he says. If you really need it on 4.12 it shouldn't be too much work to port.

@jason718
Copy link
Author

I have done some UE projects in 4.12. However, when I try to open it in UETorch 4.8, the program crashed.

@marioyc
Copy link
Contributor

marioyc commented Jul 22, 2016

Sorry for the delay, I will put together the changes that I mentioned in #19, and hopefully the same will work for 4.12

@iffsid
Copy link

iffsid commented Aug 13, 2016

Hey @marioyc, do you know what needs to be done to get the Unreal build scripts to pick up the lua includes when building? I'm trying to get UETorch to work with 4.12.
I took your patches from #19 and built this patch with some path and location modifications (ScriptGeneratorPlugin has moved inside of ScriptPlugin). I believe I have almost all of it working, except for one issue -- when I'm building the Unreal engine, I get these errors about not being able to locate lua.h.

[388/709] Link libUE4Editor-AutomationWorker.so
In file included from ..../UnrealEngine/Engine/Plugins/ScriptPlugin/Intermediate/Build/Linux/B4D820EA/UE4Editor/Development/ScriptPlugin/Module.ScriptPlugin.cpp:2:
In file included from ..../UnrealEngine/Engine/Plugins/ScriptPlugin/Source/ScriptPlugin/Private/ScriptPluginPrivatePCH.h:18:
/home/nsid/repos/UnrealEngine/Engine/Plugins/ScriptPlugin/Source/ScriptPlugin/Private/LuaIntegration.h:9:10: fatal error: 'lua.h' file not found
#include "lua.h"
         ^

[394/709] Link libUE4Editor-ViewportSnapping.so
In file included from ..../UnrealEngine/Engine/Plugins/ScriptPlugin/Intermediate/Build/Linux/B4D820EA/UE4Editor/Inc/ScriptPlugin/ScriptPlugin.generated.cpp:8:
In file included from ../Plugins/ScriptPlugin/Source/ScriptPlugin/Private/ScriptPluginPrivatePCH.h:18:
../Plugins/ScriptPlugin/Source/ScriptPlugin/Private/LuaIntegration.h:9:10: fatal error: 'lua.h' file not found
#include "lua.h"
         ^
1 error generated.

I don't have any experience with xbuild or mono, so I don't quite know how to debug this. I'm aware that the build file at Engine/Plugins/ScriptPlugin/Source/ScriptPlugin/ScriptPlugin.Build.cs has some adjustments made by the patch and the UETorch Setup.sh script symlinks-in the torch lua directory into the UnrealEngine hierarchy, but I can't seem to be able to debug any further.

I don't even know if it's being used when I just build from the command line, without VStudio or anything. The build logs don't have anything in them relating to Lua, even thought the build script has Log.TraceVerbose calls that are supposed to say something about whether Lua integration was setup or not.

Any idea of what could be going wrong?

Edit1: I'm trying to get this working with 4.12 because I can get that to build on my machine (in isolation without the UETorch patches), but not 4.8; something about some objects having disappeared.

@marioyc
Copy link
Contributor

marioyc commented Aug 14, 2016

I had the same errors when I tried to build it in MacOS, the change that I needed to do was change "liblua.so" in ScriptPlugin.Build.cs to "liblua.dylib" (for more detailes #13), I guess you are building it in Windows and you should check what's the right name.

@iffsid
Copy link

iffsid commented Aug 14, 2016

I believe 'lualib.so' is correct; I'm building it on Linux. My comment about VStudio was more to actually check if some related library was actually required to build this.
However, I did realise that torch doesnt supply lua or liblua.so but luajit and libluajit.so; symlinking libluajit.so to liblua.so gets rid of that error, but then (possibly because of that difference) I get errors about undeclared identifiers.

[385/709] Link libUE4Editor-BlueprintCompilerCppBackend.so
In file included from ..../UnrealEngine/Engine/Plugins/ScriptPlugin/Intermediate/Build/Linux/B4D820EA/UE4Editor/Development/ScriptPlugin/Module.ScriptPlugin.cpp:3:
..../UnrealEngine/Engine/Plugins/ScriptPlugin/Source/ScriptPlugin/Private/LuaIntegration.cpp:20:2: error: use of undeclared identifier
      'luaL_setfuncs'
        luaL_setfuncs(LuaState, Lib, 0);
        ^
..../UnrealEngine/Engine/Plugins/ScriptPlugin/Source/ScriptPlugin/Private/LuaIntegration.cpp:545:2: error: use of undeclared identifier
      'luaL_setfuncs'
        luaL_setfuncs(LuaState, PrintOverride, 0);
        ^
[386/709] Link libUE4Editor-GeometryCache.so
..../UnrealEngine/Engine/Plugins/ScriptPlugin/Source/ScriptPlugin/Private/LuaIntegration.cpp:901:2: error: use of undeclared identifier
      'lua_pushglobaltable'
        lua_pushglobaltable(LuaState);
        ^

@marioyc
Copy link
Contributor

marioyc commented Aug 14, 2016

Oh, I guess that's because you're using Lua JIT instead of Lua 5.2. Like the instructions say replace LUAJIT21 with LUA52 in install.sh before installing Torch.

@iffsid
Copy link

iffsid commented Aug 14, 2016

Well, it doesn't look like that's an issue. Following the instructions from the torch installer repo, I ran install with

TORCH_LUA_VERSION=LUA52 ./install.sh

just be sure, but again, the only libs that are available in the installed torch directory are the following

~/torch/lib $   ls -l
total 79088
lrwxrwxrwx 1 .... ....       10 Aug 14 19:37 libTH.so -> libTH.so.0*
-rwxr-xr-x 1 .... ....  2783560 Aug 14 19:37 libTH.so.0*
-rwxr-xr-x 1 .... .... 77109512 Aug 14 19:42 libTHC.so*
lrwxrwxrwx 1 .... ....       12 Aug 14 19:37 libluaT.so -> libluaT.so.0*
-rwxr-xr-x 1 .... ....    46032 Aug 14 19:36 libluaT.so.0*
-rwxr-xr-x 1 .... ....   674080 Aug 14 19:36 libluajit.so*
-rwxr-xr-x 1 .... ....   144624 Aug 14 19:43 libqlua.so*
-rwxr-xr-x 1 .... ....   198880 Aug 14 19:43 libqtlua.so*
-rwxr-xr-x 1 .... ....     7800 Aug 14 19:43 libthreadsmain.so*
drwxr-xr-x 3 .... ....     4096 Aug 14 19:36 lua/
drwxr-xr-x 3 .... ....     4096 Aug 14 19:36 luarocks/

Building the UnrealEngine code works if I symlink libqlua.so to liblua.so (since qlua is the lua interpreter in ~/torch/bin/). However, I can't add the TorchPlugin component as per the instructions.
I've pasted the error I get here.

I had to start the editor with the -nocore option because it tries to set the core file size to Infinity as per this:

Using jemalloc.
Increasing per-process limit of core file size to infinity.
setrlimit() failed with error 22 (Invalid argument)
- Max per-process value allowed is 0 (we wanted infinity).
Could not adjust core file size, consider changing "core" in /etc/security/limits.conf and relogin.
error(22): Invalid argument
Alternatively, pass -nocore if you are unable or unwilling to do that.
Could not set desired per-process limits, consider changing system limits.
Exiting abnormally (error code: 1)

I'm not certain, but I think running with -nocore might be contributing to the crash. I'm going to try to let the editor adjust core file size and retry this. Will report back results. In the meantime, the complete patch I'm using with Setup.sh and UnrealEngine.path is here.

@marioyc
Copy link
Contributor

marioyc commented Aug 15, 2016

It seems you need to run clean.sh before rerunning install.sh (http://torch.ch/docs/getting-started.html)

@iffsid
Copy link

iffsid commented Aug 15, 2016

I don't believe that is required if you both delete the installation entirely (rm -rf ~/torch) before reinstalling. clean.sh does not touch anything outside the installation.

@dalietimes
Copy link

+1 would love to see support for this for 4.12 or 4.13

@adamlerer
Copy link
Contributor

Fixed in #32

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants