Building Help

From Gnash Project Wiki

Jump to: navigation, search

Boost And GCC problems

If you are like me, you may have multiple builds of GCC installed on your system. This can cause problems with Boost, which builds itself with only one version of the compiler. The Boost team prefers one recompile Boost when switching compilers, and the Boost libraries when built have a compiler version as part of the name. So it's entirely easy to make sure you get the right libraries for the compiler version. The header files, are a whole different problem. Between GCC 4.1.x and GCC 4.2 the location of an internal header file changed that prevents Boost code from compiling.

To fix this, edit the Boost header file: boost/detail/atomic_count_gcc.hpp, and up near the top where it includes atomicity.h, change that line to be this block of code instead.

#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2))
# include <ext/atomicity.h>
#else
# include <bits/atomicity.h>
#endif

While there may be some issues with mixing compilers like this, I've never had a problem mixing GCC 4.1.x, GCC 4.2.x, and GCC 4.3.

Slow builds

I spend a lot of time hacking on the build infrastructure of Gnash, where often a single small change requires me to reconfigure and recompile all of Gnash from scratch to test if it worked. Gnash uses the autotools, so command line settings of variables are recursively passed down to subdirectories. So the easy way to speed builds up are to set CXXFLAGS="-O0". The default optimization level is -O2, so by reducing the optimization level, it builds faster, and hammers your CPU less.

Gnash also supports parallel builds, and often this can be much faster even on a slower machine. To invoke parallel build mode with make, use the -j options to make. -j takes a numerical option that is the number of concurrent makes to run. I find on a quad xeon, -j 5 is about all you want to do if you still want to be able to use your workstation for other tasks, like web surfing. On a Intel Dual Core, -j 3 works for me.

Other people report that they use ccache when compiling. To use ccache, set the value of CXX to be CXX="ccache g++".