Legacy: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.
- 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
- create the .uc file in one machine and copy it over to the other one
- run "ucc make" on the *Windows* machine
- copy over the resulting HazardClasses.h to Linux
- create the source files in Src
- on a shell prompt, go to Hazard/Src
- 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
- link: ld -shared -o ../../System/Hazard.so Hazard.o ../../System/Core.so ../../System/Engine.so
- 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.
- get the bound .u file to Linux.
- 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.