Building and installing projectM yourself
A brief warning: projectM uses cmake - the same package building tool most notably used by the KDE team that is heavily competing with autoconf. Although it may be a new tool for the reader, it's actually quite simple to use. Make sure you have cmake installed before trying to build projectM yourself.
Install dependencies
Before you can compile the source, you may need to install some of the libraries required.
If you use a Debian-based distro, make sure you have at least the following packages installed:
ftgl-dev >= 2.1.3-rc5
libglew1.5-dev
libsdl-dev
qt4-dev-tools
For FTGL on fedora you need
ftgl >= 2.1.2
ftgl-devel >= 2.1.2
You can just do "sudo yum install ftgl*", usually.
Get the source
There are at least two ways to get projectM by source. Pick the one you prefer below and continue to the building section.
Option 1: How to download the latest monolithic source release (projectM-complete)
First download the most recent version of projectM-complete
Let's assume MY_PROJECT_DIR is where you want to unpack the projectM source and MY_DOWNLOAD_DIR is where you saved the download to disk.
cd MY_PROJECT_DIR
tar -jxvf MY_DOWNLOAD_DIR/projectM-complete-1.1-r4.tar.bz2
cd projectM-complete-1.1/src
Option 2: How to download from subversion (recommended!)
Why use the latest projectM branch from subversion? Because the projectM developers hate making releases. This means we take our time to fix lots of bugs and write cool new features before going public about it. If you don't feel like waiting, subversion is the path is for you. Make sure you have subversion installed before continuing. To get and configure the latest main branch (hereby known as "trunk"), run the following commands (use a path you have permission to write files to like your home directory):
svn co https://projectm.svn.sf.net/svnroot/projectm/trunk projectM-Trunk
cd projectM-Trunk/src
NOTE: the svn checkout command (svn co for short) is necessary only once! To keep your copy fresh, type
svn update
in directory projectM-Trunk to get the latest changes.
Compiling and installing
From the src sub-directory of the source you got in the previous step, run:
ccmake .
Note the dot after "ccmake" (you need to pass it the current directory).
cmake should now present you with a configuration screen
- Press 'c' to configure the cmake project file. A bunch of editable options should appear like "INCLUDE-PROJECTM-LIBVISUAL", "INCLUDE-PROJECTM-PULSEAUDIO", "INCLUDE-PROJECTM-JACK", etc.
- Enable or disable these features as you see fit.
- In particular, note that FTGL installation issues can break the compilation if you enable USE_FTGL. If you run into build trouble, turn this feature off for the time being.
- On most systems, you should probably change the CMAKE install prefix from "/usr/local" to "/usr". This usually ensures that the projectM libraries belong to your library search path.
- Some people experience issues with USE_FBO. Consider turning FBO off if you encounter segfaults when loading projectM.
- One last important option is CMAKE_BUILD_TYPE: best for most users is the value Release here, which will yield the highest level of performance out of projectM.
When you are satisfied with the configuration, press 'g' to generate the makefile and 'q' to exit the configuration screen. The final steps are typical. In the same directory as mentioned above, type
make
sudo make install # (or just login as root and do `make install`)
That's all it takes-the make command will build everything you told it to in one shot. If the build fails, try turning off packages via the potentially offending INCLUDE-* options. If you are missing a library, cmake will generally tell you so and maybe even suggest where to get it.
Modular install Method
One can perform the same cmake configuration and build steps as above within each module subdirectory in projectM-Trunk/src. In this case, each module looks on the system globally for the relevant include files and libraries. Thus one must first build and install projectM-engine before anything! Also note that cmake stores a cache of its last settings called CMakeCache.txt. It is wise to remove these files if you previously compiled projectM non modularly in the past.
NB: Most modules you can build "out of tree". That is, you don't have to use the same directory that the sources are in to build. You can say "ccmake /path/to/module" and it will work the same, without polluting your checkout. However, do not try this at present with the projectM-qt module - it will not compile using this method.
If problems occur
Most users with build issues typically are missing the "dev" packages of projectM's library dependencies. Make sure you have the glew, ftgl, pulse audio, qt, jack, etc. dev packages as well as their corresponding binaries prior to configuring cmake.
Before giving up delete your CMakeCache.txt files and retry the process. cmake doesn't always recheck things. When all else fails, post to the forums, email, or join #projectm on irc.freenode.net to get some help. Try to remember to enable the option CMAKE_VERBOSE_MAKEFILE when posting build errors to facilitate the debugging process.
Cmake Error: CMakeLists.txt
CMake Error: The source directory "/path/goes/here" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
You're probably in the wrong directory! You have to be in the src sub-directory of the source tree before you call cmake.
Cannot find QT tools qmake, but I know it's installed!
You probably have qmake v3.x installed, which is installed by default on a lot of distros (e.g. Ubuntu). You need to install v4.x. Install qt4-dev-tools and try again.
You probably have this version installed, which is not what ccmake is looking for:
$ which qmake && qmake --version
/usr/bin/qmake
Qmake version: 1.07a (Qt 3.3.8b)
Qmake is free software from Trolltech ASA.
What you really want is this:
$ which qmake-qt4 && qmake-qt4 --version
/usr/bin/qmake-qt4
QMake version 2.01a
Using Qt version 4.3.4 in /usr/lib
error while loading shared libraries: libprojectM.so.2: cannot open shared object file: No such file or directory
You either havn't run "make install" (as root) or you installed into a location your system doesn't look in for shared libraries. The default install prefix is "/usr/local", it is likely that your system uses plain-old "/usr".
To fix:
make clean
# ... so you can be sure your new configuration will be used
ccmake .
# ... and change CMAKE_INSTALL_PREFIX to "/usr"
# ... then generate new config by pressing "c"
# ... finally write-out the config by pressing "g"
make
sudo make install
Alternatively, you can configure your system to search for shared libraries in /usr/local. The normal way on Linux is to edit /etc/ld.so.conf.
FindPkgConfig: None of the required 'libprojectM' found
This may happen if you use the modular install method as above, you have kept the default prefix /usr/local, and you are using a distro that does not adjust pkg-config's search path. For instance, Gentoo is one of these; see bug 62366. You will have to explicitly include /usr/local in the search path, something like this:
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig cmake ~/vcs/projectm/trunk/src/projectM-test
Make sure you totally nuke and recreate your build directory before trying the command line above, if you received the error above. CMake is not good at reconfiguring, and you will likely encounter a lot of link errors if you do not.
Debian and derivatives adjust the path automatically.
Variable not found: SDL_INCLUDE_DIR
When compiling projectm-libvisual, if you get an error from cmake that it cannot find the variable SDL_INCLUDE_DIR you should install the development version of SDL for your system.
On Ubuntu, libsdl1.2-dev is the name of the package needed.
Known Issues
- On some systems, cmake will not automatically copy "config.inp.in" to "config.inp" (the file sits in the projectM-engine or libprojectM directory) - fixed on svn revision 950!
- cmake will not detect GLEW automatically in libprojectM. This is because GLEW does not seem to install a pkgconfig file. If you get "glew.h" missing build errors, install "glew-dev" or whatever is correct for your linux distribution.
- Possible modular installation problems leading to errors like "projectM.hpp not found" - please report issues if they arise!
- projectM-jack will not automatically compile and use SDL instead if QT is missing. One must turn off the QT_JACK_SUPPORT flag manually.
- projectM-xmms build file uses pkgconfig to find xmms, but some distributions don't install xmms that way. In this case you must set the include and library paths for xmms in cmake yourself.