How to compile
From Imprudence
Our modest attempt at a tutorial for compiling the Imprudence code. Please correct any errors or missing information.
Contents |
Necessary software
Linux
- CMake 2.4.8 (newer versions seem not to work right)
- Python
- The standard stuff: gcc, make, tar, etc.
MacOS X
- OS Leopard (10.4) or Tiger (10.5)
- Xcode 2.4 if you have Leopard, or 3.0 or greater if you have Tiger. Free to download (though a rather large download), you just need sign up for a free ADC membership. Or if you have your MacOS X installer disc lying around somewhere, that should have a copy of Xcode on it.
- CMake 2.4.8 or greater
Windows
- Visual Studio 2005 or 2008 (VS2005 is recommended).
- NOTE: you can download Visual C++ Express 2005 and SP1 (SP1 for Vista) or Visual C++ Express 2008 (untested, not recommended) for free. If you are a student, you can also download Visual Studio 2005/2008 Professional for free through dreamspark.
- Visual Studio 2005 redistributable (only if you're not using VS2005).
- CMake 2.6.2 (or greater). Add CMake to the system PATH.
- ActivePython 2.5 or 2.6.
- Cygwin. Make sure patchutils, flex, and bison are included under "devel".
- Microsoft DirectX SDK November 2008. Install Headers and Libs.
- Windows SDK 6.1. The only required portion is Developer Tools > Windows Headers and Libraries.
Source Code
Download Source
Imprudence source code is available online:
- For specific versions, check the Downloads page
- For the latest source, check the 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.
- Windows: For versions 1.2.0 and higher, the libraries archive isn't needed.
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:
cp -R artwork/linden/* libs/linden/* source/linden/(where artwork, libs, and source are the directories where you unpacked those packages.) - Mac: Open a Terminal and use the command:
ditto artwork/linden/ libs/linden/ source/linden/(where artwork, libs, and source are the directories where you unpacked those packages.) - Windows: Drag all the 'linden' directories into the same directory and use the "Replace" option to combine them, or just "extract here."
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:
- 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.
- Create project files to use for compiling with Visual Studio (on Windows), 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, processor type (e.g. Intel vs PPC), and/or Visual Studio version (for Windows).
Linux & Mac
Open up a terminal (on Mac, that's Applications > Utilities > Terminal, I believe), change directory (or "cd") to the linden/indra/ directory and run the "develop.py" program. This example assumes you put the linden directory inside the directory /Users/MyName/Imprudence:
cd "/Users/MyName/Imprudence/linden/indra/" python develop.py
Project files are generated in:
- Linux:
linden/indra/viewer-linux-*(e.g.viewer-linux-i686) - Mac:
linden/indra/build-darwin-*(e.g.build-darwin-ppc)
Windows
cd C:\imprudence\linden\indra python develop.py
Or, browse to linden/indra/ directory and double-click "develop.py" to run it with ActivePython. If you have multiple versions of Visual Studio installed, use the -G flag to specify a version to generate a solution for, e.g.: python develop.py -G VC80 where:
- VC71 = VS2003
- VC80 = VS2005
- VC90 = VS2008
(Note: develop.py will always find a Visual Studio version before an Express Edition.)
Project files are generated in:
-
linden/indra/build-vc*(e.g.linden/indra/build-vc80)
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
From the linden/indra/ directory, run:
python develop.py build
This will go through and compile everything. The final product goes into linden/indra/viewer-linux-*/newview/packaged/. There will also be a .tar.bz2 file in newview containing the same contents as the packaged directory.
Mac
Open up the linden/indra/build-darwin-* 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, you can skip that step.) Now click the Run button, and it should start compiling!
The final product goes into (I think) linden/indra/build-darwin-*/newview/RelWithDebInfo/. Please edit this article if I'm mistaken.
Windows
(Visual Studio 2005 is the default compiler for Imprudence. Feel free to post about issues using the Express Editions or 2008 in the development forums.)
Visual Studio 2005
- After develop.py has completed, either browse to your newly created
linden\indra\build-vc80directory and double click on Imprudence.sln, or open the solution file directly from Visual Studio.
- The default StartUp Project should be "imprudence-bin" (you can tell because it's bold). If not, make it so by right clicking "imprudence-bin" and selecting "Set As StartUp Project".
- There will be three build options:
Release,Debug, andRelWithDebInfo. We recommend buildingRelease.
- Go grab some lunch, a full build takes a while.
- Your final compiled .exe and dlls are placed in
\linden\indra\build-vc80\newview\release. If you want to run imprudence-bin.exe without relying on Visual Studio:- Copy the *.txt files and skins, lib, character, fonts, and app_settings folders from
\linden\indra\newviewto\linden\indra\build-vc80\newview\release - Run imprudence-bin.exe.
- Copy the *.txt files and skins, lib, character, fonts, and app_settings folders from
- (If you make any changes to the files in
\linden\indra\newview, such as editing an xml file, you'll need to copy them over again. This puts a lot of junk in your build environment, though.)
- (If you make any changes to the files in
Visual C++ 2005 Express Edition
- Configure VC++ Express by going to Tools > Options > Projects and Solutions > VC++ Directories and adding the following paths to the top (the ones listed here are default installations; use your local version):
- Executable files:
-
C:\Program Files\CMake 2.6\bin -
C:\Python25
-
- Include files:
-
C:\Program Files\Microsoft DirectX SDK (November 2008)\Include -
C:\Program Files\Microsoft SDKs\Windows\v6.1\Include
-
- Library files:
-
C:\Program Files\Microsoft DirectX SDK (November 2008)\Lib\x86 -
C:\Program Files\Microsoft SDKs\Windows\v6.1\Lib
-
- Executable files:
- Imprudence's version of develop.py should find your Express installation, but if not, you need to specify the version with
python develop.py -G VC80 - CMake will die when it gets to VStool. Don't worry, this is expected due to differences between the regular and Express version. your solution file has already been created.
- Follow the Visual Studio 2005 steps above.
Visual Studio 2008
- Use
python develop.py -G VC90to specify Visual Studio 2008. - Untried. Let us know what happens.
- See http://jira.secondlife.com/browse/VWR-9541 and https://wiki.secondlife.com/wiki/User:Jodiah_Jensen for more info.
Compiling Windows Libraries
OPTIONAL! If you are feeling brave, you can compile the viewer's libraries for yourself. See User:McCabe/Win_build for Imprudence-specific library compile instructions. Any library not yet there can be found here.
Troubleshooting
LNK1181: cannot open input file 'libgstvideo-0.10.lib
If you see the errorLINK : fatal error LNK1181: cannot open input file 'libgstvideo-0.10.lib CMake didn't find the right GStreamer library names (this was fixed in 1.2). Edit GStreamer.cmake with the right values, or right click imprudence-bin > Properties > Linker > Input > Additional dependencies and make sure these are the file names listed: libgstvideo.lib
libgsttag.lib
libgstsdp.lib
libgstrtsp.lib
libgstrtp.lib
libgstriff.lib
libgstreamer-0.10.lib
libgstpbutils.lib
libgstnetbuffer.lib
libgstnet-0.10.lib
libgstinterfaces.lib
libgstdshow.lib
libgstdataprotocol-0.10.lib
libgstcontroller-0.10.lib
libgstbase-0.10.lib
libgstaudio.lib
libgstapp.lib
"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
And on Windows:
RuntimeError: Path.... fmod.dll 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 linden/indra/newview/viewer_manifest.py 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")
On Windows, around line 170 or so:
self.path("fmod.dll")
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:
#self.path("libfmod-3.75.so")
Save the viewer_manifest.py file and start the compile process again, and the error should not occur.
Removing Bad Libraries on Gentoo Linux
If you are running Gentoo Linux, you may need to remove some of the auto-downloaded libraries in order for the executable to successfully link at the end. From linden/libraries/i686-linux/lib_release_client/, remove:
libatk-1.0.so libgdk_pixbuf-2.0.so libgdk-x11-2.0.so libglib-2.0.so libGLU.so libGLU.so.1 libGLU.so.1.3.070002 libgmodule-2.0.so libgobject-2.0.so libgthread-2.0.so libgtk-x11-2.0.so libgtk-x11-2.0.so.0.400.14 libpango-1.0.so libpangoft2-1.0.so libpangox-1.0.so libpangoxft-1.0.so
This will cause the compile process to use the libraries installed on your system. So, you'll need to have these installed via portage:
dev-libs/atk dev-libs/glib media-libs/mesa x11-libs/pango x11-libs/gtk+

