Difference between revisions of "Guide to FS Open on Linux"

From FreeSpace Wiki
Jump to: navigation, search
m (glBindBufferARB feature missing: Cleanup)
m (Reflect source code hosting via Git)
 
(253 intermediate revisions by 20 users not shown)
Line 1: Line 1:
This HOWTO was written by ni1s to help Freespace fans get the latest bleeding-edge version of fs2_open from CVS, and also includes an introduction to configuring and running fs2_open provided by Spectre-7.
+
{{Warning|This guide assumes some fundamental command line knowledge. As a rule of thumb, <b>do not copy & paste commands without fully understanding them</b>, especially as root. With great power comes great responsibility.}}
 +
<p></p>
 +
*[[Fs2_open_on_Linux/Introduction|Introduction]]
 +
*[[Fs2_open_on_Linux/Quickstart|Quickstart]]
 +
*[[Fs2_open_on_Linux/Preparation|Preparation]]
 +
**[[Fs2_open_on_Linux/Installing Git|Installing Git]]
 +
**[[Fs2_open_on_Linux/Installing the Development Libraries|Installing the Development Libraries]]
 +
*[[Fs2_open_on_Linux/Acquiring the Code|Acquiring the Code]]
 +
*[[Fs2_open_on_Linux/Pre-Compile Configuration|Pre-Compile Configuration]]
 +
**[[Fs2_open_on_Linux/Optimization|Optimization]]
 +
*[[Fs2_open_on_Linux/Compiling|Compiling]]
 +
**[[Fs2_open_on_Linux/Compile Script|Compile Script]]
 +
*[[Fs2_open_on_Linux/Acquiring the Game Data|Acquiring the Game Data]]
 +
**[[Fs2_open_on_Linux/Extracting data from CD|Extracting data from CD]]
 +
***[[Fs2_open_on_Linux/Installing unshield|Installing unshield]]
 +
****[[Fs2_open_on_Linux/Data Installation script|Data Installation script]]
 +
*[[Fs2_open_on_Linux/Post-Compile Configuration|Post-Compile Configuration]]
 +
**[[Fs2_open_on_Linux/Graphics Settings|Graphics Settings]]
 +
**[[Fs2_open_on_Linux/StartUp Script|StartUp Script]]
 +
*[[Fs2_open_on_Linux/Troubleshooting|Troubleshooting]]
 +
**[[Fs2_open_on_Linux/Common Compile-time Errors|Common Compile-time Errors]]
 +
***[[Fs2_open_on_Linux/Novell SuSE and the Dependencies|Novell SuSE and the Dependencies]]
 +
***[[Fs2_open_on_Linux/SDL: undefined reference to ...|SDL: undefined reference to ...]]
 +
***[[Fs2_open_on_Linux/Missing -lGLU compile error|Missing -lGLU compile error]]
 +
**[[Fs2_open_on_Linux/Common Runtime Errors|Common Runtime Errors]]
 +
***[[Fs2_open_on_Linux/ERROR: "Web cursor bitmap not found."|ERROR: "Web cursor bitmap not found."]]
 +
***[[Fs2_open_on_Linux/I18n and Key mapping problems|I18n and Key mapping problems]]
 +
***[[Fs2_open_on_Linux/Dedicated X Display|Dedicated X Display]]
 +
***[[Fs2_open_on_Linux/Joystick Errors|Joystick Errors]]
 +
***[[Mouse jumping to bottom right corner]]
 +
***[[Fullscreen issue with multiple monitors]]
  
''Note:  This tutorial assumes some fundamental command line knowledge.''
 
  
== Installing CVS ==
+
----
CVS stands for Concurrent Versions System and is a version control system used to record the changes in documents, such as source files. Developers use CVS so they can easily share their code changes among other developers. You will need this tool to download ("checkout" in CVS terminology) fs2_open from the CVS server.
 
  
'''Debian/Ubuntu''' users want to:
 
apt-get install cvs
 
'''Gentoo''' users want to:
 
emerge cvs
 
  
'''NOTE: Redhat, Mandrake/Mandriva, Slackware and all the other distros should go here too,'''
+
*[[Fs2_open_on_Linux/Compiling_PCS2|Compiling PCS2]]
'''but we have no knowledge on how these work, so if you do, please enlighten us.'''
 
  
== Installing the nessesary development libraries ==
+
[[Category:FreeSpace Open on Linux]]
You will also need SDL, OpenAL, libvorbis and OpenGL(most likely provided with your video card driver) development packages. And of course the GCC compiler and required make tools.
 
<br>
 
'''Debian/Ubuntu''' users want to:
 
apt-get install libopenal-dev libvorbis-dev build-essential automake1.9 autoconf libsdl-dev
 
'''NOTE:''' The ''build-essential'' meta package installs GCC4. This should work, but if you feel safer with GCC 3.4(gcc-3.4), add it to the apt-get line above.<br>
 
'''Gentoo''' users want to:
 
emerge openal libvorbis libsdl
 
'''NOTE: Radhat, Mandrake,Slackware and all the other distros should go here too,'''
 
'''but we have no knowlage on how these work, so if you do, please enlighten us.'''
 
 
 
== Installing game data files ==
 
''This is all very icky on Linux. Someone should really look in to this.''<br>
 
This tutorial deals primarily with providing you with an executable, but in order to play the game you also need the game data.  Freespace 2 game data is available from a number of sources, see this thread: http://www.hard-light.net/forums/index.php/topic,38195.0.html
 
 
 
== Using the source ==
 
 
 
=== CVS Checkout ===
 
Before you begin, make sure you are situated in a a directory where you have write permissions. Your /home/user/ directory is pretty much a sure bet. I recommend that you create a permanent /home/user/src directory from which you run the CVS command, this way CVS will only update the files changed the next time you download the source and it's always nice to have things organized.
 
 
 
Now get the source. Run from a terminal:
 
cvs -d:pserver:anonymous:[email protected]:/home/fs2source/cvsroot login
 
and then
 
cvs -z3 -d:pserver:[email protected]:/home/fs2source/cvsroot co fs2_open
 
The first cvs command tells the CVS tool to first use a password file for authentication (pserver), that you are user "anonymous" with the password "anonymous" who wants to access warpcore.org's CVS repository "/home/fs2source/cvsroot" and login. The second command tells the CVS server on which we are now connected to that we want to checkout (co) the fs2_open module.
 
<br>
 
==== CVS Checkout and Update Script ====
 
The code on CVS is in a constant state of change, and bugs that exist one day may be gone the next.  Because of this, you'll want to occasionally update to a newer version and recompile. 
 
Running those cvs commands will fast grow to be a pain, so this little script was created to make your life easier. This script will checkout fs2_open if it can't find a fs2_open directory and update fs2_open, if it finds it.
 
The script will run until a successfull checkout or update has been achieved.
 
Copy and save this to a suitably named file like "get_fs2_open", and make it executable with the command, chmod +x <name of file>
 
#!/bin/bash
 
# CVS Checkout and Update Script for fs2_open
 
CVS_LINE="cvs -d:pserver:anonymous:[email protected]:/home/fs2source/cvsroot" # The cvs command
 
if [ "$UID" = 0 ]; then # check if user is root, and if so, echo a warning.
 
echo "You are root. If this is a checkout, all files \
 
will be created with root as the owner."
 
sleep 3
 
fi 
 
if [ -e ./fs2_open ]; then # check if directory fs2_open exists
 
echo "Found fs2_open, We are updating an old checkout."
 
CVS_ATTEMPT=0 # This updates the checkout.
 
until [ $CVS_ATTEMPT = 1 ]; do
 
$CVS_LINE login && \
 
$CVS_LINE update fs2_open && \
 
let CVS_ATTEMPT=1
 
done
 
else
 
echo "No fs2_open found, This is a new checkout."
 
CVS_ATTEMPT=0 # This creates a new checkout.
 
until [  $CVS_ATTEMPT = 1 ]; do
 
$CVS_LINE login && \
 
$CVS_LINE co fs2_open && \
 
let CVS_ATTEMPT=1
 
done
 
fi
 
 
 
=== Pre-Compile Configuration ===
 
 
 
Before you compile you need to configure it for your system. Run from
 
In the directory you ran the CVS command from, a new directory will appear, namely fs2_open.
 
If your fs2_open is a completely new checkout, you will first need to run the autogen.sh script.
 
Run from inside your newly created fs2_open directory:
 
./autogen.sh
 
autogen.sh is a script that will generate the required makefiles. You will see alot of "checking for this" and "checking for that", this is actually the "configure" script (which can be run with <tt>./configure</tt> if you need to change the options) examining and configuring fs2_open for your system.<br>
 
It is possible to give autogen.sh configure options as well, autogen.sh will pass them along to configure.
 
 
 
A full list of configure options can be found by running the configure script with the '--help' option.
 
./configure --help
 
 
 
==== Optimizing fs2_open ====
 
Optimizing fs2_open might have little or no effect, or improve performance greatly, I honestly have no clue.<br>
 
A note of caution, if you are compiling a debug build, don't use the -fomit-frame-pointer CFLAG, it will make debugging impossible.<br>
 
You can specify your compiler flags with the configure script, se below.
 
./configure CFLAGS="<your desired flags>"
 
If you got a Athlon-XP and want to play it safe, a good set of CFLAGS would be
 
./configure CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer"
 
You should read up on CFLAGS and what they do before trying anything. I recommend you read through these links.<br>
 
http://gcc.gnu.org/onlinedocs/gcc-3.4.1/gcc/Optimize-Options.html<br>
 
http://linuxreviews.org/howtos/compiling/safe-cflags/<br>
 
http://en.wikipedia.org/wiki/CFLAGS
 
 
 
=== Compiling ===
 
 
 
Run from within your fs2_open directory:
 
make
 
Sit back and enjoy gcc work its magic.
 
 
 
==== Simple Compile Script ====
 
It's alot easier to use a scripts when dealing with constantly changing code. Copy and save this to a suitably named file like "compile_fs2_open", and make it executable with the command, chmod +x <name of file>
 
This script assumes the CVS checkout directory fs2_open is pressent in the same directory as the script itself.
 
#!/bin/bash
 
# fs2_open Compile Script
 
# These are only examples, uncomment to enable optimization.
 
#MY_CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer -ftracer"
 
if [ -e ./fs2_open/ ]; then
 
cd fs2_open
 
if [ -e ./Makefile.in ]; then
 
make clean
 
./configure CFLAGS="$MY_CFLAGS" CXXFLAGS="$MY_CFLAGS"
 
make
 
else
 
./autogen.sh CFLAGS="$MY_CFLAGS" CXXFLAGS="$MY_CFLAGS"
 
make
 
fi
 
else
 
echo "No fs2_open directory found."
 
fi
 
 
 
You can add your options to the ./configure line.
 
 
 
== Using the Binaries ==
 
 
 
When the compile is done and if all went well, a binary executable will reside in the code directory ''fs2_open_r'' or ''fs2_open_d'' if you configured for a debug build. Copy the binary to directory where Freespace2 is installed, and you're all set to go.
 
 
 
=== Post-Compile Configuration ===
 
====  Changing Your Resolution ====
 
 
 
Odds are, you'll want to run fs2_open in a higher resolution than the default 640x480.  Unfortunately, we Linux users don't have the swank launcher app that the Windows folks do.  Instead, we'll be making a couple line changes to a config file.  You will need to run fs2_open once before you can make the necessary changes, otherwise you won't have a configuration directory to work with.
 
 
 
The first thing we need to do is get into the fs2_open config directory, which is a hidden folder in your home directory.  The fastest way to get there is to type the following in a console:
 
cd ~/.fs2_open
 
 
 
From here, open up fs2_open.ini in your text editor of choice (vi, EMACS, joe, pico, etc).  You'll see something like the following:
 
[Default]
 
VideocardFs2open=OGL -(640x480)x16 bit
 
LastPlayer=MonkeyboyS
 
GammaD3D=1.0
 
 
 
Then change the Videocard line to the following:
 
VideocardFs2open=OGL -(1024x768)x32 bit
 
 
 
Save the file, and run fs2_open as you normally would.  Voila!  You're now in 1024x768 at 32bit color.  Congratulations!
 
 
 
=== Creating a Start Up Script ===
 
 
 
In order to use all of the advanced engine features of fs2_open, you'll need to start the executable with a number of command line arguments.  Instead of typing them in every time you want to start the game, why not create a script that does it for you?
 
 
 
Create a new file named start_freespace (or whatever you like) in your home directory. Open the file in your editor of choice, and paste the following:
 
#!/bin/sh
 
cd /path/to/your/freespace/
 
fs2_open_r -spec -glow -mipmap -jpgtga -orbradar -mod Media_VP
 
 
 
''Note:  You will need to edit this script before it will work properly.  The second line must point to the directory where you installed fs2_open.''
 
 
 
The last line starts fs2_open with a number of arguments that turn on extra features.  In the example, the game will use specular highlights, glow-mapping, mipmapping, jpg and tga graphic files, the orb radar, and any MediaVPs installed to the /Media_VP directory.  You should edit this line to use those features that your system supports.
 
 
 
More information about the available Command Line Arguments can be found at the [[Command-Line Reference]]
 
 
 
Once you've edited the file to your heart's content, make it executable:
 
chmod +x start_freespace
 
 
 
You can now type in start_freespace to start the game, or by clicking on start_freespace in your window manager.  For convenience, you can copy it to your Desktop.
 
 
 
== Troubleshooting ==
 
=== Compile Errors ===
 
==== OpenGL Compile Errors ====
 
 
 
On some Linux distributions (''Slackware'' for instance), compiling fails because a GL related library doesn't have a link in the <tt>/usr/lib</tt> directory.  If the compile fails because it can't find <tt>-lGLU</tt>, here are two ways to fix it:
 
 
 
===== Solution as Root =====
 
 
 
If you have root access to the system, you can create a link to the library in question with just a little bit of command line magic.  Go to a console and enter:
 
 
 
ln -s /usr/X11R6/lib/libGLU.so /usr/lib/libGLU.so
 
 
 
After that, you can run make again and it should finish compiling.
 
 
 
===== Solution as a Non-Root user =====
 
 
 
You don't have root access?  Never fear, we can still fix the problem.  It'll just be a tad more difficult.
 
 
 
Navigate to the <tt>fs2_open/code</tt> directory and locate a file named <tt>Makefile</tt> (not Makefile.rm or Makefile.in or Makefile.anything).  Open it in your favorite text editor and make the following changes.
 
 
 
Find this line (line 457 in mine):
 
FS2_LDFLAGS =  -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread -lGL -lGLU -lopenal -logg -lvorbis -lvorbisfile
 
 
 
And replace it with this:
 
FS2_LDFLAGS =  -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread -lGL -lopenal -logg -lvorbis -lvorbisfile -L/usr/X11R6/lib -lGLU
 
 
 
 
 
Also find this one (line 565 in mine):
 
AM_LDFLAGS =  -g  -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread -lGL -lGLU -lopenal -logg -lvorbis -lvorbisfile
 
 
 
And replace it with this:
 
AM_LDFLAGS =  -g -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread -lGL -lopenal -logg -lvorbis -lvorbisfile -L/usr/X11R6/lib -lGLU
 
 
 
Then run <tt>make</tt> from the <tt>fs2_open</tt> directory, and watch the magic happen.
 
 
 
==== glBindBufferARB feature missing ====
 
<i>This is not tested.</i><br>
 
Debian users may get this error when running configure.
 
checking for glBindBufferARB in -lGL... no
 
configure: error: *** OpenGL version does not have the required features!! (ie.glBindBufferARB()) ***
 
This happens when the Mesa3d library is to old (>5.0.2). From http://packages.debian.org/cgi-bin/search_packages.pl?searchon=names&version=all&exact=1&keywords=libglu1-mesa-dev
 
<br>Package libglu1-mesa-dev
 
* <b>stable (libdevel): The OpenGL utility library development environment
 
5.0.0-5.1: alpha amd64 arm hppa i386 ia64 mips mipsel powerpc s390 sparc</b>
 
* testing (libdevel): The OpenGL utility library -- development support files
 
6.4.1-0.3: alpha amd64 arm hppa i386 ia64 mips mipsel powerpc s390 sparc
 
* unstable (libdevel): The OpenGL utility library -- development support files
 
6.4.1-0.4: alpha amd64 arm hppa i386 ia64 mips mipsel powerpc s390 sparc
 
6.3.2-2.1: kfreebsd-i386
 
<br> As you see, the libglu1-mesa-dev on <b>stable</b> is to old. Change your apt-get settings to use packages from the unstable repository, and run:
 
apt-get install libglu1-mesa-dev
 
 
 
=== Runtime Errors ===
 
==== ERROR: "Web cursor bitmap not found." ====
 
ERROR: "Web cursor bitmap not found.  This usually means that the executable is being run outside the  directory
 
you installed Freespace2 to.  Please move the executable to that directory and try again" at  graphics/2d.cpp:1402
 
A common error. This happens when fs2_open can't find the .vp files or that your user doesn't have the permissions to access them. If you are using a start up script(like the one found here) it's most likly the a permission problem.
 
Have your user take owenership of the .vp files, run as root:
 
chown <user> /path/to/vpfiles/ -R
 

Latest revision as of 04:34, 3 May 2015