Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Unreal Engine 4 on Gentoo [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
atemv
n00b
n00b


Joined: 09 Aug 2014
Posts: 54

PostPosted: Sat Oct 10, 2015 2:57 pm    Post subject: Unreal Engine 4 on Gentoo [SOLVED] Reply with quote

Hello everyone,

The Unreal Engine 4 source code is accessible, it supports Linux, and it moves :)

https://github.com/EpicGames/UnrealEngine.git (IMPORTANT: You need a Unreal Engine account linked to your github account to get the source)

The goal of this post is to start a discussion, how to build a properly working Unreal Engine 4 with it's essential components for creation.
I have not written "game creation", because modern game engines are capable for many other tasks like physical simulations, VJ projection, architectural or any other visualization... well I guess the fantasy of the user is the bottle neck.
So it should be nice to workout a method to build and run a properly working UE4 engine for Gentoo, and document it on the wiki.

What I found so far:

There is a fairly good tutorial how to build it on Linux:

https://wiki.unrealengine.com/Building_On_Linux

However following this tutorial, I ran into two major issues. The first is Nvidia proprietary driver specific, what was not too hard to workaround.
The second is Gentoo specific, and much more complicated.

1. Issue:
Scenario: I use a Nvidia card with proprietary driver with 3 screens separated to 2 X screens with a need for a feature to drag one window from one X screen to another.
Problem: According my recent knowledge (what can be wrong) for the drag window to other X screen feature to work, the Nvidia proprietary driver requires Xinerama turned on,
however it prevents XRandR extension to load, and without it you will get this error message when try to run the UE4Editor:

Code:
[2015.10.09-19.30.09:916][  0]LogInit:Warning: Could not initialize SDL: XRandR support is required but not available
Fatal error: [File:/home/attila/projects/unreal/UnrealEngine/Engine/Source/Runtime/Core/Private/Linux/LinuxApplication.cpp] [Line: 36]
FLinuxApplication::CreateLinuxApplication() : PlatformInitMultimedia() failed, cannot create application instance.
[2015.10.09-19.30.09:916][  0]LogLinux:Error: appError called: Assertion failed: Assertion failed:  [File:/home/attila/projects/unreal/UnrealEngine/Engine/Source/Runtime/Core/Private/Linux/LinuxApplication.cpp] [Line: 36]
FLinuxApplication::CreateLinuxApplication() : PlatformInitMultimedia() failed, cannot create application instance.

Signal 11 caught.


workaround:
1. define two different ServerLayout in one xorg.conf file.
Here is my xorg.conf for an example solution

http://pastebin.com/QXKEj37p

Safety notice: Do not copy and paste it, only make modification based on it, and make backup before that.
I prefer to generate the xorg.conf with nvidia-settings and modify it manualy.

You can start one more different simultaneously running x Sessions with different ServerLayout with this command:
Code:
startx -- -layout identifierOfTheServerLayout

You can change between them Ctrl-Alt-FunctionKeys
If you want run one X at a time you can easily kill the current X with RightAlt-PrintScreen-k (at least it works for me), or on some configuration Ctrl-Alt-backspcae works, either one of them will kill the current X so they will ask no question about saving your works.

II. issue
Well this is the tricky one...

The problem:

when I want to start UE4editor I got this error
Code:
[31m[2015.10.09-21.15.12:109][  0]LogHAL:Error: LinuxSplash_InitSplashResources() : Splash screen window could not be created! SDL_Error: Failed loading libGL.so.1: dlopen: cannot load any more object with static TLS
[0m[31m[2015.10.09-21.15.12:126][  0]LogLinux:Error: appError called: Assertion failed: Assertion failed:  [File:/home/attila/projects/unreal/UnrealEngine/Engine/Source/Runtime/OpenGLDrv/Private/Linux/OpenGLLinux.cpp] [Line: 801]
Unable to dynamically load libGL: Failed loading libGL.so.1: dlopen: cannot load any more object with static TLS
.

[0mEngineCrashHandler: Signal=11
[2015.10.09-21.15.12:408][  0]LogLinux: === Critical error: ===
Unhandled Exception: SIGSEGV: invalid attempt to access memory at address 0x00000003

[2015.10.09-21.15.12:408][  0]LogLinux: Assertion failed: Assertion failed:  [File:/home/attila/projects/unreal/UnrealEngine/Engine/Source/Runtime/OpenGLDrv/Private/Linux/OpenGLLinux.cpp] [Line: 801]
Unable to dynamically load libGL: Failed loading libGL.so.1: dlopen: cannot load any more object with static TLS.



According to the following thread about a similar problem with MatLab on stackoverflow.com:

http://stackoverflow.com/questions/19268293/matlab-error-cannot-open-with-static-tls

The UE4Editor relies heavly on dynamically loadable libraries during run-time and the too small static TLS (thread local storage) prevents dlopen from load more objects/libs, and it's size is defined by a preprocessor directive in glibc-source/sysdeps/generic/ldsodefs.h:

Code:
#define DTV_SURPLUS    (14)


this means bad, because the solution is to patch and recompile glibc, with changing the value of DTV_SURPLUS constant from 14 to 32. fortunately on the link below there is very elegant gentoo specific solution for this making portage do the patching.

https://answers.unrealengine.com/questions/229646/crash-on-ue4editor-startup.html

WARNING: messing with glibc is EXTREMELY DANGEROUS, event with a very simple patch, the smallest error caused in glibc can render your Gentoo system to a wasteland of badly complied binaries.

I have not tested it, yet. I will, but I want to discuss it with others first. My questions:


  • How this patch change the system performance, size and most importantly stability on the long run.

  • If the answer for the 1. question "Nothing bad can come from it", then why is it not implemented already.

  • what if a newer version of glibc comes out?

  • Any similar experience or suggestions.



If there is any inaccuracy in my post please point it out.


Last edited by atemv on Wed Oct 14, 2015 9:07 am; edited 1 time in total
Back to top
View user's profile Send private message
atemv
n00b
n00b


Joined: 09 Aug 2014
Posts: 54

PostPosted: Wed Oct 14, 2015 9:05 am    Post subject: Reply with quote

Quote:
I am out of humanity’s reach,
I must finish my journey alone,
Never hear the sweet music of speech;
I start at the sound of my own.
The beasts that roam over the plain
My form with indifference see;
They are so unacquainted with man,
Their tameness is shocking to me.

William Cowper

Well I tried and succeed with the glibc patching. The Unreal Engine 4.9 is working, and my recompiled packages are stable, however further testing is required.
Back to top
View user's profile Send private message
Chiitoo
Moderator
Moderator


Joined: 28 Feb 2010
Posts: 1148
Location: Here and Away Again

PostPosted: Wed Oct 14, 2015 9:38 am    Post subject: ><)))°€ Reply with quote

Thank you for posting about this here!

I don't know if I would have bumped into the fact of the source being available like this otherwise, even though I was actually looking into the UE4 recently. Due to the no Linux builds business, it wasn't happening, not to mention the non-free side of things. Not that it's really free now either, but at least now I'll get to mess with it a bit!

I didn't actually fully read your post until after I had successfully built things myself. I went for the release branch first, then 4.10, then 4.9, but I was having build issues with them all. The build system wasn't telling me what was wrong, but I decided to try downgrading clang from 3.7.0-r100 to 3.5.2-r100, which seemed to do the trick.

Then I was getting the same SDL_Error as mentioned here. I also found out about the hacking of glibc, but I didn't feel like doing that. I still managed to run the editor, however, like so:

Code:
LD_PRELOAD=/usr/lib64/opengl/nvidia/lib/libGL.so.1 ./UE4Editor

For an unknown reason, the editor does crash occasionally without me doing much at all with it. I'll probably try the release and/or 4.10 branch(es) next.
_________________
Kind Regards,
~ The Noob Unlimited ~

Sore wa sore, kore wa kore.
Back to top
View user's profile Send private message
atemv
n00b
n00b


Joined: 09 Aug 2014
Posts: 54

PostPosted: Wed Oct 14, 2015 11:56 am    Post subject: Reply with quote

For me the UE4Editor is working flawlessly. Can you post some debug information?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 35378
Location: 56N 3W

PostPosted: Wed Oct 14, 2015 7:23 pm    Post subject: Reply with quote

Moved from Portage & Programming to Unsupported Software.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Chiitoo
Moderator
Moderator


Joined: 28 Feb 2010
Posts: 1148
Location: Here and Away Again

PostPosted: Thu Oct 15, 2015 2:41 pm    Post subject: Reply with quote

atemv wrote:
For me the UE4Editor is working flawlessly. Can you post some debug information?

I definitely can, if/when it happens again, although there didn't seems to be anything interesting going on in the terminal when they happened. Might need some debug flags set.

I built 4.10 yesterday, but haven't yet played with it much (and didn't get it to crash so far). Will need some time to be able to get more into it.
_________________
Kind Regards,
~ The Noob Unlimited ~

Sore wa sore, kore wa kore.
Back to top
View user's profile Send private message
atemv
n00b
n00b


Joined: 09 Aug 2014
Posts: 54

PostPosted: Mon Oct 19, 2015 12:14 pm    Post subject: Reply with quote

I also use the newest mono from the gentoo overlay:
Code:
=dev-lang/mono-4.0.3.20 ~amd64

Maybe this is also an important.
Back to top
View user's profile Send private message
Bloss
n00b
n00b


Joined: 05 Dec 2014
Posts: 20
Location: MI, USA

PostPosted: Wed Oct 28, 2015 5:47 pm    Post subject: Reply with quote

Maybe it would be ideal to setup a chroot, or a container?

Rebuilding glibc sounds terrible.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum