Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: How do you compile LCS?  (Read 4201 times)

botea

  • Bay Watcher
    • View Profile
How do you compile LCS?
« on: September 02, 2014, 03:22:51 pm »

I'm spoons for pants dumb when it comes to compiling so can someone please explain to me how to compile LCS.
Very simply. ???
Logged

Cheedows

  • Bay Watcher
  • Still a dwarf, right?
    • View Profile
Re: How do you compile LCS?
« Reply #1 on: September 02, 2014, 06:15:03 pm »

I wouldn't really know how you use spoons for pants... :o. Nah, I'm kidding. You mean how to extract the compressed folder with LCS?
Logged

botea

  • Bay Watcher
    • View Profile
Re: How do you compile LCS?
« Reply #2 on: September 02, 2014, 09:26:43 pm »

what I mean is how to get the newest revision to work.
Logged

SuicideJunkie

  • Bay Watcher
    • View Profile
Re: How do you compile LCS?
« Reply #3 on: September 02, 2014, 10:39:48 pm »

What have you got so far, and what errors is it giving you?
Logged

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Re: How do you compile LCS?
« Reply #4 on: September 03, 2014, 12:44:08 am »

What operating system are you using?

On Windows I'd recommend either the Code::Blocks IDE with TDM-GCC 4.8.1 or later (choose codeblocks-13.12mingw-setup-TDM-GCC-481.exe at this download page), or Microsoft Visual C++ 2010 Express (download it here). Both of them provide complete IDE, editing, compiling, building, and debugging functionality. The project files for both of them are in the workspaces directory.

On Linux, Mac OS X, or other UNIXes, you should try reading the file LINUX_README.txt. Recently SDL 2.0.3 and SDL_mixer 2.0.0 were added as dependencies and the Makefiles for Linux, Mac OS, and other UNIXes haven't yet been updated to include this. So to compile things without SDL or SDL_mixer, you might need to #define DONT_INCLUDE_SDL, either by uncommenting a line in common.h that would define that if you uncommented it, or defining it using GCC compiler options (add "-D DONT_INCLUDE_SDL" to the command-line options for GCC, which are sometimes called the CFLAGS). Either that or you could update the Makefiles to include SDL, which would be the ideal solution. I don't really understand Makefiles very well so I haven't changed them, I've just tried to document what should be done in README and LINUX_README.txt.

We actually need a Linux or Mac OS X or UNIX programmer to fix the Makefiles to work with SDL. I don't understand it enough to do it myself. I updated the project files for Code::Blocks and Visual C++ and got the Code::Blocks one working but couldn't test the Visual C++ one since I don't have Visual C++ (I added the necessary dependencies to the Visual C++ project file but didn't change anything else in it). Jonathan S. Fox then fixed the Visual C++ one (one of the lines had to be changed from MultiThreadedDebug to MultiThreadedDebugDLL, I'm not sure how he figured out he had to do that but it's fairly impressive).

We do have 2 active contributors in recent months that I know use Linux who have both fixed Linux compilation stuff: blomkvist and nickdumas. I am hopefully expecting that one of them will fix compilation on Linux to work with SDL. I guess maybe I should have posted on the forums that I need a Linux person to fix that. (Or a Mac OS X or FreeBSD or whatever else person... but actually with SDL and SDL_mixer it's different on all of those operating systems, they all have different audio subsystems... Mac OS X has CoreAudio, Linux has ALSA, and FreeBSD has OSS, and OSS, which the BSDs use, doesn't work with SDL and SDL_mixer, on the BSDs you have to install this additional audio subsystem called JACK, and then SDL and SDL_mixer can interface with JACK for sound the same way they interface with ALSA on Linux, CoreAudio on Mac OS X, and MME on MS Windows). Oh and also on Linux and FreeBSD you need to use a MIDI synthesizer, either the Timidity built into SDL_mixer, by putting GUS patches in the correct location as described in LINUX_README.txt, or by installing FluidSynth, either of which SDL_mixer version 2 can automatically detect at runtime, there's no need to link against them, SDL and SDL_mixer are very sophisticated at detecting your sound systems at runtime. But the Makefile probably doesn't have to deal with any of this because this is all dealt with at runtime by SDL and SDL_mixer, so I think the same Makefile will work on Linux, Mac OS X, FreeBSD, and other UNIX, without needing to specify any details about what audio subsystems are on your computer, since SDL and SDL_mixer are smart enough to figure that out on their own at runtime. They even work on iOS and Android and have native MIDI support on both of those, amazingly enough.

And if you use DOS you just compile the Windows version and then use HX DOS Extender to run it. This is compatible with DOS emulators like DOSBox. And the Windows version is also compatible with the Windows emulator Wine that's used on Linux (and, with greatly increased difficulty, Mac OS X). But running the Windows version on Linux or Mac OS X using Wine is a hack and compiling a native version for your operating system ought to work even better.

OK so I'll put out a plea here for someone to fix the makefiles to work on Linux:

Please if you are a Linux developer, especially if you are blomkvist or nickdumas or another member of the SourceForge project, fix the Makefiles to work with SDL 2.0.3 and SDL_mixer 2.0.0 on Linux!

Yes, please, somebody do that. In the meantime, define DONT_INCLUDE_SDL in your CFLAGS when compiling with SDL and it ought to work just fine with the latest revision, the only problem you'll encounter is there will be things in the user interface mentioning enabling or disabling music but it won't have any effect since you won't hear any music. To hear music you need SDL and SDL_mixer included.

Or as an alternative, try and see if you can compile revision 829, which doesn't have SDL or music in it at all, and is relatively stable. If you can't even get IT to compile correctly, then maybe we might have an even bigger problem... I'm pretty sure it does work on Linux though, since nickdumas contributed revision 833 and it didn't include any compilation fixes for Linux, meaning revisions 828-835 all definitely compile correctly on Linux without any changes (revision 828 fixed some stuff to compile correctly on Linux though). So yeah, revision 829 ought to compile correctly without any difficulty at all on Linux, without having to define DONT_INCLUDE_SDL in your CFLAGS or edit the makefile or anything, as with revision 836 and later. It is the most stable revision in the 828-835 range. Revision 839 or later is what you should use if you want SDL (SDL was introduced in 836 but 836 still had a couple major bugs, revision 837 was quite stable but only compiles correctly in Code::Blocks with TDM-GCC 4.8.1 or later, revision 839 fixes things so now it compiles correctly in Microsoft Visual C++ too, but we still need compilation on UNIX-based systems fixed to work with SDL included rather than simply using the DONT_INCLUDE_SDL workaround).

I could actually change the source code to disable SDL on Linux and Mac OS X explicitly and then the latest versions would compile correctly but then you wouldn't ever get music on those platforms, I don't want to deprive Linux and Mac OS X users of music, instead you get to decide whether or not you want music when you compile (if you don't want music or SDL, define DONT_INCLUDE_SDL).

Sorry about the length of the comment, it is just that SDL and SDL_mixer are a little bit hard to include at first but once you get them included properly they work great without any problems. Oh, and if you get it compiled correctly on Linux but you don't have a MIDI device such as FluidSynth and you don't have GUS (Gravis UltraSound) patches for SDL_mixer's built-in MIDI synthesizer Timidity to use, I am pretty sure that instead of the program crashing, it will just gracefully fail to play music but everything else should work fine without the program crashing or anything nasty like that.

UPDATE: I fixed the Makefiles and Autoconf script myself, it might work on Linux, it might not, hopefully it does. I also fixed Release builds for MS Visual C++. So hopefully now it will compile on any platform. This is as of revision 840. I did quite a bit of research into Autoconf and looking at Autoconf scripts for other projects that use SDL to figure out how to do it. It ought to work but I'm not entirely sure.
« Last Edit: September 03, 2014, 06:58:18 am by Liberal Elitist »
Logged
The Liberal Crime Squad wiki is your friend.

Quote from: Lielac
Edit: Figured it out via a little bit of trial and error and oH MY GOD WHAT IS THIS MUSIC WHAT IS THIS MUSIC WHAT THE HECK IS IT SPACEBALLS MUSIC? WHATEVER IT IS IT IS MAGICAL

Rolan7

  • Bay Watcher
  • [GUE'VESA][BONECARN]
    • View Profile
Re: How do you compile LCS?
« Reply #5 on: September 03, 2014, 12:54:09 am »

Ninja'd by Liberal Elitist (I got super distracted), but here's a simple set of instructions for Windows.  Last I tried, the Visual Studio project file wasn't working right (Visual Studio 2010 Express) so just use Code::Blocks
« Last Edit: September 04, 2014, 03:55:34 pm by Rolan7 »
Logged
She/they
No justice: no peace.
Quote from: Fallen London, one Unthinkable Hope
This one didn't want to be who they was. On the Surface – it was a dull, unconsidered sadness. But everything changed. Which implied everything could change.

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Re: How do you compile LCS?
« Reply #6 on: September 03, 2014, 01:14:41 am »

Go to http://sourceforge.net/p/lcsgame/code/837/tree/trunk/ and click "Download Shapshot".  Create a directory somewhere, I called it LCS_Source, and unzip the snapshot there.

...

When it finishes, the game will start.  Congratulations, you're playing the most recent version (no but it is a recent stable revision) of Liberal Crime Squad :D

False. Right now the most recent revision is 840. If you want the latest revision guaranteed you can use the "HEAD" revision on SourceForge. Here is how...

Go to http://sourceforge.net/p/lcsgame/code/HEAD/tree/trunk/ and click "Download Shapshot". The other directions are exactly the same as what Rolan7 said, I just had to correct the inaccuracy about 837 being the latest. This is important because revision 839 fixes compilation of Debug builds in MS Visual C++ which was broken in revisions 836-838, and then revision 840 fixes Release builds for Visual C++, as well as fixing Makefiles and Autoconf scripts for Linux/Mac OS X/etc. so that they should probably work again (they didn't in 836 thru 839) but I'm not 100% sure. But hopefully revision 840 will compile on all different platforms once again. If there are any minor mistakes in my changes to the Autoconf script or Makefiles they should be easy to fix by anyone on Linux, I've already included all the necessary files and put in the proper code to either include SDL2 and SDL2_mixer if they are there, or warn people about them not being there and define DONT_INCLUDE_SDL so that it is built without any SDL dependencies.
« Last Edit: September 03, 2014, 07:03:30 am by Liberal Elitist »
Logged
The Liberal Crime Squad wiki is your friend.

Quote from: Lielac
Edit: Figured it out via a little bit of trial and error and oH MY GOD WHAT IS THIS MUSIC WHAT IS THIS MUSIC WHAT THE HECK IS IT SPACEBALLS MUSIC? WHATEVER IT IS IT IS MAGICAL

Rolan7

  • Bay Watcher
  • [GUE'VESA][BONECARN]
    • View Profile
Re: How do you compile LCS?
« Reply #7 on: September 03, 2014, 10:03:41 am »

Thanks LE!  It defeats the purpose if they aren't getting the most recent snapshot  :o
Logged
She/they
No justice: no peace.
Quote from: Fallen London, one Unthinkable Hope
This one didn't want to be who they was. On the Surface – it was a dull, unconsidered sadness. But everything changed. Which implied everything could change.

botea

  • Bay Watcher
    • View Profile
Re: How do you compile LCS?
« Reply #8 on: September 04, 2014, 03:46:46 pm »

Ninja'd by Liberal Elitist (I got super distracted), but here's a simple set of instructions for Windows.  Last I tried, the Visual Studio project file wasn't working right (Visual Studio 2010 Express) so just use Code::Blocks
Thank You!
I have been trying so hard to get it working so this is a great time saver.
Logged

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Re: How do you compile LCS?
« Reply #9 on: September 06, 2014, 02:59:42 am »

I am glad that people are finding success with this now. :P

     One of the great benefits of being able to compile the game yourself is you can change anything you want in the source code, compile it, and then play the game that way. This gives you much more modding ability than just editing XML files in the art directory. I would recommend using an SVN client like TortoiseSVN for getting the source code instead of directly downloading it, if you are modding the game... that way you can update to the latest version of source code and it will merge the SVN changes with the changes made in your mod and tell you if there is any conflict, and allow you to manually resolve the conflict yourself. That is the easiest way to have a mod that is kept up-to-date with the latest revisions, since most of the changes will probably not overlap changes made by your mod so the SVN client will merge things together on its own and save you the work of having to do it manually.

     I have had a few problems with the latest TortoiseSVN 1.8.8 though (one that the program claimed was a bug in Apache SubVersion that I should submit to the Apache SubVersion mailing list), and am considering downgrading to TortoiseSVN 1.8.7 maybe, because of the errors I am getting. I submitted a bug report to Apache SubVersion here, got a response, and responded back again, and you can look at the thread there to see what my problem was. Next I will probably have to submit a bug report to TortoiseSVN instead since it seems the bug is in TortoiseSVN and not Apache SubVersion.
Logged
The Liberal Crime Squad wiki is your friend.

Quote from: Lielac
Edit: Figured it out via a little bit of trial and error and oH MY GOD WHAT IS THIS MUSIC WHAT IS THIS MUSIC WHAT THE HECK IS IT SPACEBALLS MUSIC? WHATEVER IT IS IT IS MAGICAL