読者です 読者をやめる 読者になる 読者になる

IT練習ノート

IT関連で調べたこと(実際は嵌ったこと)を書いています。

coreutilインストールの練習

coreutilインストール作業ログ

パッケージマネージャの更新 

mytest:/home/ubuntu# apt-get update 

gitのインストール

mytest:/home/ubuntu# git

The program 'git' is currently not installed.  You can install it by typing:

apt-get install git

 

mytest:/home/ubuntu# apt-get install git

Reading package lists... Done

Building dependency tree       

 

Unpacking git (from .../git_1%3a1.7.9.5-1_amd64.deb) ...

Processing triggers for man-db ...

Setting up liberror-perl (0.17-1) ...

Setting up git-man (1:1.7.9.5-1) ...

Setting up git (1:1.7.9.5-1) ...

 

mytest:/home/ubuntu# mkdir ls

mytest:/home/ubuntu# cd ls

gitリポジトリよりcoreutil取得

mytest:/home/ubuntu/ls# git clone git://git.sv.gnu.org/coreutils

Cloning into 'coreutils'...

remote: Counting objects: 162022, done.

remote: Compressing objects: 100% (39099/39099), done.

remote: Total 162022 (delta 122675), reused 161888 (delta 122587)

Receiving objects: 100% (162022/162022), 29.72 MiB | 727 KiB/s, done.

Resolving deltas: 100% (122675/122675), done.

確認をします。

mytest:/home/ubuntu/ls# ls

coreutils

mytest:/home/ubuntu/ls# cd coreutils/

mytest:/home/ubuntu/ls/coreutils# git branch

* master

mytest:/home/ubuntu/ls/coreutils# ls -la

total 1308

drwxr-xr-x 16 root root   4096 Apr 29 10:26 .

drwxr-xr-x  3 root root   4096 Apr 29 10:25 ..

-rw-r--r--  1 root root   3669 Apr 29 10:26 AUTHORS

-rwxr-xr-x  1 root root  30661 Apr 29 10:26 bootstrap

-rw-r--r--  1 root root   6828 Apr 29 10:26 bootstrap.conf

drwxr-xr-x  2 root root   4096 Apr 29 10:26 build-aux

-rw-r--r--  1 root root  26078 Apr 29 10:26 cfg.mk

-rw-r--r--  1 root root 448857 Apr 29 10:26 ChangeLog-2005

-rw-r--r--  1 root root 153389 Apr 29 10:26 ChangeLog-2006

-rw-r--r--  1 root root 158644 Apr 29 10:26 ChangeLog-2007

-rw-r--r--  1 root root  13716 Apr 29 10:26 ChangeLog-2008

-rw-r--r--  1 root root  18128 Apr 29 10:26 configure.ac

-rw-r--r--  1 root root  35147 Apr 29 10:26 COPYING

-rw-r--r--  1 root root   4353 Apr 29 10:26 dist-check.mk

drwxr-xr-x  2 root root   4096 Apr 29 10:26 doc

drwxr-xr-x  8 root root   4096 Apr 29 10:26 .git

-rw-r--r--  1 root root    309 Apr 29 10:26 .gitattributes

-rw-r--r--  1 root root   2729 Apr 29 10:26 .gitignore

-rw-r--r--  1 root root     89 Apr 29 10:26 .gitmodules

drwxr-xr-x  5 root root   4096 Apr 29 10:26 gl

drwxr-xr-x  2 root root   4096 Apr 29 10:26 gnulib

drwxr-xr-x  2 root root   4096 Apr 29 10:26 gnulib-tests

-rw-r--r--  1 root root  24005 Apr 29 10:26 HACKING

-rw-r--r--  1 root root  18793 Apr 29 10:26 init.cfg

drwxr-xr-x  2 root root   4096 Apr 29 10:26 lib

drwxr-xr-x  2 root root   4096 Apr 29 10:26 m4

-rw-r--r--  1 root root   1514 Apr 29 10:26 .mailmap

-rw-r--r--  1 root root   6437 Apr 29 10:26 Makefile.am

drwxr-xr-x  2 root root   4096 Apr 29 10:26 man

-rw-r--r--  1 root root 173040 Apr 29 10:26 NEWS

drwxr-xr-x  5 root root   4096 Apr 29 10:26 old

drwxr-xr-x  2 root root   4096 Apr 29 10:26 po

-rw-r--r--  1 root root      5 Apr 29 10:26 .prev-version

-rw-r--r--  1 root root  11242 Apr 29 10:26 README

-rw-r--r--  1 root root   4059 Apr 29 10:26 README-hacking

-rw-r--r--  1 root root    864 Apr 29 10:26 README-package-renamed-to-coreutils

-rw-r--r--  1 root root   2232 Apr 29 10:26 README-prereq

-rw-r--r--  1 root root   4461 Apr 29 10:26 README-release

-rw-r--r--  1 root root   1834 Apr 29 10:26 README-valgrind

drwxr-xr-x  3 root root   4096 Apr 29 10:26 scripts

drwxr-xr-x  2 root root   4096 Apr 29 10:26 src

drwxr-xr-x 25 root root   4096 Apr 29 10:26 tests

-rwxr-xr-x  1 root root    441 Apr 29 10:26 thanks-gen

-rw-r--r--  1 root root  37878 Apr 29 10:26 THANKS.in

-rw-r--r--  1 root root    121 Apr 29 10:26 THANKStt.in

-rw-r--r--  1 root root   6972 Apr 29 10:26 TODO

-rw-r--r--  1 root root   1981 Apr 29 10:26 .vg-suppressions

-rw-r--r--  1 root root     46 Apr 29 10:26 .x-update-copyright

ブートストラップをします。

mytest:/home/ubuntu/ls/coreutils# ./bootstrap 

./bootstrap: Error: 'autoconf' not found

./bootstrap: Error: 'automake' not found

./bootstrap: Error: 'autopoint' not found

./bootstrap: Error: 'bison' not found

./bootstrap: Error: 'gperf' not found

./bootstrap: Error: 'makeinfo' not found

./bootstrap: See README-prereq for how to get the prerequisite programs

必要なモジュールがありませんでした。それらをインストールします。

mytest:/home/ubuntu# apt-get install autoconf

mytest:/home/ubuntu# apt-get install automake

mytest:/home/ubuntu# apt-get install autopoint

mytest:/home/ubuntu# apt-get install bison

mytest:/home/ubuntu# apt-get install gperf

mytest:/home/ubuntu# apt-get install makeinfo

Reading package lists... Done

Building dependency tree       

Reading state information... Done

E: Unable to locate package makeinfo

makeinfoがエラーとなってしまいました。makeinfoではなくtexinfoのようです(textinfoではありません)。

mytest:/home/ubuntu# apt-get install texinfo

Reading package lists... Done

Building dependency tree       

ブートストラップを再度行います。

mytest:/home/ubuntu/ls/coreutils# ./bootstrap 

./bootstrap: Bootstrapping from checked-out coreutils sources...

./bootstrap: consider installing git-merge-changelog from gnulib

途中省略

./bootstrap: ln -fs ../gnulib/build-aux/install-sh build-aux/install-sh

./bootstrap: ln -fs ../gnulib/build-aux/mdate-sh build-aux/mdate-sh

./bootstrap: ln -fs ../gnulib/build-aux/texinfo.tex build-aux/texinfo.tex

./bootstrap: ln -fs ../gnulib/build-aux/depcomp build-aux/depcomp

./bootstrap: ln -fs ../gnulib/build-aux/config.guess build-aux/config.guess

./bootstrap: ln -fs ../gnulib/build-aux/config.sub build-aux/config.subA

./bootstrap: ln -fs gnulib/doc/INSTALL INSTALL

./bootstrap: Creating po/Makevars from po/Makevars.template ...

cmp: .git/hooks/applypatch-msg: No such file or directory

cmp: .git/hooks/commit-msg: No such file or directory

cmp: .git/hooks/pre-applypatch: No such file or directory

cmp: .git/hooks/pre-commit: No such file or directory

./bootstrap: done.  Now you can run './configure'.

構成を実行します。

mytest:/home/ubuntu/ls/coreutils# ./configure --prefix=../build

configure: error: expected an absolute directory name for --prefix: ../build

パスが相対パスのため失敗しました。絶対パス指定で再度構成を実行します。

mytest:/home/ubuntu/ls/coreutils# pwd

/home/ubuntu/ls/coreutils

mytest:/home/ubuntu/ls/coreutils# ./configure --prefix=/home/ubuntu/ls/build

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes

checking for a thread-safe mkdir -p... /bin/mkdir -p

checking for gawk... no

checking for mawk... mawk

checking whether make sets $(MAKE)... no

checking whether make supports nested variables... no

checking for style of include used by make... none

checking for gcc... no

checking for cc... no

checking for cl.exe... no

configure: error: in `/home/ubuntu/ls/coreutils':

configure: error: no acceptable C compiler found in $PATH

See `config.log' for more details

cコンパイラがなかったようです。cコンパイラをインストールします。

mytest:/home/ubuntu# apt-get install gcc

Reading package lists... Done

Building dependency tree       

Reading state information... Done

The following extra packages will be installed:

構成を再度実行します。

mytest:/home/ubuntu/ls/coreutils# ./configure --prefix=/home/ubuntu/ls/build

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes

途中省略

checking whether mkfifo rejects trailing slashes... yes

checking whether mknod can create fifo without root privileges... configure: error: in `/home/ubuntu/ls/coreutils':

configure: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)

See `config.log' for more details

パラメータが必要であると警告メッセージが出ます。rootで構成するなっていう意味が分からないですが、指示に従い、パラメータ付きでインストールします。

mytest:/home/ubuntu/ls/coreutils# ./configure --prefix=/home/ubuntu/ls/build FORCE_UNSAFE_CONFIGURE=1

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes

checking for a thread-safe mkdir -p... /bin/mkdir -p

checking for gawk... no

checking for mawk... mawk

checking whether make sets $(MAKE)... no

checking whether make supports nested variables... no

checking for style of include used by make... none

checking for gcc... gcc

checking whether the C compiler works... yes

checking for C compiler default output file name... a.out

checking for suffix of executables... 

途中省略

checking where the gettext function comes from... libc

checking for a traditional french locale... (cached) none

configure: creating ./config.status

config.status: creating Makefile

config.status: creating po/Makefile.in

config.status: creating gnulib-tests/Makefile

config.status: creating lib/config.h

config.status: executing depfiles commands

config.status: executing po-directories commands

config.status: creating po/POTFILES

config.status: creating po/Makefile

これで成功のようです。makeをインストールしていないことに気づき、慌ててインストールしました。

mytest:/home/ubuntu# sudo apt-get install build-essential

Reading package lists... Done

Building dependency tree       

Reading state information... Done

The following extra packages will be installed:

構成でgwakがnoだったので、念のためインストールしました。多分関係ないと思いますが。

mytest:/home/ubuntu# apt-get install gawk

Reading package lists... Done

Building dependency tree       

makeをします。

mytest:/home/ubuntu/ls/coreutils# make CFLAGS='-g'

  GEN    .version

  GEN    lib/alloca.h

  GEN    lib/c++defs.h

  GEN    lib/warn-on-use.h

  GEN    lib/arg-nonnull.h

  GEN    lib/arpa/inet.h

途中省略

make[3]: Entering directory `/home/ubuntu/ls/coreutils/gnulib-tests'

Making all in .

make[4]: Entering directory `/home/ubuntu/ls/coreutils/gnulib-tests'

make[4]: Nothing to be done for `all-am'.

make[4]: Leaving directory `/home/ubuntu/ls/coreutils/gnulib-tests'

make[3]: Leaving directory `/home/ubuntu/ls/coreutils/gnulib-tests'

make[2]: Leaving directory `/home/ubuntu/ls/coreutils/gnulib-tests'

make[1]: Leaving directory `/home/ubuntu/ls/coreutils'

これで成功したのかよくわかりませんでした。実際にインストール場所を確認したところ存在していませんでした。

mytest:/home/ubuntu/ls/coreutils# ls ../

coreutils

存在していないので、いろいろWeb検索で問題を探りました。なんでそうしたかは忘れましたが、どうもgettextがないらしいという情報があったのでインストールしました。

情報元のURLは失念してしまいました。。

 

mytest:/home/ubuntu# apt-get install gettext

Reading package lists... Done

Building dependency tree       

Reading state information... Done

ブートストラップでこのようなログがあったのでこれがあやしいかなとかとも思いました。(結局関係ありませんでしたが)

Notice from module error:

  If you are using GNU gettext version 0.16.1 or older, add the following options

  to XGETTEXT_OPTIONS in your po/Makevars:

    --flag=error:3:c-format --flag=error_at_line:5:c-format

Notice from module localcharset:

  If your package's tests make use of the locale_charset() function directly or

  indirectly, you may need to define the CHARSETALIASDIR environment variable,

  so that "make check" works before "make install". In Makefile.am syntax:

  TESTS_ENVIRONMENT += @LOCALCHARSET_TESTS_ENVIRONMENT@

Notice from module propername:

  If you are using GNU gettext version 0.16.1 or older, add the following options

  to XGETTEXT_OPTIONS in your po/Makevars:

    --keyword='proper_name:1,"This is a proper name. See the gettext manual, section Names."'

    --keyword='proper_name_utf8:1,"This is a proper name. See the gettext manual, section Names."'

Notice from module strpbrk:

  This module is obsolete.

Notice from module vasprintf:

  If you are using GNU gettext version 0.16.1 or older, add the following options

  to XGETTEXT_OPTIONS in your po/Makevars:

    --flag=asprintf:2:c-format --flag=vasprintf:2:c-format

Notice from module verror:

  If you are using GNU gettext version 0.16.1 or older, add the following options

  to XGETTEXT_OPTIONS in your po/Makevars:

    --flag=verror:3:c-format --flag=verror_at_line:5:c-format

Notice from module xprintf:

  If you are using GNU gettext version 0.16.1 or older, add the following options

  to XGETTEXT_OPTIONS in your po/Makevars:

    --flag=xprintf:1:c-format --flag=xvprintf:1:c-format

    --flag=xfprintf:2:c-format --flag=xvfprintf:2:c-format

Notice from module xvasprintf:

  If you are using GNU gettext version 0.16.1 or older, add the following options

  to XGETTEXT_OPTIONS in your po/Makevars: --flag=xasprintf:1:c-format

こんなログとか怪しいかなぁと。(多分関係ないですが)

Don't forget to

  - "include gnulib.mk" from within "lib/Makefile.am",

  - "include gnulib.mk" from within "gnulib-tests/Makefile.am",

  - mention "-I m4" in ACLOCAL_AMFLAGS in Makefile.am,

  - mention "m4/gnulib-cache.m4" in EXTRA_DIST in Makefile.am,

  - invoke gl_EARLY in ./configure.ac, right after AC_PROG_CC_STDC,

  - invoke gl_INIT in ./configure.ac.

prefix=lib/

running: AUTOPOINT=true LIBTOOLIZE=true autoreconf --verbose --install --force -I m4  --no-recursive

autoreconf: Entering directory `.'

構成のこんなログとか。(結局関係ありませんでしたが)

make  all-recursive

make[1]: Entering directory `/home/ubuntu/ls/coreutils'

Making all in po

make[2]: Entering directory `/home/ubuntu/ls/coreutils/po'

make coreutils.pot-update

make[3]: Entering directory `/home/ubuntu/ls/coreutils/po'

何度か、ブートストラップ、構成、メイクを繰り返した後。そういえば、make install してなかったことに気づき。とりあえずしてみました。

mytest:/home/ubuntu/ls/coreutils# make install

make  install-recursive

make[1]: Entering directory `/home/ubuntu/ls/coreutils'

Making install in po

make[2]: Entering directory `/home/ubuntu/ls/coreutils/po'

installing af.gmo as /home/ubuntu/ls/build/share/locale/af/LC_MESSAGES/coreutils.mo

installing af.gmo link as /home/ubuntu/ls/build/share/locale/af/LC_TIME/coreutils.mo

installing be.gmo as /home/ubuntu/ls/build/share/locale/be/LC_MESSAGES/coreutils.mo

途中省略

make[4]: Entering directory `/home/ubuntu/ls/coreutils/gnulib-tests'

make[5]: Entering directory `/home/ubuntu/ls/coreutils/gnulib-tests'

test -z "/home/ubuntu/ls/build/bin" || /bin/mkdir -p "/home/ubuntu/ls/build/bin"

test -z "/home/ubuntu/ls/build/libexec/coreutils" || /bin/mkdir -p "/home/ubuntu/ls/build/libexec/coreutils"

test -z "/home/ubuntu/ls/build/share/man/man1" || /bin/mkdir -p "/home/ubuntu/ls/build/share/man/man1"

make[5]: Leaving directory `/home/ubuntu/ls/coreutils/gnulib-tests'

make[4]: Leaving directory `/home/ubuntu/ls/coreutils/gnulib-tests'

make[3]: Leaving directory `/home/ubuntu/ls/coreutils/gnulib-tests'

make[2]: Leaving directory `/home/ubuntu/ls/coreutils/gnulib-tests'

make[1]: Leaving directory `/home/ubuntu/ls/coreutils'

そうしたところ成功していました。

mytest:/home/ubuntu/ls/coreutils# ls ../

build  coreutils

確かに今ビルドしたlsがありました。

mytest:/home/ubuntu/ls/coreutils# ls -al ../build/bin/ls

-rwxr-xr-x 1 root root 325533 Apr 29 12:45 ../build/bin/ls

mytest:/home/ubuntu/ls/coreutils# ../build/bin/ls 

ABOUT-NLSbootstrap.confChangeLog-2006configure      gl     init.cfg  Makefile     old README-prereq  tests

aclocal.m4build-auxChangeLog-2007configure.ac   gnulib     INSTALL   Makefile.am  po README-release   thanks-gen

AUTHORScfg.mkChangeLog-2008COPYING        gnulib-tests  lib       Makefile.in  README README-valgrind  THANKS.in

autom4te.cacheChangeLogconfig.logdist-check.mk  GNUmakefile   m4        man    README-hacking scripts  THANKStt.in

bootstrapChangeLog-2005config.statusdoc       HACKING     maint.mk  NEWS    README-package-renamed-to-coreutils  src  TODO

 

 

いろいろ寄り道しましたが、なんとかできたようです。

ただ、なんでbootstrapのときにgettextがないってログを出してくれないんでしょうかね。