Compiling

From PioneerWiki
Jump to: navigation, search

Compiling Pioneer on Linux

Requirements

  • libtool
  • sigc++-2.0
  • freetype2
  • GL and GLU
  • GLEW
  • SDL 1.2
  • SDL_image

Since pioneer is currently only available from the source repository, you also need autoconf and automake in order to generate the ./configure script (by running ./bootstrap)

You also need git to check the source code out from the repository.

Ubuntu 10.04 command to install all the requisite libraries

sudo apt-get install libsigc++-2.0-dev libglut3-dev libglew1.5-dev libsdl1.2-dev libvorbis-dev libsdl-image1.2-dev dh-autoreconf git libfreetype6-dev

This may work on other versions of Ubuntu, and possibly Debian or their derivatives too.

Downloading it

Pioneer is managed using Git, and is stored over at Github. The official repository is the best one to get. To get it:

git clone git://github.com/pioneerspacesim/pioneer.git

This will get you on the "master" branch, which is where new code is merged. This is the latest and greatest development and is quite unstable. To build a specific alpha, you need to checkout the appropriate release tag:

git checkout alpha9

Building it

./bootstrap
./configure
make
ln -s ../data ./src/data

Currently Pioneer runs from where it is built, and doesn't require (or work with) make install. To run it:

./src/pioneer

Debugging

For developers, gdb can be used for debugging

gdb ./src/pioneer
run


Bugs, and feature requests, should be logged on the issue tracker.


Compiling Pioneer on Windows

Pioneer can be built with CMake from directly within Visual Studio 2019.

First, install the 'C++ CMake tools for Windows' package (Tools->Get Tools and Features and search for 'cmake' under individual components). Then open Visual Studio 2019, select 'Open a local folder' and open the pioneer folder that contains the source directory (if you cloned from git, this will be the top level 'pioneer' folder). After it opens it will generate the cmake build configuration. This may take a few minutes the first time. When that is complete, select the appropriate build type from the build configuration drop down on the top tool bar (ie. x64-Release) and build the project (Build->Build All). When the build is complete you can run 'pioneer.exe' from the source directory or by selecting pioneer.exe in the dropdown menu next to the build configuration and clicking run.

As an alternative, the MSVC 2019 solution file can still be found in the win32/vc2019 folder. Open this file and Pioneer should build just fine. All dependencies are provided so you don't need to compile any libraries. Copy the .dll files from win32/vc2019 into the root folder (the one containing data, src, win32 directories), and you will be able to run the pioneer .exe file you just compiled.

If the child projects will not open with the error 'Error HRESULT E_FAIL has been returned from a call to a COM component', disable 'Automatically show data connections from web.conf': Tools -> Options -> Projects and Solutions -> Web Projects

Cross-compiling Pioneer for Windows on Linux

If you want to run Pioneer on Windows but compile it on Linux, this can be done with mingw-cross-env; but note, these instructions do assume some familiarity with developing software on Unix systems. They will probably be useful as a starting point on Unixen other than Linux. You'll need a couple of gigabytes of disc space for everything to live in.

Preparing to install mingw-cross-env

First, check the requirements page to ensure you have all the necessary development packages installed on your Linux system. For many Linux distributions, the package names are listed explicitly. Install any that are missing.

Downloading mingw-cross-env

You might try either the latest release of mingw-cross-env or the current development version. The former is more likely to be stable, but does have problems with the locations of the packages it downloads being changed since it was released. I recommend you try the current development version first. As detailed at that link, you can retrieve the current development version by doing:

hg clone http://hg.savannah.nongnu.org/hgweb/mingw-cross-env

This makes a directory 'mingw-cross-env' and puts everything in that directory. Alternatively, if you downloaded the latest release, do:

tar -xvzf mingw-cross-env-2.2.1.tar.gz

(replacing "2.2.1" with the number of the release you actually downloaded).

Compiling mingw-cross-env

Either way, 'cd' into the directory just created and do:

make gcc glew tiff libpng jpeg zlib libsigc++ vorbis freetype sdl sdl_image

This will take quite a long time, unless you have a very fast computer. In particular, building gcc takes the lion's share of the time; if you have an older machine, it could easily take an hour or two. Do not be alarmed.

In the future, if these instructions are out of date, it is likely that Pioneer will have additional requirements. The subdirectory 'src' of the mingw-cross-env distribution has a number of files with names of the form 'foo.mk', each of which corresponds to an available package "foo" (a "package" here is typically either a library or a development tool), and the names of additional package files could be appended to the 'make' command. Alternatively you could do:

make

to make every mingw package, but this will obviously take much longer than building only the packages required.

The mingw-cross-env pages contain some discussion of how to install these tools as root for the use of all users on a system, but that is beyond the scope of this page.

Things that might go wrong

Various things in your environment can mess up this compilation process. For example, if you have environment variables set which force 'ls' always to produce colour output, the configure scripts will choke. Normally, the package being built has created a directory called 'tmp.packagename'; 'cd' into that directory and run 'make'. That will show you the output from 'configure', and ordinarily a file 'config.log' is created (perhaps in a subdirectory of that directory) which shows exactly which configure test failed and how.

Downloading Pioneer

'cd' out of the mingw-cross-env directories, and do:

git clone git://github.com/pioneerspacesim/pioneer.git

(See the discussion above pertaining to which version you are downloading.) 'cd' into the directory just created.

Compiling Pioneer

You want to set your PATH to include the mingw-cross-env tools you just compiled; if you had unpacked mingw-cross-env directly in your home directory, you would do:

export PATH=~/mingw-cross-env/usr/bin:$PATH

Now in the Pioneer directory do:

./bootstrap
./configure --host=i686-pc-mingw32
make

That will eventually build 'pioneer.exe' and 'modelviewer.exe'.

Things that might go wrong

You might think the libraries in the 'win32' directory of the Pioneer distribution are relevant, and start adding flags to the 'configure' invocation to use them. Don't. You might be missing a mingw-cross-env package; check to see if the Pioneer requirements have changed.

Installing it on a Windows system

In the main Pioneer directory, do:

mv src/pioneer.exe src/modelviewer.exe .

Now you want to copy the contents of the main Pioneer directory along with the 'data' subdirectory, but not any other subdirectories (although copying them to the Windows system is harmless).