How to Cross-Compile for Linux in Unreal Engine - Setting up the Toolchain

Ғылым және технология

Part 2: • How to Cross-Compile a...
In this tutorial, we go over the bare basics for cross compilation in Unreal Engine. This is very useful if you want to make games for the Linux platform when you are developing on a Windows computer. The bare minimum steps to achieve cross compilation include building Unreal Engine source, and setting up the toolchain.
Unreal Linux toolchain: docs.unrealengine.com/en-US/S...
Unreal Engine source: github.com/EpicGames/UnrealEn...
Epic Games account: www.epicgames.com/account/
How to support the channel:
Get a shirt or sweatshirt with free shipping (Use code "SHIP" at checkout): teespring.com/stores/flopperam
Become a member: / @flopperam
Support us on Patreon: / flopperam
Donate to our PayPal: www.paypal.me/flopperam
Sponsor us on Github: github.com/sponsors/chris-gong
Social media links:
Discord: / discord
Twitter: / flopperam
Instagram: / flopperam
Facebook: / flopperam
Music creds:
Song: Wonder - LAKEY INSPIRED
Music promoted by BreakingCopyright: • Video
#unreal #crosscompilation #linux
0:00 Installing the toolchain
1:41 Checking environment variables
2:51 Unreal Engine source (no longer needed)
5:41 Building a project for the Linux platform

Пікірлер: 68

  • @copypast6219
    @copypast62195 жыл бұрын

    Thank you very much I look forward to the second part

  • @Flopperam
    @Flopperam4 жыл бұрын

    Just a note for anyone watching, the step where we set the environment variable (1:45 - 2:47) for linux_multiarch_root to the path of the folder that contains all the Linux architecture folders is optional with versions of clang 8 and up unless you have multiple versions of the toolchain downloaded. When installing the linux toolchain, the linux_multiarch_root environment variable may be set automatically to the path of the folder of the latest version downloaded, so just make sure that the path in this variable is set to the version of the toolchain that you want to use.

  • @siddharthpreetham1408
    @siddharthpreetham14083 жыл бұрын

    Super useful tutorial! Thank you so much!

  • @alvarodorado35
    @alvarodorado352 жыл бұрын

    Very useful! Works great. I have used 4.27 and source code its not needed, just install toolchain and restart the pc, then packaging

  • @thecoone2797
    @thecoone27974 жыл бұрын

    dont let this 9 minute video fool you. It works, but it takes about 10 hours to complete the full process

  • @kevinossia9121

    @kevinossia9121

    4 жыл бұрын

    Need a better CPU and an SSD to boot :)

  • @olliveraira6122

    @olliveraira6122

    3 жыл бұрын

    VS Code also lets you compile quite a bit faster

  • @kinggore5229

    @kinggore5229

    3 жыл бұрын

    Took me 6 hours...You definitely need an SSD.

  • @thecoone2797
    @thecoone27974 жыл бұрын

    Just click build ... and okay now that's its built we... . Me: Okay so it must not take that long right. 6 hours later: module 2365/3264

  • @ChaojianZhang
    @ChaojianZhang2 жыл бұрын

    This video is under-rated.

  • @christopherrisewick4240
    @christopherrisewick42403 жыл бұрын

    This video just saved my ass. Thanks! Should also point out that with 4.25 I didn't need to specify the Windows paths. ymmv.

  • @KaasTVNL
    @KaasTVNLАй бұрын

    THANKYOU

  • @paulothink
    @paulothink5 жыл бұрын

    1. Recent installer of clang for unreal 4.22 already makes your environment variable. 2. Restart your machine after installing it, otherwise Unreal won't be able to use that env var I just gave you an extra hour of life Did anyone manage to package to linux ARM? Not working on mine "UATHelper: Packaging (Linux): ERROR: Missing precompiled manifest for 'Launch'. This module was most likely not flagged for being included in a precompiled build - set 'PrecompileForTargets = PrecompileTargetsType.Any;' in Launch.build.cs to override. PackagingResults: Error: Missing precompiled manifest for 'Launch'. This module was most likely not flagged for being included in a precompiled build - set 'PrecompileForTargets = PrecompileTargetsType.Any;' in Launch.build.cs to override. UATHelper: Packaging (Linux): Took 8.4049576s to run UnrealBuildTool.exe, ExitCode=5"

  • @Squarecoin

    @Squarecoin

    3 жыл бұрын

    @DarknessFX Did you ever get round to testing it on the PI? I have a project coming up that might benefit from having UE4 builds on Pi 4s (which have a lot more OpenGL support)...but there seems to be impressively little discussion about UE4 on pi.

  • @Tetsujinfr

    @Tetsujinfr

    3 жыл бұрын

    @@Squarecoin did you success building for ARM? There is a note on the Epic UE4 linux crosscompiling webpage which mentions that "for toolchain v4 through v7, we also provide the libraries and toolchains that enable you to compile for Linux ARM (original Raspberry Pi and up)". So wondering if I need to install UE4.13 with toolchain 4.7 to get it to work or if I can go with the most recent UE/toolchain versions?

  • @epiccodmoments9833

    @epiccodmoments9833

    2 жыл бұрын

    cheers lol

  • @paulothink

    @paulothink

    2 жыл бұрын

    @@Tetsujinfr I forgot to update it here. I was lucky to be part of the early access patch of the Linux build support for ARM64 back then, and it has been merged to the main release since UE4.23 😉 It generally works, but it's not possible for EPIC or anyone to guarantee it to work on every embedded system. It works like a charm on the Nvidia Jetson boards, which is where EPIC tested. Sure, it has limitations, some DLLs or plugins may not work, graphics API should use the embedded shader model, but all the heavy lifting of the engine seemed to work fine. I haven't tested it on a PI, though. I read a little on it, and from my rough understanding, you may hit a brick wall if the (proprietary?) broadcom video driver from RPI doesn't come with the Vulkan drivers installed and linked with all the flags that UE4 needs in order to function, like the video drivers provided on the Jetson boards by Nvidia do.

  • @FromTheRiverToTheSeaAmIsrael
    @FromTheRiverToTheSeaAmIsrael3 жыл бұрын

    Hi. Thanks for the tutorial. Can you tell if there are any base requirements for the target Linux machine to run such a build ? E.g what C/++ runtime libs should be installed on the machine , or unreal compiles stdlib statically?

  • @Flopperam

    @Flopperam

    3 жыл бұрын

    Good question. I'm not entirely sure because unlike Windows builds, Linux builds, at least when cross-compiled from Windows, don't come with a UE4PrereqSetup file. For instance, this article, docs.unrealengine.com/en-US/Basics/RecommendedSpecifications/index.html, lists out the various DirectX software components needed to run the engine. However, as far as I know and I could be wrong about this, there is no native Linux support for DirectX. I have run a cross-compiled Linux build on an Amazon EC2 instance before with no need to install extra components but I don't know what was pre-installed on that instance. Technically the Setup.sh script used before building Unreal Engine source on Linux will install the necessary prerequisite files/libraries for running the engine but I don't know exactly what that script installs.

  • @Flopperam
    @Flopperam3 жыл бұрын

    Hey guys, wanted to write a comment updating this tutorial. With newer versions of Unreal Engine, you no longer have to create a new LINUX_ROOT or LINUX_MULTIARCH_ROOT environment variable nor do you have to rerun the Setup.bat, GenerateProjectFiles.bat files, and rebuild the engine after installing the Linux toolchain. All you have to do is install the Linux toolchain and that is simply it. However, I believe that you still need the source build version of Unreal Engine, not the Epic Games Launcher version. Someone please correct if I am wrong!

  • @Flopperam

    @Flopperam

    3 жыл бұрын

    @@joshpaoletti1871 I believe you just download the installer from the website linked in the description (docs.unrealengine.com/en-US/Platforms/Linux/GettingStarted/index.html). Then, just run the installer and it should take of everything for you. Let me know if you have trouble finding it.

  • @luischavesdev

    @luischavesdev

    3 жыл бұрын

    As of version 4.25, I can confirm you don't actually need the source version, it's as simple as downloading the toolchain and going straight into the editor to start compiling. That said, in my engine installation options', the "Engine Source" option is ticked, so that might have something to do with it. Don't quote me on that though. For all intents and purposes, that checkbox should be ticked by default if the engine was installed through the Epic Launcher, so... there's that. Still, great video btw!

  • @pthevenphtevenson9180

    @pthevenphtevenson9180

    3 жыл бұрын

    @@luischavesdev Just a small addition. When trying that first with my 4.26.2 launcher version it didn't work, although I had all the correct options enabled. Disabled the option for Linux as a target platform, applied, then enabled it again and applied. After that it worked.

  • @luischavesdev

    @luischavesdev

    3 жыл бұрын

    @@pthevenphtevenson9180 If all fixes were like that hehe When in doubt, there's nothing like a reset!

  • @smt_

    @smt_

    3 жыл бұрын

    @@pthevenphtevenson9180 i had a kinda similar experience, i installed the clang toolchain and it didn't quite work but i just gave my system a restart and then it's worked just fine

  • @thumpergames1369
    @thumpergames13694 жыл бұрын

    This is clearly a tutorial for UE4 devs, but I love how he instructs us on how to get around the windows defender pop up haha. So patronizing lol. Hell a middle school kid even knows how to install games now days lol

  • @jayantbarthwal4470
    @jayantbarthwal44702 жыл бұрын

    Will it be making linux build for ARM architecture or x86 architecture ?. Will that run on raspberry pi ?

  • @Flopperam

    @Flopperam

    2 жыл бұрын

    Afaik for Raspberry Pi, the process is a little more involved. You can find more info about that here, github.com/rdeioris/UnrealOnRPI4 But essentially you'll need the source build version of Unreal Engine in order to make modifications to the engine code for Vulkan before cross-compiling your project for the Linux AArch64 platform.

  • @jayantbarthwal4470

    @jayantbarthwal4470

    2 жыл бұрын

    @@Flopperam Thanks for the link

  • @olliveraira6122
    @olliveraira61223 жыл бұрын

    Is it simply not possible to build for Linux, Xbox or PS4 without a source build? I find it such a pain having to build the entire engine every time you wanna update, I never modify the engine anyway :c

  • @Flopperam

    @Flopperam

    3 жыл бұрын

    This I'm not sure but would be interested to know as well.

  • @Chris-er5py
    @Chris-er5py4 жыл бұрын

    My name is Chris too :-)

  • @ItzRyanF00
    @ItzRyanF002 жыл бұрын

    Can you do this with Mac too?

  • @Flopperam

    @Flopperam

    2 жыл бұрын

    Sorry for the late reply but afaik no. However it has been a while since I've done cross compilation so I could be wrong.

  • @wanlinghuang2534
    @wanlinghuang25342 жыл бұрын

    hi, project.sln file not generated by project.uproject,why?

  • @Flopperam

    @Flopperam

    2 жыл бұрын

    A visual studio solution file will only be generated for a c++ project, not blueprint-only projects.

  • @wanlinghuang2534

    @wanlinghuang2534

    2 жыл бұрын

    @@Flopperam thanks😘

  • @olliveraira6122
    @olliveraira61223 жыл бұрын

    But here you are actually still compiling the editor using MVSC. I were kinda hoping to go all Clang but there arent really any tutorials on what configs you need to change for that :V

  • @Flopperam

    @Flopperam

    3 жыл бұрын

    Very fair point, I hope to revisit this topic again in the future so I will try to keep this comment in mind when I do.

  • @olliveraira6122

    @olliveraira6122

    3 жыл бұрын

    @@Flopperam Im not so sure its even supported after looking around all over the place. Im honestly very confused about *what* exactly Unreal added Clang support on Windows for? Seems like some little side project that didnt make it to the other end to me?

  • @Flopperam

    @Flopperam

    3 жыл бұрын

    @@olliveraira6122 I'll be honest and say that I'm not too sure myself either. If you're not already in there, I would suggest joining the Unreal Slackers discord and asking in the Linux text channel as they have a lot of knowledgeable people on who can give much better answers than me on this subject I assume.

  • @olliveraira6122

    @olliveraira6122

    3 жыл бұрын

    @@Flopperam Came back to this video today by accident. It turns out that you can actually compile projects using Clang without issues as of recent engine versions (you cant compile UE4 using Clang, with custom C++ code appear to be fine). Its just a matter of editing the BuildConfiguration.xml: Clang Latest Ive been doing this for a while now, its a little faster than compiling with cl.exe for me (if you disable some optimizations since clang optimize like crazy by default, which takes a bit of compile time)

  • @Flopperam

    @Flopperam

    3 жыл бұрын

    @@olliveraira6122 thank you for the useful insight!

  • @PolyMadd
    @PolyMadd2 жыл бұрын

    Man... they removed support from cross-compiling in UE5... damn it.

  • @Flopperam

    @Flopperam

    2 жыл бұрын

    Cross compiling is still supported in ue5. For 5.0, the 4.27 toolchain will do.

  • @PolyMadd

    @PolyMadd

    2 жыл бұрын

    @@Flopperam Doh! Thank you dude! Why they don't mention this in the UE5 manual????

  • @Flopperam

    @Flopperam

    2 жыл бұрын

    I think it's implied since ue5.0 is technically a fork of 4.27, but yea it's not obvious.

  • @PolyMadd

    @PolyMadd

    2 жыл бұрын

    @@Flopperam exactly: it's obvious for "technical people", but in example, I am essentially a creative, with a decent knowledge of basic programming, but I am not a programmer at all, so for me all these platforms, midwares, etc. are unknown and though I can extrapolate that it SHOULD work mostly with the old system, I wouldn't want to waste time installing lots of stuff for nothing. Then I go to the manual and find that the section has NOT been reported like the rest of the UE5 manual, where you can still read that they are pages from the 4.27, and a big ? pops over my head, suggesting to me that for some reason the cross-compiling needs more work to become effective. Et voila I search a bit and nowhere this is mentioned!

  • @bigeyes8328
    @bigeyes83282 жыл бұрын

    but therer is no .exe file ????

  • @Flopperam

    @Flopperam

    2 жыл бұрын

    I believe in newer versions of Unreal Engine, you no longer need to do any additional work to cross-compile for Linux from Windows.

  • @bigeyes8328

    @bigeyes8328

    2 жыл бұрын

    @@Flopperam we do . Bro can u please solve my problem . When i try to build my project in vs 17 with Configuration as development server for linux , it says in log that selected configuration/platform is not valid for this target . can u please help me !!!!!!!!!!!!

  • @Flopperam

    @Flopperam

    2 жыл бұрын

    Are you using unreal engine built from source?

  • @bigeyes8328

    @bigeyes8328

    2 жыл бұрын

    @@Flopperam yes bro , obviously . and i have built it in VS also .

  • @bigeyes8328

    @bigeyes8328

    2 жыл бұрын

    @@Flopperam can u plz help[ me with this

Келесі