SVX日記

2004|04|05|06|07|08|09|10|11|12|
2005|01|02|03|04|05|06|07|08|09|10|11|12|
2006|01|02|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|04|05|06|07|08|09|10|11|12|
2012|01|02|03|04|05|06|07|08|09|10|11|12|
2013|01|02|03|04|05|06|07|08|09|10|11|12|
2014|01|02|03|04|05|06|07|08|09|10|11|12|
2015|01|02|03|04|05|06|07|08|09|10|11|12|
2016|01|02|03|04|05|06|07|08|09|10|11|12|
2017|01|02|03|04|05|06|07|08|09|10|11|12|
2018|01|02|03|04|05|06|07|08|09|10|11|12|
2019|01|02|03|04|05|06|07|08|09|10|11|12|
2020|01|02|03|04|05|06|07|08|09|10|11|12|
2021|01|02|03|04|05|06|07|08|09|10|11|12|
2022|01|02|03|04|05|06|07|08|09|10|11|12|
2023|01|02|03|04|05|06|07|08|09|10|11|12|
2024|01|02|03|04|

2006-04-14(Fri) coLinuxの再コンパイルで再びコンパイすル

  今日はちょっとハードをお休みしてソフトをやる。先日、coLinuxのバージョンを0.6.1から0.6.2や0.6.3-pre13に上げてからというもの、安定性は向上し、快適性は増したのだが、カーネルのコンパイルができなくてコンパイしていルのである。

  0.6.1の時はできていたのに……というのも、coLinuxではカーネルコンパイルの際、ナゼかgccのバージョンを合わせねばならないのだ。以前、WBEL3を使っていた時のgccは3.2と、0.6.1と適合していたのだが、0.6.2および0.6.3-pre13ではgccが3.3である必要がある。だが、WBEL4にはgccの3.4が乗っちゃっているのである。絶妙にダメなのである。

  某rpmパッケージではRedHat10になりそこねたSevern、FedoraCoreの1と2において、gccの3.3が提供されているようだが、それを無理やり当ててコンパイルして作ったvmlinuxを使ったらブルースクリーンになってしまった。よくわからんが、なにしろダメなようである。

  ちゅーわけで不本意ながら、仕方なくそのまま使っていたのだが、先日ちょっと本屋でcoLinuxの本を発見し、軽く立ち読みしたら、gccを自分でインストールしてコンパイルして動かしちゃっている……なんじゃ、そんなコトなのか。ほんじゃ……というワケで、オイラもマネしてみるのであった。

  まずはパッケージ集め。今回は0.6.3-pre13上で動いているWBEL4の上でカーネルコンパイルをしてみることにする。gccの3.3、linuxの2.6.11、colinuxの0.6.3-pre13のアーカイブを持ってくる。このヘンこのヘンこのヘンにあるぞ。

<root> 金  4月 14 - 19:40:36
wbel4-co:/usr/src # ls
合計 59620
drwxr-xr-x  5 root  root       4096  3月 24 14:07 kernels/
drwxr-xr-x  7 root  root       4096  3月 24 14:08 whitebox/
-rwxr--r--  1 mitsu furuta   438707  4月 14 19:40 stable-colinux-20050524.tar.gz*
-rwxr--r--  1 mitsu furuta 37075679  4月 14 19:40 linux-2.6.11.tar.bz2*
-rwxr--r--  1 mitsu furuta 23447616  4月 14 19:40 gcc-3.3.tar.bz2*

  で、gccのインストールから始めよう。/usr/srcの下に展開する。

<root> 金  4月 14 - 19:42:42
wbel4-co:/usr/src # tar xvfj gcc-3.3.tar.bz2
 
<root> 金  4月 14 - 19:42:52
wbel4-co:/usr/src # cd gcc-3.3

  と、ココでハタと困った。現状のgccの3.4環境を壊したくない。だが、こんな要求は当然だろう。ちゅーことはどこかに書いてあるハズである。READMEとかINSTALLとか……ほれ、FAQにあったぞ。

<root> 金  4月 14 - 19:45:06
wbel4-co:/usr/src/gcc-3.3 # view FAQ
 
   The  easiest  way  to  do  this  is  to  configure  the  new  GCC with
   --prefix=/usr/local/gcc      and      the      older     gcc2     with
   --prefix=/usr/local/gcc2.  Build and install both compilers. Then make
   a  symlink  from /usr/local/bin/gcc to /usr/local/gcc/bin/gcc and from
   /usr/local/bin/gcc2  to  /usr/local/gcc2/bin/gcc. Create similar links
   for the "g++", "c++" and "g77" compiler drivers.

  要は、configureの際に引数を与えてやればいいみたいだ。

<root> 金  4月 14 - 19:45:42
wbel4-co:/usr/src/gcc-3.3 # ./configure --prefix=/usr/local/gcc33

  で、おもむろにmakeするのである……が!?

<root> 金  4月 14 - 19:47:49
wbel4-co:/usr/src/gcc-3.3 # make
 
gcc -c   -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes    -DHAVE_CONFIG_H    -I. -If -I. -I./f -I./config -I./../include f/com.c -o f/com.o
f/com.c:11078: error: conflicting types for 'ffecom_gfrt_basictype'
f/com.h:236: error: previous declaration of 'ffecom_gfrt_basictype' was here
f/com.c:11078: error: conflicting types for 'ffecom_gfrt_basictype'
f/com.h:236: error: previous declaration of 'ffecom_gfrt_basictype' was here
make[1]: *** [f/com.o] エラー 1
make[1]: Leaving directory `/home/src/gcc-3.3/gcc'
make: *** [all-gcc] エラー 2

  なんか、コンパイルエラーが出るんですけど……なんで? 軽くソースを読むと、ソースファイルとヘッダファイルの関数定義が食い違っている……ちゅーか、コードの流れからするとヘッダファイルの単純な打ち間違え以外に考えられない。236行目の「ffeinfoKindtype」を「ffeinfoBasictype」にサクッと直す。

<root> 金  4月 14 - 19:58:04
wbel4-co:/usr/src/gcc-3.3 # vi gcc/f/com.h
 
    235   ATTRIBUTE_PRINTF_1;
    236 ffeinfoBasictype ffecom_gfrt_basictype (ffecomGfrt ix);
    237 ffeinfoKindtype ffecom_gfrt_kindtype (ffecomGfrt ix);

  makeを再開。

<root> 金  4月 14 - 19:58:19
wbel4-co:/usr/src/gcc-3.3 # make

  結構、時間かかるね……フリーセルして待っているけど、早くしないと駅に着いちゃうんですが……って、ハイ。例によって電車の中でコンパイルしてますです。この文章もほぼリアルタイムで書いてますです。早くぅ〜、終われぇ〜。なんだか、java関係を一生懸命コンパイルしてますが、javaなんて要らんのに……あー、着いちまったッ!! 仕方ない。サスペンドせず稼動状態のまま小脇に抱えて、電車を降りて家に向かおぅ……しかし、家についても余裕でコンパイルは終わらない……コンパイラのコンパイルにはカーネルなんかより遥かに時間がかかるのね。

/usr/bin/ld: final link failed: Memory exhausted
collect2: ld returned 1 exit status
make[2]: *** [libgcj.la] エラー 1
make[2]: Leaving directory `/home/src/gcc-3.3/i686-pc-linux-gnu/libjava'
make[1]: *** [all-recursive] エラー 1
make[1]: Leaving directory `/home/src/gcc-3.3/i686-pc-linux-gnu/libjava'
make: *** [all-target-libjava] エラー 2
 
<root> 金  4月 14 - 21:13:51
wbel4-co:/usr/src/gcc-3.3 #

  で、しまいにゃ、エラーかよッ!! もいっちょ!!

make[1]: *** [all-recursive] ハングアップ
make[2]: *** [libgcj.la] ハングアップ
make: *** [all-target-libjava] ハングアップ
ハングアップ

  今度はパニック? ちょっとメモリの割り当てがが64Mでは少なすぎるか……一度落として、128Mに上げて再起動。

<root> 金  4月 14 - 22:36:40
wbel4-co:/usr/src/gcc-3.3 # make
 
make[2]: Leaving directory `/home/src/gcc-3.3/i686-pc-linux-gnu/libjava'
make[1]: Leaving directory `/home/src/gcc-3.3/i686-pc-linux-gnu/libjava'
 
<root> 金  4月 14 - 22:46:50
wbel4-co:/usr/src/gcc-3.3 #

  一応、終わったッ!!

<root> 金  4月 14 - 22:51:55
wbel4-co:/usr/src/gcc-3.3 # ls -lrtR /lib /bin /usr /sbin /etc > before.ls-R
 
<root> 金  4月 14 - 22:53:09
wbel4-co:/usr/src/gcc-3.3 # make install
 
<root> 金  4月 14 - 22:59:41
wbel4-co:/usr/src/gcc-3.3 # ls -lrtR /lib /bin /usr /sbin /etc > after.ls-R
 
<root> 金  4月 14 - 23:01:51
wbel4-co:/usr/src/gcc-3.3 # diff before.ls-R after.ls-R  | less

  なーんてやって、余計なファイルが書き込まれていないのを確認しつつ……一応、gccのインストールは完了である!! そして抜く手も見せずにカーネルのコンパイルに移る。

<root> 金  4月 14 - 23:02:17
wbel4-co:/usr/src/gcc-3.3 # cd ..
 
<root> 金  4月 14 - 23:02:27
wbel4-co:/usr/src # tar xvfj linux-2.6.11.tar.bz2
 
<root> 金  4月 14 - 23:05:26
wbel4-co:/usr/src # mkdir stable-colinux-20050524
 
<root> 金  4月 14 - 23:05:33
wbel4-co:/usr/src # cd stable-colinux-20050524
 
<root> 金  4月 14 - 23:05:59
wbel4-co:/usr/src/stable-colinux-20050524 # tar xvfz ../stable-colinux-20050524.tar.gz
 
<root> 金  4月 14 - 23:10:40
wbel4-co:/usr/src/stable-colinux-20050524 # cd ../linux-2.6.11
 
<root> 金  4月 14 - 23:11:40
wbel4-co:/usr/src/linux-2.6.11 # patch -p1 < ../stable-colinux-20050524/patch/linux
 
<root> 金  4月 14 - 23:53:02
wbel4-co:/usr/src/linux-2.6.11 # cp ../stable-colinux-20050524/conf/linux-config .
 
<root> 金  4月 14 - 23:53:20
wbel4-co:/usr/src/linux-2.6.11 # make menuconfig

  coLinuxのconfigファイルを「Load an Alternate Configuration File」から読み込んでから、カーネルのコンパイル開始ッ!!

<root> 土  4月 15 - 00:03:17
wbel4-co:/usr/src/linux-2.6.11 # make

  コンパイル完了ッ!! できたvmlinuxをWindows環境に持ってきて、coLinux起動ッ!!

<mitsu> Sat Apr 15 - 00:49:02
SUZAKU:/cygdrive/c/Program Files/coLinux $ ./colinux-daemon.exe -c wbel3.colinux.xml
 
colinux: error, expected gcc version 3.3.x, got 3.4.x
error initializing
daemon: exit code 88668014
daemon: error - CO_RC_ERROR_COMPILER_MISMATCHED, line 416, file colinux/user/daemon.o (67)

  わーっ!! gccの3.3を使うのを忘れとったぁ……オレはアホかッ!?

<root> 土  4月 15 - 00:50:11
wbel4-co:/usr/src/linux-2.6.11 # make clean
 
<root> 土  4月 15 - 00:50:43
wbel4-co:/usr/src/linux-2.6.11 # make CC=/usr/local/gcc33/bin/gcc

  今度こそ。

<mitsu> Sat Apr 15 - 01:17:22
SUZAKU:/cygdrive/c/Program Files/coLinux $ ./colinux-daemon.exe -c wbel3.colinux.xml

  よっしゃーッ!! 起動成功ッ!!

<mitsu> Sat Apr 15 - 01:19:11
SUZAKU:/cygdrive/c/Program Files/coLinux $ ssh wbel3-co -l mitsu
 
<mitsu> 土  4月 15 - 01:19:17
wbel3-co:/home/mitsu $ uname -a
Linux wbel3-co 2.6.11 #2 Sat Apr 15 01:14:09 JST 2006 i686 i686 i386 GNU/Linux

  確かに新しいカーネルで動いているようである。

  ただし、これだけではナニもうれしくはない。今回はコンパイルが可能かどうかの試験のため、デフォルトのcoLinuxのカーネルコンフィグを使ったが、ココで適切なコンフィグができるトコロに再コンパイルのおいしさがあるのである。と、いうわけで、それはまた後日。では。