|
|
当サイトは、玄箱PRO (KURO-BOX/Pro)を中心とした組み込み、Linuxと電子工作を扱っています。
会社案内
情報セキュリティおよび個人情報の取り扱いについて コメントとトラックバックは、spamを予防するために、編集担当が公開の作業をするまで非公開になっています。コメントはそれぞれ投稿した人のものです。 |
apt-get install dpkg-dev fakeroot以下のようになりました。
tar をコンパイルするのに必要なファイルをインストールします。kurobox@kurobox:~$ su Password: kurobox:/home/kurobox# apt-get install dpkg-dev fakeroot Reading package lists... Done Building dependency tree... Done The following extra packages will be installed: perl perl-modules Suggested packages: debian-keyring libterm-readline-gnu-perl libterm-readline-perl-perl Recommended packages: bzip2 perl-doc The following NEW packages will be installed: dpkg-dev fakeroot perl perl-modules 0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded. Need to get 5972kB of archives. After unpacking 25.0MB of additional disk space will be used. Do you want to continue [Y/n]? Get:1 http://ftp.jp.debian.org etch/main perl-modules 5.8.8-7 [2310kB] Get:2 http://ftp.jp.debian.org etch/main perl 5.8.8-7 [3413kB] Get:3 http://ftp.jp.debian.org etch/main dpkg-dev 1.13.25 [166kB] Get:4 http://ftp.jp.debian.org etch/main fakeroot 1.5.10 [83.8kB] Fetched 5972kB in 5s (1138kB/s) Selecting previously deselected package perl-modules. (Reading database ... 9800 files and directories currently installed.) Unpacking perl-modules (from .../perl-modules_5.8.8-7_all.deb) ... Selecting previously deselected package perl. Unpacking perl (from .../archives/perl_5.8.8-7_arm.deb) ... Selecting previously deselected package dpkg-dev. Unpacking dpkg-dev (from .../dpkg-dev_1.13.25_all.deb) ... Selecting previously deselected package fakeroot. Unpacking fakeroot (from .../fakeroot_1.5.10_arm.deb) ... Setting up fakeroot (1.5.10) ... Setting up perl-modules (5.8.8-7) ... Setting up perl (5.8.8-7) ... Setting up dpkg-dev (1.13.25) ... kurobox:/home/kurobox#
apt-get build-dep tar以下のようになります。
kurobox:/home/kurobox/# apt-get build-dep tar Reading package lists... Done Building dependency tree... Done The following NEW packages will be installed: autoconf autotools-dev build-essential debhelper file g++ g++-4.1 gettext gettext-base html2text intltool-debian libmagic1 libstdc++6-4.1-dev m4 po-debconf 0 upgraded, 15 newly installed, 0 to remove and 0 not upgraded. Need to get 7468kB of archives. After unpacking 25.4MB of additional disk space will be used. Do you want to continue [Y/n]? Get:1 http://ftp.jp.debian.org etch/main libmagic1 4.17-5etch1 [274kB] Get:2 http://ftp.jp.debian.org etch/main file 4.17-5etch1 [31.7kB] Get:3 http://ftp.jp.debian.org etch/main gettext-base 0.16.1-1 [121kB] Get:4 http://ftp.jp.debian.org etch/main m4 1.4.8-2 [178kB] Get:5 http://ftp.jp.debian.org etch/main autoconf 2.61-4 [448kB] Get:6 http://ftp.jp.debian.org etch/main autotools-dev 20060702.1 [60.6kB]
-----------------------------------(省略)---------------------------
ここからの作業は、root の必要はありません。まず、tar を作成する作業用ディレクトリを作り、移動します。Setting up m4 (1.4.8-2) ... Setting up autoconf (2.61-4) ... Setting up autotools-dev (20060702.1) ... Setting up html2text (1.3.2a-3) ... Setting up gettext (0.16.1-1) ... Setting up intltool-debian (0.35.0+20060710.1) ... Setting up po-debconf (1.0.8) ... Setting up debhelper (5.0.42) ... Setting up libstdc++6-4.1-dev (4.1.1-21) ... Setting up g++-4.1 (4.1.1-21) ... Setting up g++ (4.1.1-15) ... Setting up build-essential (11.3) ... kurobox:/home/kurobox/#
mkdir work-tar cd work-tarソース・ファイルを入手します。
apt-get source tar以下のようになりました。
ディレクトリを移動し、コンパイルします。kurobox@kurobox:~/work-tar$ apt-get source tar Reading package lists... Done Building dependency tree... Done Need to get 2231kB of source archives. Get:1 http://ftp.jp.debian.org etch/main tar 1.16-2 (dsc) [569B] Get:2 http://ftp.jp.debian.org etch/main tar 1.16-2 (tar) [2200kB] Get:3 http://ftp.jp.debian.org etch/main tar 1.16-2 (diff) [30.5kB] Fetched 2231kB in 1s (1209kB/s) gpg: can't open `/gnupg/options.skel': No such file or directory gpg: Signature made Sat Dec 2 01:41:31 2006 JST using DSA key ID F2CF01A8 gpg: Can't check signature: public key not found dpkg-source: extracting tar in tar-1.16 dpkg-source: unpacking tar_1.16.orig.tar.gz dpkg-source: applying ./tar_1.16-2.diff.gz kurobox@kurobox:~/work-tar$
cd tar-1.16 dpkg-buildpackage -rfakeroot -us -uc以下のようになりました。
-----------------------------------(省略)---------------------------kurobox@kurobox:~/work-tar$ cd tar-1.16/ kurobox@kurobox:~/work-tar/tar-1.16$ dpkg-buildpackage -rfakeroot -us -uc dpkg-buildpackage: source package is tar dpkg-buildpackage: source version is 1.16-2 dpkg-buildpackage: source changed by Bdale Garbee <bdale@gag.com> dpkg-buildpackage: host architecture arm dpkg-buildpackage: source version without epoch 1.16-2 fakeroot debian/rules clean dh_testdir dh_testroot rm -f build-stamp configure-stamp /usr/bin/make distclean make[1]: Entering directory `/home/kurobox/work-tar/tar-1.16'
src ディレクトリに移動し、dh_compress dh_fixperms dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb dpkg-deb: building package `tar' in `../tar_1.16-2_arm.deb'. dpkg-genchanges dpkg-genchanges: not including original source code in upload dpkg-buildpackage: binary and diff upload (original source NOT included) kurobox@kurobox:~/work-tar/tar-1.16$
cd srcMakefile を編集し、LDFLAGS を -static にします。
INTLLIBS = INTL_MACOSX_LIBS = INTTYPES_H = inttypes.h LDFLAGS = -static LIBICONV = LIBINTL =一度 tar を消し、再度 tar を生成します。最後に strip で実行時に不要なシンボルや関数を削除し、ファイル・サイズを小さくします。
rm tar make strip tar実行すると以下のようになりました。
これで、スタティック・リンクの tar ができました。kurobox:/home/kurobox/work-tar/tar-1.16/src# rm tar kurobox:/home/kurobox/work-tar/tar-1.16/src# make gcc -O2 -g -Wall -static -o tar buffer.o compare.o create.o delete.o extract.o xheader.o incremen.o list.o mangle.o misc.o names.o sparse.o system.o tar.o transform.o update.o utf8.o ../lib/libtar.a -lrt names.o: In function `gid_to_gname': /home/kurobox/work-tar/tar-1.16/src/names.c:105: warning: Using 'getgrgid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking names.o: In function `gname_to_gid': /home/kurobox/work-tar/tar-1.16/src/names.c:165: warning: Using 'getgrnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking names.o: In function `uname_to_uid': /home/kurobox/work-tar/tar-1.16/src/names.c:135: warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking names.o: In function `uid_to_uname': /home/kurobox/work-tar/tar-1.16/src/names.c:75: warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking kurobox:/home/kurobox/work-tar/tar-1.16/src# strip tar kurobox:/home/kurobox/work-tar/tar-1.16/src#
このブログ記事を参照しているブログ一覧: スタティック・リンクの tar の作成
このブログ記事に対するトラックバックURL: http://www.eleki-jack.com/mt/mt-tb.cgi/940
おすすめ書籍 |
![]() |
コメントする