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

From FreeSpace Wiki
Jump to: navigation, search
m (Reflect source code hosting via Git)
 
(25 intermediate revisions by 8 users not shown)
Line 1: Line 1:
== Introduction ==
+
{{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.}}
{{Warning|This tutorial assumes some fundamental command line knowledge.<BR>
 
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>
 
<p></p>
{{Note| This article deals primarily with acquiring the source code and rolling your own binary executable. If you don't want to roll your own, download the [http://fs2source.warpcore.org/exes/linux/fs2_open-3.6.9.run Linux Binary Installer].}}
+
*[[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]]
  
Also, Turey wrote a [http://www.hard-light.net/forums/index.php/topic,42854.0.html cross-platform installer (in Java)], which is able to download all you need for running fs2_open except the binary.
 
  
== Installation ==
+
----
=== Installing CVS ===
 
{{Note| If you don't want use CVS you can download a snapshot of the source code, version 3.6.9,  [http://fs2source.warpcore.org/exes/linux/fs2_open-3.6.9.tar.bz2 here].}}<p></p>
 
{{Note| This step is only for those who want the bleeding-edge source code to compile on their own. You can skip this if you intend to use a provided binary executable.}}
 
<p></p>
 
{{Note|<b>Redhat</b>, <b>Slackware</b> and all the other distributions should have their instructions on installing CVS added here, if your distribution is not listed below and you are familiar with how to install CVS on it, please add it to this section. }}
 
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.
 
Be aware that when you use CVS, you use the most up-to-date code : It may or may not be better than a release. It may be worse, less stable, or not even compile. This is work in progress.
 
 
 
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 -a cvs
 
 
 
'''Archlinux''' users want to:
 
$ pacman -Sy cvs
 
 
 
'''Fedora Core 6 (Zod)''' (And most likely Redhat) users want to:
 
# yum install cvs
 
 
 
'''Mandriva''' users want to:
 
# urpmi cvs
 
 
 
'''Novell SuSE''' users install CVS via [http://en.opensuse.org/YaST YaST].
 
 
 
=== Installing the necessary development libraries ===
 
{{Note| This step is only for those who want the bleeding-edge source code to compile on their own. You can skip this if you intend to use a provided binary executable.}}
 
<p></p>
 
{{Note|: <b>Redhat</b>, <b>Slackware</b>, <b>Archlinux</b>, <b>SuSE</b>, and all the other distributions should have their instructions on installing the needed libraries added here, if your distribution is not listed below and you are familiar with how to install the needed libraries on it, please add it to this section. }}
 
 
 
You will also need [http://www.libsdl.org/ SDL], [http://www.openal.org/ OpenAL], [http://vorbis.com/ libvorbis], [http://www.theora.org/ libtheora] and OpenGL(most likely provided with your video card driver) development packages. And of course the [http://gcc.gnu.org/ GNU Compiler Collection] and required [http://sourceware.org/autobook/ make] tools.
 
<br>
 
'''Debian/Ubuntu''' users want to:
 
{{Note| The [http://packages.debian.org/unstable/devel/build-essential build-essential] package is a meta package that install the essential build tools. Follow the link for information.}}
 
$ apt-get install libopenal-dev libvorbis-dev build-essential automake1.9 autoconf \
 
  libsdl-dev libtheora-dev
 
 
 
'''Fedora Core 6 (Zod)''' users (and most likely Redhat users too) want to:
 
# yum install openal-devel libvorbis-devel gcc gcc-c++ automake autoconf SDL-devel \
 
  libtheora-devel
 
 
 
'''Gentoo''' users want to:
 
{{Note| media-libs/openal needs the <b>"oss"</b> or <b>"alsa"</b> USE-flag, depending on what kernel sound system you use and media-libs/libsdl needs the <b>"X"</b>,<b>"opengl"</b> and <b>"xv"</b> USE-flags.}}
 
 
 
$ emerge -a openal libvorbis libsdl libtheora
 
 
 
'''Mandriva''' users want to:
 
# urpmi libsdl-devel libopenal-devel libvorbis-devel libtheora-devel gcc gcc-c++ \
 
  automake autoconf
 
 
 
=== Acquiring the Code ===
 
{{Note| This step is only for those who want the bleeding-edge source code to compile on their own. You can skip this if you intend to use a provided binary executable.}}
 
Before you begin, make sure you have write permissions on your current working directory. Your /home/user/ directory is a pretty 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>
 
 
 
==== Checkout Script ====
 
{{Note| This step is only for those who want the bleeding-edge source code to compile on their own. You can skip this if you intend to use a provided binary executable.}}
 
You can use this script to simplify your checkouts, don't forget to chmod +x it.
 
#!/bin/bash
 
CVS="cvs -d:pserver:anonymous:[email protected]:/home/fs2source/cvsroot"
 
MODULE="fs2_open"
 
BRANCH="${*}"
 
 
${CVS} co -d ${BRANCH} -r ${BRANCH} ${MODULE}
 
Run the script from a terminal and add the branch you wish to checkout,
 
./the_script fs2_open_3_6_9
 
or if you want the latest, and probably the most unstable,
 
./the_script HEAD
 
 
 
=== Pre-Compile Configuration ===
 
{{Note| This step is only for those who want the bleeding-edge source code to compile on their own. You can skip this if you intend to use a provided binary executable.}}
 
Before you compile you need to configure it for your system. In the directory you ran the CVS command from, a new directory has 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
 
 
 
==== Optimization ====
 
{{Warning| If you compile a debug build, don't use the <b>-fomit-frame-pointer</b> and <b>-fno-ident</b> compiler flags, as it will make debugging impossible.}}
 
<p></p>{{Note| This step is only for those who want the bleeding-edge source code to compile on their own. You can skip this if you intend to use a provided binary executable.}}
 
Optimizing fs2_open might have little or no effect, or improve performance greatly, I honestly have no clue.<br>
 
You can specify your compiler flags with the configure script, se below.
 
$ ./configure CFLAGS="<your desired flags>"
 
If you got a i686 and want to play it safe, a good set of CFLAGS would be
 
$ ./configure CFLAGS="-march=i686 -O3 -pipe -fomit-frame-pointer -fno-ident" \
 
  CXXFLAGS="$CFLAGS"
 
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-4.2.0/gcc/Optimize-Options.html<br>
 
http://gentoo-wiki.com/Safe_Cflags
 
 
 
=== Compiling ===
 
{{Note| This step is only for those who want the bleeding-edge source code to compile on their own. You can skip this if you intend to use a provided binary executable.}}
 
Run from within your fs2_open directory:
 
$ make
 
Sit back and enjoy gcc work its magic.<br>
 
You will find the binary executable in <i>code/</i> as either fs2_open_r if you built a release build or fs2_open_d if you built a debug build.
 
 
 
==== Compile Script ====
 
{{Note| This step is only for those who want the bleeding-edge source code to compile on their own. You can skip this if you intend to use a provided binary executable.}}
 
It's a lot 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>
 
#!/bin/bash
 
CFLAGS="-march=i686 -O2 -pipe"
 
CFLAGS="${CFLAGS} -fomit-frame-pointer -fno-ident"
 
CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden"
 
LDFLAGS="-Wl,-O1 -Wl,--sort-common"
 
 
if [ -e ./${*} ]; then
 
        cd ${*}
 
        if [ -e ./Makefile.in ]; then
 
                make clean
 
                ./configure CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}"
 
                make
 
                else
 
                ./autogen.sh CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}"
 
                make
 
        fi
 
fi
 
 
 
 
 
You can add your options to the ./configure line. You need to give the script the fs2_open source directory, like this:
 
$ ./compile-fs2_open fs2_open
 
This makes it easier to deal with multiple source directories.
 
 
 
=== Acquiring the Game Data  ===
 
 
 
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 (or use Turey's installer, see above for a link)
 
 
 
Note that if you use the retail CD, you'll need to extract the files and to copy them on your drive, reproducing the same layout as in a working win32 installation (just make sure every file is lowercase). This thread on the SCP forum has some more info on it : http://scp.indiegames.us/forum_viewtopic.php?3.282
 
 
 
There are two ways of doing this,
 
* Use [http://www.winehq.org/ Wine] to install the game in the right directory, using the Setup.exe found on the first CD, or,
 
* Extract the files manually from the CD.
 
 
 
The second method is detailed below. The wine one is straightforward and you shouldn't need any specific instruction as it behaves like a Windows install, but you'll have to fix permissions and lowercase the filename as well, so keep reading.
 
 
 
==== Extracting data from CD ====
 
===== Installing unshield =====
 
{{Note|<b>Redhat</b>, <b>Slackware</b> and all the other distributions should have their instructions on installing unshield added here, if your distribution is not listed below and you are familiar with how to install CVS on it, please add it to this section. }}
 
[http://synce.sourceforge.net/synce/unshield.php unshield] is a tool used to extract InstallShield Cabinet Files, this is the type of compression  format used on files on the FreeSpace 2 CDs.
 
 
 
'''Debian/Ubuntu''' users want to:
 
$ apt-get install unshield
 
 
 
'''Gentoo''' users want to:
 
$ emerge -a unshield
 
 
 
'''Archlinux''' users want to:
 
$ pacman -Sy unshield
 
 
 
'''Fedora Core 6 (Zod)''' (And most likely Redhat) users want to:
 
# yum install unshield
 
 
 
'''Mandriva''' users want to:
 
# urpmi unshield
 
 
 
'''Novell SuSE''' users install unshield via [http://en.opensuse.org/YaST YaST].
 
 
 
===== Data installation script =====
 
{{Warning| Again, please double check and understand the commands you run as root. A single typo could destroy your data. <b>Remember, with great power comes great responsibility.</b>}}
 
 
 
The following script will extract the necessary files to the TMPDIR and install them to the specified FS2DIR from the CDROM, prompting you for each disk. These values may need to be changed for your system. You may need to run this script as root and don't forget to chmod +x it.
 
#!/bin/sh
 
FS2DIR="$HOME/fs2/data"
 
TMPDIR="/tmp/fs2"
 
CDROM="/media/cdrom"
 
echo =========================
 
echo [ Freespace 2 Retail CD Installer ]
 
echo =========================
 
echo Please mount the first disk onto $CDROM
 
read
 
mkdir -p $FS2DIR/players $CDROM $TMPDIR
 
for group in "Basic Install Files" "Intel Anims" "Music Compressed" \
 
    "High Res Files" "Hud Config Files";
 
    do unshield -d $TMPDIR -g "$group" -L -j x $CDROM/data1.cab;
 
done;
 
mv -v $TMPDIR/*/*.vp $FS2DIR/
 
mv -v $TMPDIR/*/*.hcf $FS2DIR/players/
 
umount $CDROM
 
 
echo Please mount the second disk onto $CDROM
 
read
 
cp -v $CDROM/tango{1,A}_fs2.vp $FS2DIR
 
mv $FS2DIR/tango{A,a}_fs2.vp
 
umount $CDROM
 
 
echo Please mount the third disk onto $CDROM
 
read
 
cp -v $CDROM/tango{2,3,B}_fs2.vp $FS2DIR
 
mv $FS2DIR/tango{B,b}_fs2.vp
 
umount $CDROM
 
 
rm -vrf $TMPDIR
 
chmod -x $FS2DIR/tango*.vp
 
 
 
=== Post-Compile Configuration ===
 
====  Graphics Settings ====
 
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.
 
 
 
Open up ~/.fs2_open/fs2_open.ini with the text editor of your choice (vi, EMACS, kwrite, gedit).  You'll see something like the following:
 
[Default]
 
VideocardFs2open=OGL -(640x480)x16 bit
 
LastPlayer=MonkeyboyS
 
GammaD3D=1.0
 
 
 
To set fs2_open to use the highest setting possible on retail Freespace 2, change the VideocardFs2open to:
 
VideocardFs2open=OGL -(1024x768)x32 bit
 
You can set this to pretty much anything you want as long as it is 4:3, otherwise you will suffer rendering problems and HUD stretching.
 
 
 
=== StartUp Script ===
 
{{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. You can also find a more elaborated script example below in the i18n section. Also remember ''your'' specific paths throughout this article.}}
 
 
 
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/bash
 
cd /path/to/your/freespace/
 
./fs2_open_r -spec -glow -mipmap -jpgtga -orbradar -mod Media_VP
 
 
 
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.
 
 
 
Refer to the [[Command-Line_Reference]] article for more information regarding the command line options.
 
 
 
== Troubleshooting ==
 
=== Common Compile-time Errors ===
 
==== Novell SuSE and the dependencies ====
 
 
 
If your SuSE gives you some errors like this, during the compile process, your OpenAL version is too old or corrupted.
 
sound/ds.cpp: In function 'int ds_init(int, int, unsigned int, short unsigned int)':
 
sound/ds.cpp:1790: error: invalid conversion from 'const char*' to 'const ALubyte*'
 
sound/ds.cpp:1790: error:  initializing argument 1 of 'ALboolean
 
  alIsExtensionPresent(const ALubyte*)'
 
You have to remove all OpenAL-packages via YaST, you may also want to remove TORCS, too, it won't run anymore after this.
 
Unfortunately there is no repository with a newer version for this distro, yet, so you have to use a source-package for Fedora. You get it here http://download.fedora.redhat.com/pub/fedora/linux/extras/5/SRPMS/openal-0.0.9-0.6.20060204cvs.fc5.src.rpm
 
The version may change, so you better check this.
 
Now make sure, that TexInfo is installed. Then enter:
 
$ rpmbuild --rebuild --target=i686 <name-of-your-package>.fc5.src.rpm
 
If it builds without errors, you will find an OpenAL*.rpm and an OpenAL*-devel.rpm in <tt>/usr/src/packages/RPMS/i686/</tt>. Install both and go back to your fs_open directory again. Cause the environment has changed now, you better type:
 
$ make clean
 
$ ./configure [options]
 
$ make
 
Then you're done.
 
 
 
==== SDL: undefined reference to... ====
 
 
 
This is a SDL installing issue, since it's trying to link against the static lib and not the dynamic one.
 
First check where <tt>/usr/lib/libSDL.so</tt> is linked to, then search this very file.
 
$ ls -l /usr/lib/libSDL.so
 
lrwxrwxrwx  1 root root 28 2006-09-06 00:10 /usr/lib/libSDL.so ->
 
  /usr/lib/libSDL-1.2.so.0.7.1
 
$ ls /usr/lib/ | grep libSDL-1.2.so.0.7
 
libSDL-1.2.so.0.7.2
 
If they are not the same (like in this case), you just make a new link. Type as root:
 
# ln -s /usr/lib/libSDL-1.2.so.0.7.2 /usr/lib/libSDL.so
 
Of course you must change some figures, so it matches on your system.
 
 
 
==== Missing -lGLU compile error ====
 
 
 
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:
 
 
 
<b>Solution as Root</b>
 
 
 
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.
 
 
 
<b>Solution as User</b>
 
 
 
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 ====
 
{{Note| It's not clear if this is the solution to this problem. Please [[:{{NAMESPACE}} talk:{{PAGENAME}}|discuss]] it and correct it if you know more then mentioned here.}}
 
checking for glBindBufferARB in -lGL... no
 
configure: error: *** OpenGL version does not have the required features!!
 
  (ie.glBindBufferARB()) ***
 
This error appears if the installed Mesa development library is to old.
 
 
 
On Debian stable branch the xlibmesa-gl-dev package holds version 4.3.0. <br>
 
The xlibmesa-gl-dev package on ''testning'' is version 6.9.0.
 
 
 
'''Possible solution:'''<br>
 
First set /etc/apt/sources.list to include the testing branch. Add:
 
#Testing
 
deb http://ftp.us.debian.org/debian testing main non-free contrib
 
deb http://non-us.debian.org/debian-non-US testing/non-US main contrib non-free
 
Your sources.list might have these lines already, if so, you should be okej.
 
 
 
Your /etc/apt/preferences file should look like this
 
Package: *
 
Pin: release a=stable
 
Pin-Priority: 700
 
 
Package: *
 
Pin: release a=testing
 
Pin-Priority: 650
 
 
Package: *
 
Pin: release a=unstable
 
Pin-Priority: 600
 
 
 
Add to that file:
 
Package: xlibmesa-gl-dev
 
Pin: release a=testing
 
Pin-Priority: 800
 
Note that the Pin-Priority of xlibmesa-gl-dev here is higher than the Pin-Priority on 'stable'. As a result of this APT get will prioritize the xlibmesa-gl-dev from testing and leave the rest of the system on stable.
 
This is called apt-pinning.
 
 
 
Now that APT knows what xlibmesa-gl-dev to prioritze, install it again:
 
$ apt-get install xlibmesa-gl-dev
 
 
 
If you are using nVidia's nvidia-kernel and glx packages, a simple:
 
$ apt-get install nvidia-glx-dev
 
should suffice. No need to mess around with APT-pinning.
 
 
 
=== Common 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([http://www.hard-light.net/wiki/index.php/Fs2_open_on_Linux#Creating_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
 
 
 
==== I18n and Key mapping problems ====
 
Ok, imagine that like me you don't have an us keyboard but a french one (or anything). Well, you probably have problems mapping some keys or even using the default mapping.
 
 
 
Actually, the problem is fs2_open does not take modifiers into account, as it uses them internally as modifiers for keys, and it won't accept non-us charset either.
 
 
 
On a french keyboard layout, the numbers ''1 2 3 4 5 6 7 8 9 0'' are on the same keys than on a US layout, but you have to press shift to use them. The primary function for theses keys are ''& é " ' ( - è _ ç à )''. These characters won't be accepted by freespace, and if you press shift to get a number, it won't work. This can be a problem, as theses keys are needed to use the communication system, and cannot be bound to anything. Also, as you won't get access some keys on your keyboard, it will be difficult to map every command on a key, or you'll have to use modifiers for nearly each key.
 
 
 
However, there is a solution. You can tell X to remap the keyboard before launching the game, and restore your normal keymap afterwards.
 
 
 
For exemple, I map 123456790 to &é"'(-è_çà  keys so I can use the communication system, and I put , and ; on the Alt-Gr and Menu keys for convenience, as I binded thoses keys to next primary weapon and next secondary weapon.
 
 
 
To do this, I use a slightly enhanced startup script, which I put in ~/bin (this directory is in my path), together with a customized xmodmap.
 
 
 
* First, dump your current xmodmap :
 
 
 
  <tt>~ $ xmodmap -pke > ~/xmodmap.current</tt>
 
 
 
* Then edit it with your favorite text editor. You'll see a bunch of lines looking like this :
 
 
 
<tt>
 
keycode  8 =
 
keycode  9 = Escape
 
keycode  10 = 1 ampersand onesuperior exclamdown onesuperior exclamdown
 
</tt>
 
 
 
The syntax is ''keycode <number> = <symbol list>''.
 
 
 
Use '''xev''' to scan the keycodes. The symbols are defined in ''/usr/include/X11/keysymdef.h''. Just make sure you write them without the ''XK_'' prefix. You'll find more information about xmodmap in the xmodmap manual page.
 
 
 
Just modify the keys you need, and be patient. This can be a long process. Test it with xmodmap :
 
 
 
  <tt>~ $ xmodmap - < <filename></tt>
 
 
 
But don't forget to have your previous keymap at hand to recover your settings !
 
If you mess everything up, just restart X. Your default keymap will be applied from the X configuration.
 
 
 
Here is my own fs2 xmodmap, derived from fr-latin1 as described above. Feel free to use it if you're too lazy to modify your own. However, it may not fit with your needs. You may always use it as an exemple, thougt.
 
* http://clement.hermann.free.fr/fs2/xmodmap
 
 
 
Then, when the file is modified at your liking, just save it as '''~/.fs2_open/xmodmap'''
 
 
 
We'll start fs2_open with a slightly more elaborate startup script which will backup/apply/restore the keymap in addition of running the games with some options in the right directory.
 
 
 
<tt>
 
#!/bin/sh
 
# This script lauches fs2. If there is a file named $FS2_modmap (see below),
 
# backup the current modmap as $TMP_modmap and load it as the new modmap.
 
# The current modmap will be restored afterwards.
 
 
TMP_modmap="$HOME/xmodmap.tmp"
 
FS2_modmap="$HOME/.fs2_open/xmodmap"
 
 
FS2_OPEN_DIR=/usr/local/games/fs2_open
 
 
FS2_ARGS="-glow -spec -spec_exp 11 -spec_point 0.6 -spec_static 0.8 -spec_tube 0.4 \
 
  -fps -jpgtga -ambient_factor 75 -targetinfo -nograb"
 
 
FS2_BIN="$FS2_OPEN_DIR/fs2_open_r"
 
 
die() {
 
    echo "** Fatal error : $1" >&2
 
    exit 1
 
}
 
 
cd $FS2_OPEN_DIR || die "Could not change directory to $FS2_OPEN_DIR"
 
 
# dump current xmodmap
 
[ -f "$FS2_modmap" ] && xmodmap -pke > $TMP_modmap
 
 
# load xmodmap
 
[ -f "$FS2_modmap" ] && xmodmap - < $FS2_modmap
 
 
# prepare to restore xmodmap on crash or exit
 
trap "xmodmap - < $TMP_modmap && rm $TMP_modmap" 0 2 3 4 9 11 15
 
 
# launch fs2
 
$FS2_BIN $FS2_ARGS $* || die "Error while running \"$FS2_BIN\" with arguments \
 
  \"$FS2_ARGS\" ($?)"
 
</tt>
 
 
 
Adapt this script to your needs, and save it somewhere in your PATH - I for exemple use ''~/bin/freespace2''. Make it executable with chmod +x ''<file>''
 
  
That's it, now you can use fs2 with full control over your keyboard.
 
  
==== fs2_open dedicated X display ====
+
*[[Fs2_open_on_Linux/Compiling_PCS2|Compiling PCS2]]
A good way of running games on Linux is having them run on a separate X display. The display you are most likely using now when reading this is 0:0. This display is normally used for whatever Window Manager/Desktop Environment(KDE,Gnome,*box,E) you've chosen. Sometimes fs2_open freezes and locks your X. This is of course very annoying as you have to CTRL+ALT+BACKSPACE to kill the X server, and in that, killing whatever program you had running besides fs2_open. The solution to this is to tell X to start fs2_open on another display. To to this we first need to tell X that you,the user on localhost, holds the permission to run on another display.
 
In a terminal, enter (NOT as root):
 
$ xauth list
 
A list that looks something like this should appear.
 
myuser@localhost ~ $ xauth list
 
localhost/unix:'''0'''  MIT-MAGIC-COOKIE-1  14ec70e7c8cc835def61a04c92bbd50d
 
Let's look at that line, first up is your localhost, then unix, and last the display number,:0 (in bold). The rest is not really of interest.
 
Copy the whole line, but change the display value to 1 and paste it after the command ''xauth add'', like this:
 
$ xauth add localhost/unix:'''1'''  MIT-MAGIC-COOKIE-1  14ec70e7c8cc835def61a04c92bbd50d
 
Run xauth list again. You should see a new entry.
 
myuser@localhost ~ $ xauth list
 
localhost/unix:'''0'''  MIT-MAGIC-COOKIE-1  14ec70e7c8cc835def61a04c92bbd50d
 
localhost/unix:'''1'''  MIT-MAGIC-COOKIE-1  14ec70e7c8cc835def61a04c92bbd50d
 
You now have permission to use display 1:0.
 
To start fs2_open in that display, use xinit.
 
$ xinit /path/to/fs2_open_r -foo -bar -- :1
 
The ''-- :1'' tells X that we want to start fs2_open on display 1.<br>
 
You can switch between display 0 and 1 with CTRL+ALT+F7 and CTRL+ALT+F8 respectively.<br>
 
If you try this from an virtual terminal from within X11 and obtain the error:
 
X: user not authorized to run the X server, aborting.
 
It has been reported that on Ubuntu systems, the file /etc/X11/Xwrapper.config contains this line:
 
allowed_users=console
 
This setting specifies that the X server(s) can only be started from console(TTY).
 
{{Warning| This solution will undermine X security.}}
 
A possible solution is to change the allowed_users in the Xwrapper.config file to:
 
allowed_users=anybody
 
See man Xwrapper.config for more details.
 
[[Category:Source Code Project]]
 
  
=== Joystick Errors ===
+
[[Category:FreeSpace Open on Linux]]
If your joystick seems to be in need of calibration, use the ''jscal'' utility, or some other utility that calibrates to a 16-bit scale.  The ''jscalibration'' utility calibrates to a non-standard 8-bit scale and you won't be able to do much other than shoot straight ahead.
 

Latest revision as of 04:34, 3 May 2015