![]() |
[QuickFix/Guide] Compiling on Linux using GCC
For this guide we will be using GCC which is a free C compiler for Linux.
Also this guide is kind of a work in progress, as I am a new user of linux, GCC, and makefiles. The first thing you need to compile on linux is access to a linux platform. Access to a linux platform could be on a server or your home computer. For this guide I used the Ubuntu linux distro ( www.ubuntu.com ). A very easy way to install ubuntu on your computer is to use WUBI ( http://wubi-installer.org/ ). You can also use VirtualBox or VMWare Player to run linux on a virtual machine on your windows platform. I don't personally like this method because it runs really slow, for me at least. Also make sure you have the latest version of GCC with your linux distro. With Debian/Ubuntu distros you can do "sudo apt-get install gcc" in the terminal. Next step is to make sure you have a copy of the Jedi Academy SDK provided by Raven Software. Here is a link to download: http://jediknight3.filefront.com/fil...y_SDK_MP;20909 Off the bat, the source files will not compile with GCC without errors, so we are going to fix them. GCC will complain about instances of redefinition, which there are a few in the source files. Step 1) Find all instances of the function powf and rename it to Q_powf. in q_shared.h: change Code:
float powf ( float x, int y );Code:
float Q_powf ( float x, int y );Code:
float powf ( float x, int y )Code:
float Q_powf ( float x, int y )at line 444: Code:
ratio = powf(dampfactor, dtime);Code:
ratio = powf(dampfactor, dtime);In bg_vehicles.h there is a typedef redefinition. Go to line 477 where you see: Code:
// This is the implementation of the vehicle interface and any of the other variables needed. ThisCode:
// This is the implementation of the vehicle interface and any of the other variables needed. ThisCode:
//the guy who was previously the pilotCode:
//the guy who was previously the pilotStep 3) Fixing bg_public.h The same type of redefinition occurs in bg_public.h Go to line 423 where you see: Code:
typedef struct bgEntity_sCode:
#ifdef __GCC__Code:
//Data type(s) must directly correspond to the head of the gentity and centity structuresCode:
//Data type(s) must directly correspond to the head of the gentity and centity structuresYep, another redefinition here. Go to line 675 where you see: Code:
typedef struct Vehicle_s Vehicle_t;Code:
#ifndef __GCC__Go to line 712 where you see: Code:
// Following couple things don't belong in the DLL namespace!Code:
// Following couple things don't belong in the DLL namespace!Go to line 30 where: Code:
#ifndef _XBOXCode:
#ifndef _XBOXGo to line 500 where: Code:
#include "../namespace_begin.h"Code:
#include "../namespace_begin.h"Code:
}Code:
}Makefiles provide a convenient means to building source files into executables or shared libraries. Go to the codemp/game directory and inside it make a file named "Makefile". then just copy this stuff into the makefile and save it: Code:
#This will build the shared libray jampgamei386.so which will be in codemp/game. You can use "make clean", which will remove all the object files and the libary file in codemp/game. This guide will probably change since im new to all this *nix stuff. Also, fyi. I did not test this shared library on a server yet. So I am not sure if there are any runtime errors. |
Loading dll file jampgame.
Sys_LoadDll(/home/jk31/base/jampgamei386.so)... Sys_LoadDll(/home/jk31/base/jampgamei386.so) failed: "/home/jk31/base/jampgamei386.so: undefined symbol: trap_PointContents" Sys_LoadDll(./linuxjampded/base/jampgamei386.so) failed: "./linuxjampded/base/jampgamei386.so: cannot open shared object file: Not a directory" Resolving masterjk3.ravensoft.com masterjk3.ravensoft.com resolved to 63.146.124.53:29060 Sending heartbeat to masterjk3.ravensoft.com Sending heartbeat to masterjk3.ravensoft.com Sys_Error: Sys_LoadDll(jampgame) failed dlopen() completely! help :( |
EDIT: Scratch that, just add g_syscalls.o to the list and it should work (After you fix the extern "C" issue in that file the same way you did with vmMain in g_main.c) Thanks Subaru :D EDIT: Base works...fine... Wat. EDIT: All works fine, just had to actually START the server with sv_pure 0 :p (As opposed to changing + restarting...odd yah) Many thanks to TrippHop, Xycaleth, Subaru :D |
Hey, sorry guys I never got around testing this to make sure it works. I will do it soon when I get my linux distro working again.
Also, FYI, the __linux__ macro is for Intel C++ Compiler Linux version which is kind of confusing in cases like these: Code:
#include "../namespace_begin.h" |
| All times are GMT -4. The time now is 03:26 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
LFNetwork, LLC ©2002-2011 - All rights reserved.