2007年4月16日月曜日

emdebian Quick Start

http://wiki.debian.org/EmdebianQuickStart

/etc/apt/source.list
deb http://www.emdebian.org/debian/ unstable main
を追加

エラー
Creating config file /etc/emsource.conf with new version
Unable to determine apt-cache policy for Debian main! at /var/lib/dpkg/info/emdebian-tools.postinst line 131.
dpkg: error processing emdebian-tools (--configure):
subprocess post-installation script returned error exit status 255
Errors were encountered while processing:
emdebian-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

ファイルは
~# cat /etc/emsource.conf
# config file for emsource, part of emdebian-tools.
# /etc/emsource.conf is maintained by debconf.
# see emsource (1) for more information
#
username:
workingdir:
aptagent: true


/var/lib/dpkg/info/emdebian-tools.postinstを修正
122行目
修正前
&& /^\s+release o=Debian,a=(\w+),l=Debian,c=main\s*$/)
修正後
&& /^\s+release v=.+,o=Debian,a=(\w+),l=Debian,c=main\s*$/)

sony:~# dpkg-reconfigure --force emdebian-tools #全部 Enter だけ

Creating config file /etc/apt/sources.list.d/emdebian.sources.list with new version

/etc/emsource.confは上記のとおり変わらない

/etc/apt/sources.list.d/emdebian.sources.listの内容
# The Emdebian toolchain repository
deb http://www.emdebian.org/debian/ stable main
deb-src http://www.emdebian.org/debian/ stable main
# Emdebian requires at least one primary mirror. Use this one
# OR add your preferred mirror to /etc/apt/sources.list
# and then use dpkg-reconfigure emdebian-tools
# See http://www.debian.org/mirror/list for a list of primary mirrors.
deb http://ftp.uk.debian.org/debian stable main
deb-src http://ftp.uk.debian.org/debian stable main

わけわからん
~$ emsetup --arch amd64 --verbose --simulate
Use of uninitialized value in string eq at /usr/share/perl5/dpkg-cross.pl line 226, line 59.
Use of uninitialized value in string eq at /usr/share/perl5/dpkg-cross.pl line 214, line 64.
Cannot open emdebian sources file. 許可がありません at /usr/bin/apt-cross line 384.
Dry run only.
Updating apt cache data ...
Cannot open emdebian sources file. 許可がありません at /usr/bin/apt-cross line 384.
Cannot find a native gcc for amd64.
Trying to locate latest version of gcc for i386.

Error: emsetup is unable to proceed - cannot find gcc for amd64!

きになるならdpkg-cross を1.33にしろ。気にしないで上記は無視 
$emsetup -a amd64 -v
Use of uninitialized value in string eq at /usr/share/perl5/dpkg-cross.pl line 226, line 59.
Use of uninitialized value in string eq at /usr/share/perl5/dpkg-cross.pl line 214, line 64.
Unable to find a suitable toolchain to build 'amd64' targets on 'i386'.
Please consider using emchain to build your own toolchain.
If you do not wish to use the emdebian toolchain repository or if a toolchain
for your chosen target architecture is not yet available for your host architecture,
please consider using emchain (part of emdebian-tools) to build a cross-building
toolchain that fits your needs.

Packages required for 'amd64' on 'i386':
binutils-x86_64-linux-gnu gcc-4.1-x86_64-linux-gnu gcc-4.1-x86_64-linux-gnu-base gcc-4.1-x86_64-linux-gnu cpp-4.1-x86_64-linux-gnu g++-4.1-x86_64-linux-gnu libc6-amd64-cross libc6-dev-amd64-cross libstdc++6-amd64-cross libstdc++6-4.1-dev-amd64-cross libstdc++6-4.1-dbg-amd64-cross libstdc++6-4.1-pic-amd64-cross libgcc1-amd64-cross linux-kernel-headers-amd64-cross

Once a suitable toolchain can be installed, setup will be complete.
Use 'emsetup --report' to check just the toolchain.

なんか真っ当そう

emsetup --reportを実行してみる
~$ emsetup --report -a amd64
Use of uninitialized value in string eq at /usr/share/perl5/dpkg-cross.pl line 226, line 59.
Use of uninitialized value in string eq at /usr/share/perl5/dpkg-cross.pl line 214, line 64.
Updating apt cache data ...
Unable to find a toolchain suitable for Emdebian on amd64.
Searched for:
binutils-x86_64-linux-gnu
gcc-4.1-x86_64-linux-gnu
gcc-4.1-x86_64-linux-gnu-base
gcc-4.1-x86_64-linux-gnu
cpp-4.1-x86_64-linux-gnu
g++-4.1-x86_64-linux-gnu
libc6-amd64-cross
libc6-dev-amd64-cross
libstdc++6-amd64-cross
libstdc++6-4.1-dev-amd64-cross
libstdc++6-4.1-dbg-amd64-cross
libstdc++6-4.1-pic-amd64-cross
libgcc1-amd64-cross
linux-kernel-headers-amd64-cross

gcc-4.1-x86_64-linux-gnu がダブってて不安

/etc/emsource.confのワーキングディレクトリを設定して、
ディレクトリにユーザーが書き込めるようにしておく。


$ sudo chmod 644 /etc/emsource.conf
$ sudo chmod 644 /etc/apt/source.list.d/emdebian.sources.list
$ sudo apt-get update

~$ emsource -a amd64 -v binutils
Use of uninitialized value in string eq at /usr/share/perl5/dpkg-cross.pl line 226, line 59.
Use of uninitialized value in string eq at /usr/share/perl5/dpkg-cross.pl line 214, line 64.
Using binutils 2.17-3
Working directory: '/var/src/work'
Checking for existing emdebian patches
リビジョン 965 をチェックアウトしました。
リビジョン 965 をチェックアウトしました。
Checking for existing build tree in binutils-2.17.
No unpacked source directory, updating Debian source
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています... 完了
18.2MB のソースアーカイブを取得する必要があります。
取得:1 http://ring.asahi-net.or.jp etch/main binutils 2.17-3 (dsc) [1474B]
取得:2 http://ring.asahi-net.or.jp etch/main binutils 2.17-3 (tar) [18.2MB]
取得:3 http://ring.asahi-net.or.jp etch/main binutils 2.17-3 (diff) [42.4kB]
18.2MB を 14s で取得しました (1285kB/s)
gpg: failed to create temporary file `/home/kitakura/.gnupg/.#lk0x8116a70.sony.20402': 許可がありません
gpg: keyblock resource `/home/kitakura/.gnupg/pubring.gpg': general error
gpg: Signature made 2006年10月03日 09時39分02秒 JST using RSA key ID AB2A91F5
gpg: Can't check signature: public key not found
dpkg-source: extracting binutils in binutils-2.17
dpkg-source: unpacking binutils_2.17.orig.tar.gz
dpkg-source: applying ./binutils_2.17-3.diff.gz
Emdebianising source tree
Use of uninitialized value in string eq at /usr/share/perl5/dpkg-cross.pl line 226, line 59.
Use of uninitialized value in string eq at /usr/share/perl5/dpkg-cross.pl line 214, line 64.
Unable to locate the cross-building toolchain, please run emsetup.

Emdebianised source tree for 'binutils' exists at '/var/src/work/trunk/b/binutils/trunk/binutils-2.17'
Change to this directory before running 'emdebuild'

$ cd /var/src/work/trunk/b/binutils/trunk/binutils-2.17
$ sudo apt-get build-dep binutils
$ emdebuild -a amd64 -v

ここでエラー
gcc -DHAVE_CONFIG_H -I. -I../../bfd -I. -I. -I../../bfd -I../../bfd/../include -I../../bfd/../intl -I../intl -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../bfd/libbfd.c -fPIC -DPIC -o .libs/libbfd.o
2度目はここ
gcc -DHAVE_CONFIG_H -I. -I../../bfd -I. -I. -I../../bfd -I../../bfd/../include -I../../bfd/../intl -I../intl -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../bfd/bfdwin.c -o bfdwin.o >/dev/null 2>&1

2007年4月15日日曜日

pentium-builder

http://debian.fam.cx/?AptGet
から引用
Debian では i586 や i686 などに最適化されたパッケージは提供されないの? † Edit
kernel-image や glibc などの一部を除いて本家では提供される予定はありません。自分で rebuild しましょう。 pentium-builder をインストールして

$ export DEBIAN_BUILDARCH=i586

などとしておけばパッケージングするときに -mcpu=i586 -march=i586 でコンパイルしてくれます。こうしてできあがったパッケージは hogehoge_i386.deb ですが、ちゃんと i586 に最適化されています。また ix86 だけでなく DEBIAN_BUILDARCH=athlon なども指定できます。大量に rebuild したい場合は apt-build や apt-src などを使うと便利です。ソースをダウンロード、パッケージング、インストールという一連の作業を自動でやってくれます。また ccache や distcc などをうまく使えばコンパイル時間も短縮できます。

参考
http://julien.danjou.info/article-apt-build.html


/usr/bin/gcc が builder-ccにリンクされる。
もとの gccが gcc.realにリンクされ直す。
builder-ccは DEBIAN_BUILDGCCVERが指定されていなければ、gcc.real を呼び出すので、ccacheやccontrolを使用しているときは
gcc.realのリンクをccontrolやccacheにする。
$ export DEBIAN_BUILDARCH=i586
$ sudo apt-build update
$ sudo apt-get build-dep util-linux
$ sudo apt-build --build-only --noupdate install util-linux

再実行するときは
$ sudo apt-build --build-only --noupdate --rebuild --no-source install util-linux

だが、builder-ccはperlスクリプトでcc実行時に -mcpuや -mtuneを追加しているだけでもともと指定されているオプションを変更するわけではないので本当に大丈夫なのかわからない。
gcc が最初に指定された方を優先するのであればOKだが、どうなんだろうか。

emdebian toolchain

http://wiki.debian.org/EmdebianToolchain

次の2つは404だから古い
$ svn co http://www.emdebian.org/repos/tools/buildcross
$ svn co http://www.emdebian.org/repos/tools/emchain

2007年4月14日土曜日

Debianのvserver

ここを見れ
http://linux-vserver.org/Installation_on_Debian

2007年4月11日水曜日

apt-getやaptitudeでのsignature関連エラー

こんなエラー
gpg: Signature made 2006年12月11日 03時52分33秒 JST using DSA key ID 0F932C9C
gpg: Can't check signature: public key not found

自分のホームにpubkeyをいれておく
インストールとかはrootに必要
keyはエラーのときに表示される7桁のもの

$gpg --keyserver wwwkeys.eu.pgp.net --recv-keys 0F932C9C

でこれで ~/.gnupgの下のファイルが更新される

2007年4月10日火曜日

ccontorol

Etch Debian 4.0 release
ということで開発環境を思いっきり再構築

distccとccacheを使うのだが、ccontrolをいれてみる

$ccontrol-init
Looking for C compiler.../usr/bin/cc...which is a link to /usr/bin/gcc-4.1
Looking for C++ compiler...None found! Giving up.

cppはあるけどc++がないので
cppから無理矢理リンクを作って再実行

$ ccontrol-init
Looking for C compiler.../usr/bin/cc...which is a link to /usr/bin/gcc-4.1
Looking for C++ compiler.../usr/bin/c++...which is a link to /usr/bin/cpp-4.1
Looking for linker...Found /usr/bin/ld
Looking for make...Found /usr/bin/make
Looking for distcc...Found /usr/bin/distcc
Looking for ccache...Found /usr/bin/ccache
Counting CPUs on this machine...found 1
Looking for distcc hosts...scanning network 192.168.176.0...

こいつ、かってにvmnet1のアドレスをつかった。eth0使ってくれ

~/.ccontrol/defaultの内容

[*]
cc = /usr/bin/gcc-4.1
c++ = /usr/bin/cpp-4.1
ld = /usr/bin/ld
make = /usr/bin/make
ccache = /usr/bin/ccache

distccがない.... 手動で編集して
distcc= /usr/bin/distcc
distcc-hosts= AAA BBB CCC localhost
cpus = 4
を追加

dpkg-buildpackage とか fakerootするためsshでトンネルさせられないので
/etc/defaults/distcc を編集して distcc-hostsに書いてある
dstccdのデーモンをあげておく。(sshは遅いからこちらのほうがいい)

/etc/defaults/distccは
localhost以外は
ALLOWEDNETS= とか LISTNER= を適切に設定

/usrbin/gccのリンクを変える
#/usr/bin
#ln -sf ccontrol gcc

あとは適宜?

$MAKEFLAGS=-j12 dpkg-buildpackage ....
とかすると動く
$distccmon-gnome &
を見てると状況がわかる。