Formatting code for LinuxMake
{{parent page="Linux"}}
===Linux compilation tuning===
One of the most useful compiler option is the **-j** option. It allows you to do compilation with multiple threads. Nowadays, many processors supports hyper-threading or multi-core. Specifying **-j n** where n is the number of cores + 1 will speed up the compilation process.
Even better, the -j option supports using more than 1 computer to compile. To do that, in additional to specifying **-j n**, you will need to have distcc. Installing distcc is as easy as getting the binary from http://distcc.samba.org/binaries.html. Install distcc, distcc-gui, and distcc-server.
==Starting distcc-server==
Is as easy as
%%
/etc/init.d/distccd start
OR manually
distccd -daemon -N15
%%
The -N level specify the nice level so it will have a lower priority than other processes. When started, distccd will listen on TCP 3632. distccd needs to be started on all machines in the "cluster".
==Using distcc==
One will need to tell distcc which machines to use for compilation. This can be achieved by
%%
export DISTCC_HOSTS="localhost machine1 machine2"
OR
echo "localhost machine1 machine2" > ~/.distcc/hosts
%%
Now simply compile with the CC option
%%
make -j4 CC=distcc
%%
For more information, visit distcc's web site at http://distcc.samba.org/doc.html
===Linux compilation tuning===
One of the most useful compiler option is the **-j** option. It allows you to do compilation with multiple threads. Nowadays, many processors supports hyper-threading or multi-core. Specifying **-j n** where n is the number of cores + 1 will speed up the compilation process.
Even better, the -j option supports using more than 1 computer to compile. To do that, in additional to specifying **-j n**, you will need to have distcc. Installing distcc is as easy as getting the binary from http://distcc.samba.org/binaries.html. Install distcc, distcc-gui, and distcc-server.
==Starting distcc-server==
Is as easy as
%%
/etc/init.d/distccd start
OR manually
distccd -daemon -N15
%%
The -N level specify the nice level so it will have a lower priority than other processes. When started, distccd will listen on TCP 3632. distccd needs to be started on all machines in the "cluster".
==Using distcc==
One will need to tell distcc which machines to use for compilation. This can be achieved by
%%
export DISTCC_HOSTS="localhost machine1 machine2"
OR
echo "localhost machine1 machine2" > ~/.distcc/hosts
%%
Now simply compile with the CC option
%%
make -j4 CC=distcc
%%
For more information, visit distcc's web site at http://distcc.samba.org/doc.html