distcc 이용하기
오늘은 커널을 distcc 를 이용해서 컴파일을 시도해 보겠습니다.
저는 데스크탑으로 우분투 9.10 을 사용하고 있으며, 노트북에도 동일하게 우분투 9.10 이 깔려 있습니다.
또한 distcc 와 gcc 컴파일러 역시 동일한 버전이 깔려 있습니다.
distcc 는 패키지 관리자로 깔았습니다.
root@boggle70-desktop:linux-2.6# distcc --version
distcc 3.1 i486-pc-linux-gnu
 (protocols 1, 2 and 3) (default port 3632)
 built Oct  4 2009 16:29:06
Copyright (C) 2002, 2003, 2004 by Martin Pool.
Includes miniLZO (C) 1996-2002 by Markus Franz Xaver Johannes Oberhumer.
Portions Copyright (C) 2007-2008 Google.

distcc comes with ABSOLUTELY NO WARRANTY.  distcc is free software, and
you may use, modify and redistribute it under the terms of the GNU 
General Public License version 2 or later.

Built with Zeroconf support.

Please report bugs to distcc@lists.samba.org

root@boggle70-desktop:linux-2.6# gcc --v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.1-4ubuntu9' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu9)

데스크탑과 노트북이 동일합니다.
먼저 모니터링을 위해서 프로그램을 하나 띄웁니다.

root@boggle70-desktop:~# distccmon-gnome
몇개의 호스트에서 컴파일이 진행되는지 보여줍니다.
커널을 하나 다운받고 컴파일을 시도합니다.
버전은 2.6.36을 사용했습니다.
root@boggle70-desktop:linux-2.6# make i386_defconfig
 HOSTCC  scripts/kconfig/conf.o
 HOSTCC  scripts/kconfig/kxgettext.o
 HOSTCC  scripts/kconfig/zconf.tab.o
 HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#

그리고 나서 컴파일을 한번 해보면 아주 잘 됩니다.
이제 distcc 를 이용한 컴파일을 시도합니다.
root@boggle70-desktop:linux-2.6# make CC="distcc gcc" bzImage -j 5
안타깝게도 에러가 발생합니다.

distcc[8126] (dcc_build_somewhere) Warning: failed to distribute, running locally instead
 CC      arch/x86/kernel/apic/io_apic.o
반복해서 컴파일을 할 파일들에서 반복적으로 나타납니다.
distcc 데몬을 띄워둔 노트북에 접속이 잘 안되나 봅니다.
설정은 /etc/default/distcc 에서 하는데 중요한 값은
서버로 동작하는 머신의 IP  
ALLOWEDNETS="192.168.10.190 192.168.10.198"
distcc 에서 이용할 인터페이스
LISTENER="192.168.10.198"
그리고 
export DISTCC_HOSTS="192.168.10.190 192.168.10.198"
이렇게 한 후에 
/etc/init.d/distcc restart
으로 데몬을 실행 시킵니다.
좀더 에러메세지를 살펴보면 컴파일시에는 아래의 메세지가 나옵니다.
distcc[23247] (dcc_pump_sendfile) ERROR: sendfile failed: Connection reset by peer
distcc[23247] (dcc_readx) ERROR: unexpected eof on fd5
distcc[23247] (dcc_r_token_int) ERROR: read failed while waiting for token "DONE"
distcc[23247] (dcc_r_result_header) ERROR: server provided no answer. Is the server configured to allow access from your IP address? Does the server have the compiler installed? Is the server configured to access the compiler?
/var/log/distccd.log  에는 원격서버의 로그가 있는데 살펴보면 
50 distccd[7060] (dcc_r_token_int) ERROR: protocol derailment: expected token "DIST"
51 distccd[7060] (dcc_explain_mismatch) ERROR: error context: ""
52 distccd[7060] (dcc_r_request_header) ERROR: client did not provide distcc magic fairy dust
53 distccd[7060] (dcc_job_summary) client: 192.168.10.190:54155 REJ_BAD_REQ exit:0 sig:0 core:0 ret:109 time:0ms
54 distccd[7061] (dcc_r_token_int) ERROR: protocol derailment: expected token "DIST"
55 distccd[7061] (dcc_explain_mismatch) ERROR: error context: ""
56 distccd[7061] (dcc_r_request_header) ERROR: client did not provide distcc magic fairy dust
의 메세지가 반복됩니다.
네트워크 패킷을 보니 TCP ACK 가 DUP 되었다고 나오는데 현재까지는 원인을 모르겠습니다.
다음주에 좀더 디버깅을 진행해 보겠습니다.
그럼 다음시간에...