Jump to content

Compilation Guide


Recommended Posts

Posted (edited)

Update (10/23/2024):

This thread is out of date, to compile, you can either follow OpenJK's compilation guide or Flate's Ubuntu/Debian tutorial here.




Prerequisites

Currently JKGalaxies can be compiled on the following platforms:

  • Win32 VS2014 and below
  • Win32 VS2015
  • Win64 VS2015

It currently does NOT compile on the following platforms:

  • Mac
  • Linux
  • Win64 VS2014 and below
  • MinGW

The following platforms will compile with some features omitted:

  • Visual Studio 2015

 

In addition to one of the above platforms, you will need:

  • CMake
  • Git (for the `develop` branch)

 

Compiling Guide

You'll need to acquire the source code for JKGalaxies. This can be done on our Github page by either cloning the repository or downloading a zipped version of it. If you wish to contribute to the project, it is highly recommended that you create a fork of the project and clone your fork. When you have changes pushed to your fork, you can use a pull request.

 

Currently, the directions for compilation are identical to the OpenJK Windows tutorial, located here:

http://jkhub.org/tutorials/article/145-compiling-openjk-win32-must-read-for-new-coders/

 

 

Extra Steps for Visual Studio 2015

Visual Studio 2015 has a radically altered C runtime library (CRT) and as a result of this change, the game does not compile correctly because some of the libraries were compiled with older CRTs. To counter this, you'll need to disable the OpenSSL cryptography package (currently not used).

Assuming you've loaded up the project in Visual Studio, right click on the MP Game Library in the Solution Explorer and select properties. Along the left hand side of the properties panel, do Configuration Properties > C/C++ > Preprocessor. On the line labelled Preprocessor Definitions, toggle the drop down and hit Edit. On a new line, add NO_CRYPTOGRAPHY.

You'll also need to use a different version of SDL, the window, sound and input manager used by OpenJK and its derivatives. If you don't have the Properties panel open, right click on the MP Client project and hit Properties. If you still have the properties panel open, simply click on the MP Client project in the Solution Explorer. From here, do Configuration Properties > Linker > Input. On the line labelled Additional Dependencies, toggle the drop down and hit Edit. Find these lines:

..\..\codemp\libraries\SDL2\lib\x86\SDL2.lib
..\..\codemp\libraries\SDL2\lib\x86\SDL2main.lib

and change it to this:

..\..\codemp\libraries\SDL2\lib\x86\vs2015\SDL2.lib
..\..\codemp\libraries\SDL2\lib\x86\vs2015\SDL2main.lib
Edited by Futuza
Linking to more up to date guide.
Futuza and Smoo like this
  • 1 year later...
Posted

I just tried it, it compiled but when i do make it stops at 20% and I get this error:

codemp/CMakeFiles/jkgalaxies.x86_64.dir/build.make:1802: recipe for target 'codemp/CMakeFiles/jkgalaxies.x86_64.dir/libraries/mp3code/csbt.c.o' failed
make[2]: *** [codemp/CMakeFiles/jkgalaxies.x86_64.dir/libraries/mp3code/csbt.c.o] Error 1
CMakeFiles/Makefile2:125: recipe for target 'codemp/CMakeFiles/jkgalaxies.x86_64.dir/all' failed
make[1]: *** [codemp/CMakeFiles/jkgalaxies.x86_64.dir/all] Error 2
Makefile:136: recipe for target 'all' failed
make: *** [all] Error 2
  • 2 weeks later...
Posted

 

I just tried it, it compiled but when i do make it stops at 20% and I get this error:

codemp/CMakeFiles/jkgalaxies.x86_64.dir/build.make:1802: recipe for target 'codemp/CMakeFiles/jkgalaxies.x86_64.dir/libraries/mp3code/csbt.c.o' failed
make[2]: *** [codemp/CMakeFiles/jkgalaxies.x86_64.dir/libraries/mp3code/csbt.c.o] Error 1
CMakeFiles/Makefile2:125: recipe for target 'codemp/CMakeFiles/jkgalaxies.x86_64.dir/all' failed
make[1]: *** [codemp/CMakeFiles/jkgalaxies.x86_64.dir/all] Error 2
Makefile:136: recipe for target 'all' failed
make: *** [all] Error 2

 

This seems to be an issue with MP3 code. Paging @@ensiform to see if anything has changed with OpenJK.

 

Also updating the first post.

Smoo likes this
Posted

I think i was trying the jkg that I forked and not the official one though, or do forks also get updated automatically?

Posted

Actually I realised I didn't fork jkg cause It just take me to my openjk fork if i try to lol so yeah not sure what issue is

Posted

Actually I realised I didn't fork jkg cause It just take me to my openjk fork if i try to lol so yeah not sure what issue is

First of all I recommend using SourceTree if your on windows or mac, to make using git easier, especially when it comes to merging (you're still going to want a comparison tool like kdiff3 though).  However, if you just want to use the git bash shell here's some basic guidelines:

 

 

Do this with git:

git clone https://github.com/JKGDevs/JediKnightGalaxies.git

Alternatively, you can do what I do and make your own github fork, just click the fork button or this link.  Then use the url of your fork instead of the JKGDevs master copy.  You then have to remember to do pull requests when you're ready to submit changes.  I mostly do this so I can commit changes as often as I like and easily switch machines without having to mess the JKGDevs git all up, so for example if I'm in the middle of working on a function, but I don't have time to finish it I can submit it then go to work and pull it, and work on it on my freetime at work.  If you're just going to be working on one machine then it's probably overkill doing this.

 

When ready to submit code do:

git add *
git commit -m "Message about what you're submitting"

When ready to send to remote server:

git push origin masterORnameofbranch

To get latest updates and update your local copy:

git pull origin

To get latest updates and update your local copy without keeping any of your changes (overwrite all your stuff, no merging):

git fetch origin
git reset --hard origin

To switch branches

git checkout nameofbranch
Smoo and eezstreet like this

JKG Developer

  • 1 month later...
Posted

Tried to compile just the severside on linux today and got this error:
"codemp/game/CMakeFiles/gamex86_64.dir/build.make:974: recipe for target 'codemp/game/CMakeFiles/gamex86_64.dir/g_session.cpp.o' failed

make[2]: *** [codemp/game/CMakeFiles/gamex86_64.dir/g_session.cpp.o] Error 1
CMakeFiles/Makefile2:167: recipe for target 'codemp/game/CMakeFiles/gamex86_64.dir/all' failed
make[1]: *** [codemp/game/CMakeFiles/gamex86_64.dir/all] Error 2
Makefile:136: recipe for target 'all' failed
make: *** [all] Error 2"
 
The jkgalaxiesded.x86_64 file worked but the I guess the rest of the code didn't. Lol
Posted

So that's your make file's error, are you getting a compiler error as well?

I had no compiler error

  • 1 month later...
Posted (edited)

I realize this is not at all helping with the issue you were having NubSmoo, and I hope to start looking at linux compiles soonish, but want to make a few notes when it comes to compiling JKG with vs2015 that are not included in eezstreet's original post.  Please also note, I have not extensively tested my findings yet on multiple machines, so there may be things I missed.  To begin, note that I'm using vs2015 with the latest update so it is entirely possible this may not work with vanilla vs2015 entirely.

 

 

For easy building copy the CreateVisualStudio2013Projects.bat and then rename it to CreateVisualStudio2015Projects.bat and change the 12 to a 14, like so:

cmake -G "Visual Studio 12" -D CMAKE_INSTALL_PREFIX=../install ..
cmake -G "Visual Studio 14" -D CMAKE_INSTALL_PREFIX=../install ..

Run the batch (make sure you have CMake installed) and it will build the solution and project.

 

In JediKnightGalaxies\codemp\libraries\json\cJSON.cpp change line 46-50 from:

#ifdef WIN32
#define snprintf sprintf_s
#endif

to

#ifdef WIN32
#if (_MSC_VER < 1900)		//No longer necessary in vs2015  --Futuza
#define snprintf sprintf_s
#endif
#endif

Finally, you need to replace the SDL2 source with the latest version that has fixes for vs2015 ( JediKnightGalaxies\codemp\libraries\SDL2\ ), you can get it here.  You also will need to use the SDL2.dll from this build in your builds.

 

I plan on making these changes and possibly others (if I encounter other issues while testing) in a new commit once I've finished some other fixes and I'll update the github source so doing these steps will no longer be necessary, until then make sure you implement these changes if using vs2015 if you want it to compile.  And yes, I suppose this means I'm working on JKG again for the moment. :P

 

EDIT: The necessary changes have been pushed to the latest master branch on the github, vs2015 should work fine now.

Edited by Darth Futuza
Updating Information
Smoo likes this

JKG Developer

Posted

You should submit a pull request with those changes to the code, if you haven't already. Also I'm about 90% sure that issues with SDL are fixed in latest OpenJK.

Smoo likes this
Posted

Okay so I just got back from my trip I'll see if I have time to add this while I'm at work.  @@eezstreet did you want me to use the code from openjk regarding the sdl, or just grab the latest sdl and use that?  Cause I really don't want to try to merge jkgalaxies with openjk at the moment, that'll be like 1000+ commits to sift through.

Smoo likes this

JKG Developer

Posted

Just pull and resolve conflicts using mergetool. Make the software do the work.

I'm not quite sure it'll be as magic as you make it sound, but I'll give it a go.  You going to be on irc tonight or tomorrow in case I run into problems?  What tool do you usually use for diff comparisons, kdiff, something else?

Smoo likes this

JKG Developer

Posted

kdiff works.

You need to set up a remote for the OpenJK repository if you haven't already. Here's how you would do it:

 

git remote add openjk https://github.com/JACoders/OpenJK

Switch to 'develop' branch:

 

git checkout develop

Pull from OpenJK:

 

git pull openjk master

Resolve conflicts:

 

git mergetool
Smoo likes this
Posted

So I pushed the changes I mentioned in my previous post (finally, lol) so if you're using vs2015 it should work fine now. I then tried to do the merge with openjk.  After about 4 hours of trying to resolve conflicts correctly so there were no more errors I gave up and couldn't get it to compile, I'll try again latter when I'm feeling a bit more motivated.

Smoo likes this

JKG Developer

Posted

Does OpenJK still compile in VS2010 ?

 

I thought the aim was to make the JKA code stable and fixing errors.Not modifying it to a point where people have to by a new PC with the latest program's just to get it to compile?.

 

If this is not the case then i just want to ask where can i get a Jedi Academy source code in OpenJK format that will compile in VS2010..Wasn't that the original idea?

Posted

OpenJK can compile in VS C++ 2010 there is a bat file for that in OpenJk's folder that you can use after have make the cmake setup :)

Posted

Does OpenJK still compile in VS2010 ?

 

I thought the aim was to make the JKA code stable and fixing errors.Not modifying it to a point where people have to by a new PC with the latest program's just to get it to compile?.

 

If this is not the case then i just want to ask where can i get a Jedi Academy source code in OpenJK format that will compile in VS2010..Wasn't that the original idea?

The original idea was to make the code stable. Newer language features can make this easier to achieve which require newer compilers.

 

The original code had many instances of invalid (non-compliant) code as well which newer compilers will flag up as errors.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...