Icecc is a distributed compiler that allows compilation jobs to be distributed across multiple computers to reduce build times. It works by having one computer act as a scheduler that distributes preprocessing, compilation, and assembly jobs to other connected computers. The key requirements are that all computers must have the same toolchain installed and be on a fast network. Setting up Icecc involves configuring one computer as the scheduler, installing Icecc on all computers, and ensuring all toolchains are packaged and accessible in a shared location. Icecc has been shown to reduce Linux kernel compilation time by 75% by utilizing 3 additional computers during the build.
14. 14
1. Preprocessor must always run locally
• It needs to access various header files on the local
machine which may not be present, or may not be the
same, on the volunteer. The linker similarly needs to
examine libraries and object files, and so must run locally.
2. The linker similarly needs to examine libraries
and object files, and so must run locally.
3. Preprocessed source => compiler/assembler=>
object file
4. It runs the compiler/assembler remotely.
18. 18
IceCream based on Distcc’s source code
•Improve performance
•Dynamic scheduler of the compilation jobs
19. 19
Requirement
Same version (icecream)
• icecc-scheduler scheduler 1.0.90
• ICECC 1.0.90
Fast network connection
• > 100 Mbps
One scheduler
• neither less nor more
Toolchain Installed
• All toolchain should be the same
23. 23
4. More verbose message for debugging
export ICECC_DEBUG=“debug”
5. Create soft link under icecc binary directory
cd /usr/local/bin/
ln -sf icecc arm-mv5sft-linux-gnueabi-gcc
ln -sf icecc arm-mv5sft-linux-gnueabi-g++
ln -sf icecc gcc
ln -sf icecc g++
ln -sf icecc arm-linux-gnueabihf-gcc
ln -sf icecc arm-linux-gnueabihf-g++
24. 24
6. Export path
declare -x
ICECC_VERSION="/dev/shm/toolchain/i386.tar.gz,/dev/shm/too
lchain/arm-mv5sft-linux-gnueabi.tar.gz=arm-mv5sft-
linux,/dev/shm/toolchain/arm-linux.tar.gz=arm-linux-
gcc,/dev/shm/toolchain/arm-linux-gnueabihf.tar.gz=arm-linux-
gnueabihf"
7. Add new user in /etc/passwd
vi /etc/passwd
icecc:x:113:121::/var/cache/icecc:/bin/false
25. 25
7. Create a tarball file for each toolchain that you
want to use with icecream
/usr/local/libexec/icecc/icecc-create-env --gcc /usr/local/arm-mv5sft-linux-gnueabi/bin/arm-mv5sft-
linux-gnueabi-gcc /usr/local/arm-mv5sft-linux-gnueabi/bin/arm-mv5sft-linux-gnueabi-g++
/usr/local/libexec/icecc/icecc-create-env --gcc /usr/bin/gcc /usr/bin/g++
/usr/local/libexec/icecc/icecc-create-env --gcc /usr/local/arm-linux-4.4.2/bin/arm-linux-gcc
/usr/local/libexec/icecc/icecc-create-env --gcc /usr/local/arm-linux-gnueabihf-4.7-
20130415/bin/arm-linux-gnueabihf-gcc /usr/local/arm-linux-gnueabihf-4.7-
20130415/bin/arm-linux-gnueabihf-g++
8. Modify generated tar.gz file, and put it under
specific directory
mv xxxx.tar.gz i386.tar.gz
mv i386.tar.gz /dev/shm/toolchain/i386.tar.gz
Make –j 若後面不加則umlimit
默認情況下,make 是一個順序工作的工具。它按次序調用底層編譯器來編譯 C/C++ 源。 (一般多核皆沒有用到)
–j -- 10 的參數是編譯過程開始後能同時進行的最大編譯數。如果沒有給 -j 提供任何參數,則所有源文件都會在系統中排隊,等待同時編譯。在運行多核系統上的編譯時,使用 -j 選項特別有用。要使用 -j 選項,必須先解決幾個關鍵問題;這些問題將在下面部分討論。
If a recipe fails (is killed by a signal or exits with a nonzero status), and errors are not ignored for that recipe (see Errors in Recipes), the remaining recipe lines to remake the same target will not be run. If a recipe fails and the ‘-k’ or ‘--keep-going’ option was not given (see Summary of Options), make aborts execution. If make terminates for any reason (including a signal) with child processes running, it waits for them to finish before actually exiting.
When the system is heavily loaded, you will probably want to run fewer jobs than when it is lightly loaded. You can use the ‘-l’ option to tell make to limit the number of jobs to run at once, based on the load average. The ‘-l’ or ‘--max-load’ option is followed by a floating-point number. For example,
-l 2.5