Is it possible to build in Linux using cmake/make?

Hi all!

I’m trying to get an Engine build using cmake/make – this needs to be automated, and i really would prefer to use cmake to be able to configure the build.

I’m noticing that when I run, I do get a CMakeList.txt, which appears to work – however, it takes literally hours to run, and then when I try and use ‘make’ to build from that, i just end up with

g++: error trying to exec '/usr/lib/gcc/x86_64-linux-gnu/5/cc1plus': execv: Argument list too long

Despite setting my ulimit -s to allow for several megabytes of stack space, and even going so far as to try setting it to ‘unlimited’, nothing seems to work for that.

Am I missing some step here?

Is there a way to pare it down? Ultimately, i’m just going to need to build and package a game with this setup, the Editor and all the other stuff can be built via normal methods, most likely.

If you trying to automate the build, did you even considered trying to run UBT and UAT from command line, which uses cmake anyway (it reason why you have CMakeList.txt in first place)?

CMakeLists.txt that is being generated just invokes UBT, just like other projects. The ultimate way to build the engine is to run mono UnrealBuildTool.exe UE4Editor Linux Development, all project files (including Visual Studio) boil down to that.

As for the compilation speed, it heavily depends on the hardware and not the build system. On a workstation-class machine (16+ cores, 32+GB RAM) it should take less than half an hour to compile from scratch. (See here for benchmarks:

well, see, these things don’t seem to be particularly well documented, I don’t even know what UAT is :slight_smile: (i may just not know what to search for)

and it would seem that UBT does not use cmake, and that the state purpose for the cmake files seems to be to get Linux IDEs that can read them to work for parsing dependencies and such.

cmake UnrealEngine seems to take several hours to complete, which is far, far, far beyond anything I’ve ever experienced. Generates a few hundred megs of cmake data. :-S

well, I guess if ultimately we’re running UBT, then I need to dig into UBT and figure out how to swap out what it’s building everything with. Ultimately, I need to build everything with a customer supplied toolchain, not the defaults. It seems that this should work with cmake/make, but it ends up attempting to build with system compiler, instead of toolchain compiler. :-S

i was able to get the process to work outside of the automated build system (bitbake) by doing

mkdir build
cd build
cmake ..
make UE4Editor-Linux-Debug

… or at least, it seemed to. when I attempted the same thing in bitbake, i ended up with it providing all the compiler options as expected, but using the wrong compiler. And I guess I know now, that that would be because UBT is selecting and executing the compiler, and ignoring what is configured via cmake.

Take a look into Engine/Source/Programs/UnrealBuildTool/Platform/Linux/LinuxToolChain.cs, particularly places that are determining clang & other binutils paths. UBT can build with a non-system compiler (e.g. when cross-compiling for Linux on Windows or when using a bundled toolchain).

If your customer wants you to change a compiler to either icl or gcc, that might be a bigger challenge.

That’s a great place to start looking, thanks. I think what I’ll first attempt to do is just brute-force my way into that, just to see what happens, and get it at least trying to use the cross-compiler given, ‘arm-(device)-linux-gnueabi-’ and see what happens. There is a bitbake layer to build clang to cross compile for the device, though we aren’t currently using it, and not sure if it works. We’ll at least suss out some potential gcc issues.

Ultimately, I’d probably want to add a new piece to the ToolChain support in UBT, and contribute that if there’s no issues from the customer with contributing back.