Imprudence:Compiling

Our modest attempt at a tutorial for compiling the Imprudence code. Please correct any errors or missing information.

Version 1.3 (and below)

 * Compiling Imprudence 1.3 and below on Windows.

Version 1.4 (and above)

 * Compiling Imprudence 1.4 and above on Windows.

Linux

 * CMake version 2.4.8 or 2.6.2. Versions between don't work, versions newer than  2.6.2 are untested by us — let us know if they work/fail. Debian's cmake 2.8.2-2 seems to work well, at least.
 * Python 2.5 or greater
 * The standard stuff: make, tar, etc.
 * GCC 4.3 or (since 1.4.0) GCC 4.4; the according g++ ( install the "build-essential" package on debianesque distros)
 * bison, flex
 * freeglut3 development packages ( freeglut3-dev on debianesque distros)
 * (linux 64 bit) openssl and libcrypto development packages
 * libxrender-dev (and its dependencies?)
 * libxinerama-dev (and its dependencies?)
 * < add the missing dependency ran into above >

MacOS X

 * Mac OS X 10.4 or greater
 * Xcode 2.4 if you have Mac OS X 10.4, or Xcode 3.0 or greater if you have Mac OS X 10.5+. Free to download (though a rather large download), you just need sign up for a free ADC membership. Or if you have your Mac OS X installer disc lying around somewhere, that should have a copy of Xcode on it.
 * CMake 2.4.8 or greater
 * Python 2.5 or greater. (Mac OS X 10.5+ comes with an adequate version preinstalled.)


 * Mac OS X 10.7 Lion requires XCode 4.1 or greater, which installs git but not cmake. Get cmake by installing Homebrew.

Git
Only necessary if you're interested in using the latest source or contributing. See the git primer page for installation instructions.

Download Source
Imprudence source code is available online:
 * For specific versions, check the Downloads page
 * For the latest source, check the official git repository (if you know how to use Git).

Download Artwork & Libraries

 * The Downloads page contains artwork and libs for specific versions, as well as for the latest source. If no artwork or library package is listed, none is needed for that version.
 * Note: artwork is no longer needed period for versions 1.3 and higher.

Unpacking
The source, artwork, and libs packages all have a "linden" folder inside them. The contents of those should be combined together into one "linden" folder. How you do that depends on your operating system.


 * Linux: Unpack all the packages from within a single directory, or use the command:  (where artwork, libs, and source are the directories where you unpacked those packages.)
 * Mac: Open a Terminal and use the command:  (where artwork, libs, and source are the directories where you unpacked those packages.)

Generate Project Files
Once the source, artwork, and libs are unpacked, the next step is to run the command to generate the project files. This will also automatically do a few things:


 * 1) Automatically download a bunch of software libraries and unpack them in the linden/libraries/ folder to be used later when compiling. This will take a while, depending on the speed of your internet connection, but the good news is it only has to download once, not every time you compile.
 * 2) Create project files to use for compiling with XCode (on Mac, or Make (on Linux). CMake creates a separate directory for compiling and storing the project files. The exact directory name depends on your operating system and/or processor type (e.g. Intel vs PPC)).

Linux & Mac
Open up a terminal (on Mac, that's Applications > Utilities > Terminal, I believe), change directory (or "cd") to the  directory and run the "develop.py" program. This example assumes you put the linden directory inside the directory :

cd "/Users/MyName/Imprudence/linden/indra/" python develop.py

(Note: don't use the --standalone flag.)

Project files are generated in:


 * Linux:  (e.g.  )
 * Mac:  (e.g.  )

''Tip: to compile with LLVM on Mac use the command  and select "LLVM compiler 1.0.2" in your Build settings. Please note this has not been tested on Linux and we may not be able to help you with build problems.''

Compiling
Now for the actual compiling! The instructions here are different for each operating system, because of the different software they use.

Note: Compiling the first time can often take a few hours, so you should start it running and then take a nap, read a book, or whatever you please. You may want to check in from time to time to make sure it hasn't had an error.

Linux
Note (08-10-2010): The experimental version (or the 'weekly' from github) compiles ok with g++-4.4, so this is no longer needed.

Imprudence 1.4.0
Versions of end of October '10 and newer should compile cleanly using GCC 4.4

Imprudence 1.3.x
''Note: these instructions are currently untried. Please edit this section with more information if you encounter this issue''.

GCC 4.4 isn't compatible with the version of boost in Imprudence (see http://svn.boost.org/trac/boost/ticket/2069). The solution is to install GCC 4.3 and to run 'export CXX=/usr/bin/g++-4.3' or whatever your binary is before trying to compile. Another workaround is to use update-alternatives; for example, if you already have 4.4 installed, try this:

sudo apt-get install g++-4.3 sudo update-alternatives --remove-all gcc sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.3 43 --slave /usr/bin/g++ g++ /usr/bin/g++-4.3  --slave /usr/bin/gcov gcov /usr/bin/gcov-4.3 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 44 --slave /usr/bin/g++ g++ /usr/bin/g++-4.4  --slave /usr/bin/gcov gcov /usr/bin/gcov-4.4

then choose 4.3:

sudo update-alternatives --config gcc

develop.py
From the  directory, run:

python develop.py build

This will go through and compile everything. The final product goes into. There will also be a  file in newview containing the same contents as the   directory.

For 64bit Linux compiling issues, read compiling 64bit issues.

Mac
''Note 1: using GCC on Mac you need to set XCode to use GCC 4. For some reason, on OSX it won't compile with GCC 4.2.''

''Note 2: when building on Snowleopard (Mac OS X 10.6) Imprudence will -NOT- build with the 10.6 SDK. You must select either the 10.4 or 10.5 SDK for it to build.''

''Note 3: on Intel Macs you must select i386 when building. Most of the Imprudence libraries are compiled in 32bit i386 and will not link to make a 64bit x86_64 build.''

''Note 4: when using LLVM do -NOT- use "Link-Time Optimization" at this time. It causes the finished build to silently crash on start up.

''Tip 1: if you want to improve performance here's some things you can do. Change the profile from RelWithDebInfo to Release then under the "Build" tab in the Project info window checkmark the "Auto-vectorization," "Enable SSE3 Extensions," and "Unroll Loops." Also change "Instruction Scheduling" to "None" and change the "Optimization Level" to "Fastest (-O3)." Double click on "Other C Flags" and click the +. Enter (without quotes) "-mfpmath=sse". If you do not intend to share your builds with others you can also add the "-mtune=native" flag to the "Other C Flags" list.''

''Tip 2: if you have a newer Mac you may be able to use Supplemental SSE3 (SSSE3) or SSE4 (SSE4.1 and SSE4.2). To find out if your Mac supports SSSE3 or better download CPU-X. note: SSE4 is only available in GCC 4.2 and LLVM''

Open up the  directory. Inside will be an "Imprudence.xcodeproj" file. Load that up in Xcode. Next, click the Info button and change the architecture to Universal 32-bit. (If that's not an option for your version of Xcode, make sure its set to i386) Now click the Run button, and it should start compiling!

The final product goes into  unless you chose the Release profile then you can find it in. Please edit this article if I'm mistaken.

Generating The ChangeLog
The ChangeLog project needs git installed to run. If you don't have git already installed and added to your system PATH, see here for installing it, then add   (or whatever the path is to your git application) to your compiler's executable list.

CMake error: JPEG_LIBRARIES on OSX
Affects 1.3 RC2 and below. For the fix, apply this commit.

Error PRJ0019 when building
See this thread for an explanation and workaround.

Error: the command 'cmake' was not found
Reinstall CMake and add it to your system PATH.

BISON-NOTFOUND or FLEX-NOTFOUND
Also the cause of  when linking imprudence-bin.

You didn't install bison or flex when you installed cygwin. Install them, then delete \linden\indra\build-vc80\lscript\lscript_compile\lscript_compile.vcproj and run develop.py again. lscript_compile should now build.

"RuntimeError: Path.... [some FMOD thingy] doesn't exist"
You might encounter this near the end of the compile process if you're compiling the Second Life code or an early batch of Imprudence code. The exact error message depends on your operating system:

On Linux, it looks like: RuntimeError: Path.... libfmod-3.75.so doesn't exist

On Mac: RuntimeError: Path.... libfmodwrapper.dylib doesn't exist

The problem: The compile process is trying to package up the fmod library so that it can be included in the installer package, but it can't find it!

Solution: If you're compiling Imprudence or an open source viewer that you intend to distribute to other people, the solution is to make the compile process skip that step entirely. FMOD is proprietary, so you can't legally distribute it -- including it would be pointless and dangerous!

To disable that step, open  in a text editor. The exact line to edit depends on you operating system:

On Linux, around line 611 or so: self.path("libfmod-3.75.so")

On Mac, around line 416 or so: self.path(self.args['configuration'] + "/libfmodwrapper.dylib", "libfmodwrapper.dylib")

You should comment out that line of code by typing a '#' (pound/number/hash symbol) at the start of the line of code. For example, the Linux line would become:
 * 1) self.path("libfmod-3.75.so")

Save the  file and start the compile process again, and the error should not occur.

Removing Bad Libraries on Linux
Note (08-10-2010):This is no longer *needed* (fixed as per http://redmine.kokuaviewer.org/issues/429), but it certainly won't hurt to do this: the more system libraries you use the better for you ;). In fact, if at all possible you should configure with --standalone (this, however, requires to install a few hard-to-get libraries).

If you are running Linux, you may need to remove some of the auto-downloaded libraries in order for the executable to successfully link at the end. This involves the following libraries from :

libGLU.so libGLU.so.1 libGLU.so.1.3.070600 libglib-2.0.so.0 libgobject-2.0.so.0 libgio-2.0.so.0 libgmodule-2.0.so.0 libgthread-2.0.so.0 libglib-2.0.so libgobject-2.0.so libgtk-x11-2.0.so.0 libpangoxft-1.0.so.0 libcairo.so.2 libgdk-x11-2.0.so.0 libpango-1.0.so.0 libpangoft2-1.0.so.0 libpangox-1.0.so.0 libatk-1.0.so.0 libgdk_pixbuf-2.0.so.0 libpixman-1.so.0 libpangocairo-1.0.so.0 libcairo.so libpango-1.0.so libpangoft2-1.0.so libpixman-1.so

(libGLU and libgtk versions might be slightly different).

The correct way to remove these libraries is with the  script:

scripts/install.py --uninstall GL glib gtk-etc

This will cause the compile process to use the libraries installed on your system. So, you'll need to have these installed via portage (Gentoo):

dev-libs/atk dev-libs/glib media-libs/mesa x11-libs/pango x11-libs/gtk+

or Debian/Ubuntu:

libglu1-mesa-dev libgtk2.0-dev

libsdl1.2-dev libopenjpeg-dev libopenal-dev

or Fedora/Redhat/OpenSUSE:

mesa-libGLU-devel atk-devel cairo-devel gtk2-devel glib2-devel pango-devel