| Home Page | Recent Changes | Preferences

Native Coding On Linux

Here's how I (almost) managed to compile native code for Linux UT. WARNING: this does not work for me, the final result segfaults - but then again, linux ut likes to segfault anyway.

Requirements: you need both a Linux and Windows systems, with latest UT and source distribution. I find it easier to use two machines, but if you can, you can try wine, Plex86 or (last resort) dual-boot. In this text I'll assume you have two machines, if you don't, make the necessary mental adjustments.

I couldn't compile successfully using Epic's source distribution; there were some problems with the Un*.h header files. I fetched over UnGnuG.h from OpenUT and fixed a few things, my file is at UnGnuG.h if you need it. I believe you could try compiling with the full OpenUT sources instead of the source distribution, but it would probably segfault if your UT binary is not built from OpenUT (some variables are double in one version and float in the other, for example).

I'm using the tutorial linked from Native Coding, which builds a mod named Hazard.

  1. first, create the directory tree as described in the tutorial, in both machines. Alternatively, use some form of file sharing to have a single source tree for both; in this case disregard all "copy over" instructions
  2. create the .uc file in one machine and copy it over to the other one
  3. run "ucc make" on the *Windows* machine
  4. copy over the resulting HazardClasses.h to Linux
  5. create the source files in Src
  6. on a shell prompt, go to Hazard/Src
  7. compile: gcc -c -O2 -Werror -fomit-frame-pointer -mpentium -D_REENTRANT -o Hazard.o -I ../../Core/Inc -I ../../Engine/Inc -I ../Inc -D __LINUX_X86__ -D__STATIC_LINK=0 -fno-for-scope hzTest.cpp
  8. link: ld -shared -o ../../System/Hazard.so Hazard.o ../../System/Core.so ../../System/Engine.so
  9. fabricate the .dll file on Windows like the tutorial says, then run "ucc make" (on Windows) again to bind the .u file to the dll.
  10. get the bound .u file to Linux.
  11. test it as the tutorial says. Should work. For me it segfaults :-(

Foxpaw: Epic says that native coding under Linux doesn't work and to my knowledge they don't plan to fix it it anytime soon. That may be why it's having a segmentation fault.

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

FAQs

Help Desk

Mapping Topics

Mapping Lessons

UnrealEd Interface

UnrealScript Topics

UnrealScript Lessons

Making Mods

Class Tree

Modeling Topics

Chongqing Page

Log In