How to compile

From Imprudence

Jump to: navigation, search

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

Contents

Necessary software

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
  • The standard stuff: make, tar, etc.
  • GCC 4.3

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

Git

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

Source Code

Download Source

Imprudence source code is available online:

Download Artwork & Libraries

  • The Downloads page contains artwork and libs for specific versions, as well as for the latest source.
  • Artwork is no longer needed for versions 1.3.0 and higher.
  • Library files are necessary for some platforms and/or versions but not others. Be sure to grab all the files you need.

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:

  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 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

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

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)

Tip: to compile with LLVM on Mac use the command python develop.py configure -DGCC_DISABLE_FATAL_WARNINGS:BOOL=TRUE 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.

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

GCC 4.4

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 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.

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 ([1]). note: SSE4 is only available in GCC 4.2 and LLVM

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, make sure its set to i386) Now click the Run button, and it should start compiling!

The final product goes into linden/indra/build-darwin-*/newview/RelWithDebInfo/ unless you chose the Release profile then you can find it in linden/indra/build-darwin-*/newview/Release. 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, 2008, or 2010 in the development forums.)

Visual Studio 2005

  1. After develop.py has completed, either browse to your newly created linden\indra\build-vc80 directory and double click on Imprudence.sln, or open the solution file directly from Visual Studio.

  2. 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".

  3. There will be three build options: Release, Debug, and RelWithDebInfo. We recommend building Release.

  4. Go grab some lunch, a full build takes a while.

  5. 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:
    1. Copy the *.txt files and skins, lib, character, fonts, and app_settings folders from \linden\indra\newview to \linden\indra\build-vc80\newview\release
    2. Run imprudence-bin.exe.
(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.)

Visual C++ 2005/2008 Express Edition

  • Configure VC++ Express by going to Tools > Options > Projects and Solutions > VC++ Directories and adding the following paths to the top of the matching list (upper right dropdown). The ones listed here are default installations; use your local versions:
    • Executable files:
      • C:\Program Files\CMake 2.6\bin
      • C:\Python26
    • 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
  • 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 (or python develop.py -G VC90 for 2008). You made need to use the VS prompt instead of the regular command prompt to run develop.py.
  • 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 VC90 to specify Visual Studio 2008.
  • Follow the steps above for 2005.

Visual Studio 2010

  • Not a clue if it works. You might need to patch the source a bit or recompile some libraries. Let us know! Or better yet, push some fixes to github!

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

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.

AttributeError: 'WindowsSetup' object has no attribute '__name__'

develop.py isn't finding your version of Visual Studio. You need to specify it by using the -G command flag, e.g.:

python develop.py -G VC80 (or -G VC90 for 2008).

LINK : fatal error LNK1104: cannot open file 'user32.lib'

More than likely, you're using the VC++ Express Edition and it's trying to link using the cygwin version of link.exe rather than VC++'s. Make sure C:\cygwin\bin isn't in your PATH or your VC++ Executable options. Clear your CMake cache (delete your indra/build-*/CMakeCache.txt file) before running develop.py again.

LNK1181: cannot open input file 'libgstvideo-0.10.lib

If you see the error LINK : 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

viewer_manifest.py errors at the end of a build on Windows

More than likely you'll see something like this:

27>------ Rebuild All started: Project: package, Configuration: Debug Win32 ------
27>Deleting intermediate and output files for project 'package', configuration 'Debug|Win32'
27>Generating Debug/touched.bat

... 

27>Processing relwithdebinfo/imprudence-bin.exe => imprudence.exe ... Traceback (most recent call last):
27>  File "/Imprudence 1.3.0 beta 1/linden/indra/newview/viewer_manifest.py", line 1113, in <module>
27>    main()

This is an error due to the "package" project that generates files for the installer in 1.3 b1. The files generate fine, but the error can be annoying. You can disable the "package" project by going to ALL_BUILD > Project Dependencies and unchecking "package."

BISON-NOTFOUND or FLEX-NOTFOUND

Also the cause of LINK : fatal error LNK1104: cannot open file '..\lscript\lscript_compile\Debug\lscript_compile.lib' 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

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 (also Debian and Ubuntu) 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. Same action also might be necessary on Debian or Ubuntu. 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

(libGLU and libgtk versions might be slightly different). 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+

Personal tools