Glibc 2 HOWTO <author>Eric Green, <tt/ejg3@cornell.edu/ <date>v1.5, 8 February 1998 <trans>岡本 一幸 Kazuyuki Okamoto, <tt/ikko-@pacific.rim.or.jp/ <newline> 遠藤俊徳 Toshinori Endo, <tt/tendo@nucleus.harvard.edu/ (v1.5から) <tdate>v1.5, 1998年9月15日 <abstract> GNU C ライブラリ (glibc参照) glibc Glibc 2 HOWTOはLinuxシステム上でのGNU C Library第2版 (libc 6)の インストールと使用について説明します。 </abstract> <toc> <!--<sect>Introduction.--> <sect>はじめに <p> <!--<sect1>About glibc 2.--> <sect1>glibc2について <p> <!--<quote>glibc!概観</quote>--> <!-- Glibc 2 is the latest version of the GNU C Library. It currently runs unmodified on GNU Hurd systems and Linux i386, m68k, and alpha systems. Support for Linux PowerPC, MIPS, Sparc, Sparc 64, and Arm will be in version 2.1. In the future support for other architectures and operating systems will be added. --> Glibc2はGNU Cライブラリの最新版です。現在、変更なしで動作するのは、 GNU HurdシステムとLinux i386, m68k, alphaシステムです。PowerPC, MIPS, Sparc, Sparc 64, Arm用のLinux向けには2.1版で対応の予定です。将来的には、 ほかのアーキテクチャーとオペレーティングシステム用にも順次対応の予定です。 <!-- On Linux, glibc 2 is used as the libc with major version 6, the successor of the Linux libc 5. It is intended by the Linux libc developers to eventually replace libc 5. As of 2.0.6, glibc is considered production quality. Version 2.1 (due out in the near future) will be ready for main stream use along with adding more ports and features. --> Linuxでは, glibc2 はLinux libc 5の後継、つまりlibcバージョン6 として用いられます。Linux libc開発者たちはlibc5を(glibc2で)置き換えて しまおうとしています。 2.0.6の段階で、glibcは十分な品質を持つと見なされています。バージョン2.1 (近い将来発表予定)は、より多くの機種へ移植され、新しい機能も追加 されて、中心的に用いられるようになるでしょう。 <!-- There are three optional add-ons available for glibc 2: <descrip> <tag/Crypt/The UFC-crypt package. It is seperate because of export restrictions. <tag/LinuxThreads/An implementation of the Posix 1003.1c &dquot;pthread&dquot; interface. <tag/Locale data/Contains the data needed to build the locale data files to use the internationalization features of the glibc. </descrip> --> glibc2には、下記の3つのアドオンを追加できます <descrip> <tag/Crypt/UFCの暗号化パッケージ。輸出規制のため、分離されている。 <tag/LinuxThreads/POSIX1003.1c pthreadインターフェースの実装。 <tag/Locale data/localeデータファイル構築に必要なデータを含む。 glibcの国際化機能を使用するときに使われる。 </descrip> <!-- The crypt and LinuxThreads add-ons are strongly recommended... not using them risks to be incompatible with the libraries of other systems. (If you do not wish to use them, you must add the option -disable-sanity-checks when you run configure.) --> cryptとLinuxThreadsのアドオンは追加することを強く薦めます。使わないと ほかのシステムと互換性に問題が生じる可能性があるからです。(使いたく ない場合は、configure実行時に--disable-sanity-checksオプションを指定する 必要があります)。 <!--<sect1>About this document.--> <sect1>この文書について <p> <!-- This HOWTO covers installing the glibc 2 library on an existing Linux system. It is tailored for users of Intel based systems currently using libc 5, but users of other systems and alternate libraries (such as glibc 1) should be able to use this information by substituting the proper filenames and architecture names in the appropriate places. --> このHOWTOは既存のLinuxシステムへのglibc2ライブラリのインストールに ついて記載されています。Intelベースのlibc5を使用したシステムのユーザ向け に書かれていますが、ほかのシステムやほかのライブラリ(glibc1など)を使用し ているユーザも、ファイル名やアーキテクチャ名を適当に置き換えることにより 記載された情報を使えるはずです。 <!--The latest copy of this HOWTO can be found as part of the--> このHOWTOの最新版はLinux Documentation Projectの一部として、下記の いずれかのサイトから入手可能です 。 <url url="http://sunsite.unc.edu/LDP" name="Linux Documentation Project"> <url url="http://www.imaxx.net/~thrytis/glibc/Glibc2-HOWTO.html">. <!--<sect1>Recent changes in this document.--> <sect1>この文書の最近の変更 <p> <!--Differences between version 1.5 and 1.4:--> バージョン1.5と1.4の違い <itemize> <item><!--Indexing added Ed Bailey.-->Ed Baileyによる索引の付加 <item><!--Changed my email address.-->著者のemailアドレスの変更 </itemize> <!--Differences between version 1.4 and 1.3:--> バージョン1.4と1.3の違い <itemize> <!--<item>Changed current status from experimental to production.--> <!--<item>Updated list of developmental ports.--> <!--<item>Updated latest version to 2.0.6.--> <item>現在の状況を実験段階から正式公開段階へ変更 <item>移植作業中システムのリストの更新 <item>最新バージョンを2.0.6へ更新 </itemize> <!--<sect>Choosing your installation method.--> <sect>インストール方法の選択 <p> <!--<quote>glibc!installing</quote>--> <!--<quote>glibc!インストール</quote>--> <!-- There are a few ways to install glibc. You can install the libraries as a test, using the existing libraries as the default but letting you try the new libraries by using different options when compiling your program. Installing in this way also makes it easy to remove glibc in the future (though any program linked with glibc will no longer work after the libraries are removed). Using glibc as a test library requires you to compile the libraries from source. There is no binary distribution for installing libraries this way. This installation is described in <ref id="test-install" name="Installing as a test library">. --> glibcをインストールするにはいくつかの方法があり、 既存のライブラリをデフォルトとして使用したまま、テスト用に glibc2をインストールすることもできます。この方法では、プログラムを コンパイルする際に、オプション指定によって新しいライブラリを使うことが できます。この方法を使えば、将来簡単にglibcを削除することができます (ただしglibcにリンクされたプログラムは、ライブラリを削除すると 動作しなくなります)。 このインストール方法は、バイナリディストリビューションは存在しないので、 ライブラリをソースからコンパイルする必要があります。インストール方法は <ref id="test-install" name="テストライブラリとしてのインストール"> で述べられています。 <!-- The other way described in this document to install is using glibc as your primary library. All new programs that you compile on your system will use glibc, though you can link programs with your old libraries using different options while compiling. You can either install the libraries from binaries, or compile the library yourself. If you want to change optimization or configuration options, or use an add-on which is not distributed as a binary package, you must get the source distribution and compile. This installation procedure is described in <ref id="primary-install" name="Installing as the primary C library">. --> この文書に記載されたもう一つのインストール方法は、glibcをメインライブラリ として使う場合です。この方法では、古いライブラリをリンクするようなオプション 指定をしない限り、新しくコンパイルされるプログラムは全てglibcを使う ようにリンクされます。この場合は、ライブラリをバイナリからインストール することも自分でコンパイルすることもできます。最適化のレベルや設定を 変更したい場合は、ソースディストリビューションを入手して、コンパイルする 必要があります。このインストール手順は <ref id="primary-install" name="メインのCライブラリとしてのインストール"> で述べられています。 <!-- Frodo Looijaard describes yet another way of installing glibc. His method involves installing glibc as a secondary library and setting up a cross compiler to compile using glibc. The installation procedure for this method is more complicated then the test library install described in this document, but allows for easier compiling when linking to glibc. This method is described in his <url url="http://huizen.dds.nl/~frodol/glibc/" name="Installing glibc-2 on Linux"> document. --> Frodo Looijaardは、独自のglibcのインストール方法を述べています。 彼の方法はglibcを第2のライブラリとしてglibcを使ったクロスコンパイル の設定についてのものです。この方法によるインストールの手順は、 この文書中の「テストライブラリとしてのインストール」より複雑ですが、 glibcをリンクする際のコンパイラ指定がより簡単です。この方法は彼の <url url="http://huizen.dds.nl/~frodol/glibc/" name="Linuxへのglibc2のインストール">に記載されています。 <!-- If you are currently running Debian 1.3 but do not want to upgrade to the unstable version of Debian to use glibc, the <url url="http://www.gate.net/~storm/FAQ/libc5-libc6-Mini-HOWTO.html" name="Debian libc5 to libc6 Mini-HOWTO"> describes how to use Debian packages to upgrade your system. If you are installing glibc 2 on an important system, you might want to use the test install. Even if there are no bugs, some programs will need to be modified before they will compile due to changes in function prototypes and types. --> 現在Debian1.3を使っているが、glibcを使うためだけに不安定なバージョン にアップグレードするのがいやな場合、 <url url="http://www.gate.net/~storm/FAQ/libc5-libc6-Mini-HOWTO.html" name="Debian での libc5 から libc6への移行 Mini-HOWTO"> を参考にしてください。Debianパッケージを使ったシステムのアップグレード の仕方が記載されています。 glibc2を重要なシステムにインストールするときは、テストインストールを 行ったがいいかも知れません。 関数プロトタイプや型が変更されているため、 コンパイルするためには、修正が必要かも知れないからです。 <!--<sect>Getting the library.<label id="getting">--> <sect>ライブラリの取得<label id="getting"> <p> <!--<quote>glibc!obtaining</quote>--> <!--<quote>glibc!取得</quote>--> <!-- The glibc 2 consists of the glibc package and three optional add-on packages, LinuxThreads, Locale, and Crypt. The source can be found at --> glibc2はglibcパッケージと3つのアドオンパッケージ、LinuxThreads, Locale Cryptからなります。ソースは以下のサイトで取得可能です。 <itemize> <item><url url="ftp://prep.ai.mit.edu/pub/gnu/glibc-2.0.6.tar.gz"> <item><url url="ftp://prep.ai.mit.edu/pub/gnu/glibc-linuxthreads-2.0.6.tar.gz"> <item><url url="ftp://prep.ai.mit.edu/pub/gnu/glibc-localedata-2.0.6.tar.gz"> <item><url url="ftp://prep.ai.mit.edu/pub/gnu/glibc-crypt-2.0.6.tar.gz"> </itemize> <!-- It will take about 150 MB of disk space for the full compile and install. The basic binary install of just the core library package is about 50 MB. --> 全コンパイルとインストールには、約150MBのディスクスペースが必要です。 コアライブラリパッケージのみの基本バイナリインストールでは約50MBが 必要です。 <!-- Binary packages for 2.0.6 are not available. Version 2.0.4 binary packages are available for i386 and m68k, and version 2.0.1 for the alpha can be found at --> 2.0.6のバイナリパッケージはまだ準備中です。2.0.4バイナリパッケージは i386とm68k用があります。alpha用は2.0.1があります。これらは下記から 取得できます。 <itemize> <item>Intel x86: <itemize> <item><url url="ftp://prep.ai.mit.edu/pub/gnu/glibc-2.0.4.bin.i386.tar.gz"> <item><url url="ftp://prep.ai.mit.edu/pub/gnu/glibc-crypt-2.0.4.bin.i386.tar.gz"> </itemize> <item>Alpha: <itemize> <item><url url="ftp://prep.ai.mit.edu/pub/gnu/glibc-2.0.1.bin.alpha-linux.tar.gz"> <item><url url="ftp://prep.ai.mit.edu/pub/gnu/glibc-crypt-2.0.1.bin.alpha-linux.tar.gz"> </itemize> <item>m68k: <itemize> <item><url url="ftp://prep.ai.mit.edu/pub/gnu/glibc-2.0.4-m68k-linux.bin.tar.gz"> <item><url url="ftp://prep.ai.mit.edu/pub/gnu/glibc-crypt-2.0.4-m68k-linux.bin.tar.gz"> </itemize> </itemize> <!-- There are export restrictions on the crypt add-on. Non-US users should get it from <url url="ftp://ftp.ifi.uio.no/pub/gnu">. --> cryptアドオンには輸出規制があります。米国以外のユーザは、 <url url="ftp://ftp.ifi.uio.no/pub/gnu">から取得してください。 <!-- If you are running a Red Hat distribution, you can get rpms for glibc 2 from <url url="ftp://ftp.redhat.com/pub/redhat/">. Glibc 2 is the primary C library for the new Red Hat distribution 5.0. If you are running a Debian distribution, you can get the packages for glibc 2 from <url url="ftp://ftp.debian.org/debian/dists/unstable/main/">. The files are named libc6. Glibc 2 is now part of the base package of the hamm version of Debian, and will be the primary libc when Debian 2.0 is released. --> Red Hatディストリビューションを使用している場合、glibc2用のRPMを <url url="ftp://ftp.redhat.com/pub/redhat/">から取得できます。Glibc2は あたらしいRedHatディストリビューション5.0ではメインのCライブラリになって います。 Debianディストリビューションを使用している場合、glibc2用のパッケージを <url url="ftp://ftp.debian.org/debian/dists/unstable/main/">で入手できます。 ファイル名はlibc6となっています。Debianのhammバージョンでは。glibc2が 基本パッケージの一部なっており、Debian2.0がリリースされるときには、 メインのlibcとなる予定です。 <!--sect>Installing as a test library.<label id="test-install">--> <sect>テストライブラリとしてのインストール<label id="test-install"> <p> <!--<quote>glibc!テスト</quote>--> <!-- This section covers installing glibc 2 as a test library. Anything you compile will be linked to your existing libraries unless you give some extra parameters to link to the new libraries. It appears that the paths are compiled into quite a few files, so you probably have to install the library from source. --> この節では、glibc2をテストライブラリとしてインストールする方法について 説明します。オプション指定をしない限り、コンパイルしたものは、既存の ライブラリにリンクされます。かなりの数のファイルにパスを記述する必要 があるので、ソースからインストールを行わなくてはならないでしょう。 <!--<sect1>Compiling and installing.--> <sect1>コンパイルとインストール <p> <!--<sect2>Prerequisites.--> <sect2>必要条件 <p> <!--<quote>glibc!テスト!必用条件</quote>--> <itemize> <!-- <item>About 150 MB free disk space <item>GNU make 3.75 <item>gcc >= 2.7.2 (better 2.7.2.1) <item>binutils 2.8.1 (for alpha you need a snapshot) <item>bash 2.0 <item>autoconf 2.12 (if you change configure.in) <item>texinfo 3.11 --> <item>約150MBの空ディスクスペース <item>GNU make 3.75 <item>gcc >= 2.7.2 (2.7.2.1以上が望ましい) (訳注 ix86-Linuxでは、glibc-2.0.6のコンパイルにはgcc-2.8.1以上が 必要です) <item>binutils 2.8.1 (alpha用にはsnapshotが必要) <item>bash 2.0 <item>autoconf 2.12 (configure.inを変更するときのみ) <item>texinfo 3.11 </itemize> <!-- On an i586@133 with 64 MB of RAM, it takes about 3 hours to compile with full libraries with add-ons. On a loaded i686@200, it takes about half an hour. --> フルライブラリとアドオンのコンパイルに、i586@133, 64MB RAMで約3時間、 フル装備のi686@200では約30分かかります。 <!--<sect2>Extracting the source.--> <sect2>ソースの展開 <p> <!--<quote>glibc!テスト!ソースの展開</quote>--> <!-- You need to extract the source from the archives so you can compile it. The best way to do this is: --> コンパイルにはいる前に、アーカイブからソースを展開する必要があります。 もっとも良いのは次の方法です。 <tscreen><verb> tar xzf glibc-2.0.6.tar.gz cd glibc-2.0.6 tar xzf ../glibc-linuxthreads-2.0.6.tar.gz tar xzf ../glibc-crypt-2.0.6.tar.gz tar xzf ../glibc-localedata-2.0.6.tar.gz </verb></tscreen> <!-- This will put linuxthreads, crypt, and localedata directories in the glibc-2.0.6 directory where configure can find these add-ons. --> これによりlinuxthreads,crypt,localedataディレクトリがglibc-2.0.6に 置かれ、configureがこれらのアドオンを認識できるようになります。 <!--<sect2>Configuring.--> <sect2>設定 <p> <!--<quote>glibc!テスト!設定</quote>--> <!-- In the glibc-2.0.6 directory, create a directory named compile, and cd into it. All work will be done in this directory, which will simplify cleaning up. (The developers have not been very concerned with getting 'make clean' perfect yet.) --> glibc-2.0.6ディレクトリに compileという名のディレクトリを作成し、 cdします。作業は全てそこで行います。これにより後片付けが楽になります。 (まだ、make cleanが完璧に動作するようになっていないからです。) <tscreen><verb> mkdir compile cd compile </verb></tscreen> <!-- Run <tt>../configure</tt>. To use the add-on packages, you need to specify them with -enable-add-ons, such as -enable-add-ons=linuxthreads,crypt,localedata. You also need to choose a destination directory to install to. /usr/i486-linuxglibc2 is a good choice. The configure line for this would be: --> <tt>../configure</tt>を実行します。アドオンパッケージを使うためには、 <tt>--enable-add-ons=--enable-add-ons=linux-threads,crypt,localedata</tt> のように指定する必要があります。インストール先のディレクトリも指定する 必要があります。/usr/i486-linuxglibc2というのが良いでしょう。 最終的に、コマンドラインは次のようになるでしょう。 <tscreen><verb> ../configure --enable-add-ons=linuxthreads,crypt,localedata --prefix=/usr/i486-linuxglibc2 </verb></tscreen> <!--<sect2>Compiling and installing.--> <sect2>コンパイルとインストール <p> <!--<quote>glibc!テスト!コンパイル</quote>--> <!--<quote>glibc!テスト!インストール</quote>--> <!--To compile and verify, run:--> コンパイルとチェックは下記の通りです。 <tscreen><verb> make make check </verb></tscreen> <!--If the 'make check' succeeds, install the library:--> <tt/make check/がうまくいったらライブラリをインストールします。 <tscreen><verb> make install </verb></tscreen> <!--<sect1>Updating the dynamic loader.--> <sect1>ダイナミックローダのアップデート <p> <!--<quote>glibc!テスト!ダイナミックローダ, アップデート</quote>--> <!--<quote>glibc!テスト!ld.so.conf, アップデート</quote>--> <enum> <!-- <item>Create a link from the new <tt>ld.so</tt> to <tt>/lib/ld-linux.so.2</tt>: --> <item>新しい<tt>ld.so</tt>から<tt>/lib/ld-linux.so.2</tt>へリンクを張ります。 <tscreen><verb> ln -s /usr/i486-linuxglibc2/lib/ld-linux.so.2 /lib/ld-linux.so.2 </verb></tscreen> <!-- This is the only library where the location is fixed once a program is linked, and using a link in <tt>/lib</tt> will ease upgrading to glibc as your primary C library when the stable version is released. --> このライブラリだけが、プログラムにリンクされるもののなかで唯一場所の 固定されているものです。<tt>/lib</tt>へのリンクを使うことで、安定版のglibcが できたときに、メインのCライブラリとしてのアップグレードが容易になります。 <!-- <item>Edit <tt>/etc/ld.so.conf</tt>. You need to add path to the lib directory the new libraries reside in at the end of the file, which will be <tt><prefix>/lib</tt>, such as <tt>/usr/i486-linuxglibc2/lib</tt> for the choice above. After you have modified <tt>/etc/ld.so.conf</tt>, run --> <tt>/etc/ld.so.conf</tt>を編集します。この際に。ライブラリのあるディレクトリ 名の後に/libを加える必要があります。つまり<tt><prefix></tt>/libのように なり、前述の例で言えば、<tt>/usr/i486-linuxglibc2/lib</tt>となります。 <tt>/etc/ld.so.conf</tt>を編集後、 <tscreen><verb> ldconfig -v </verb></tscreen> </enum> <!--<sect1>Configuring for gcc.--> <sect1>gccの設定 <p> <!--<quote>glibc!テスト!gccの設定</quote>--> <!-- The last step of installation is updating <tt>/usr/lib/gcc-lib</tt> so gcc knows how to use the new libraries. First you need to duplicate the existing configuration. To find out which configuration is current, use the -v option of gcc: --> インストールの最後のステップは、gccが新しいライブラリを認識できるように するための<tt>/usr/lib/gcc-lib</tt>の修正です。まず、既存の設定をコピーする必要 があります。どの設定が現在使われているものかを調べるには、gccの-vオプ ションを用います。 <tscreen><verb> % gcc -v Reading specs from /usr/lib/gcc-lib/i486-unknown-linux/2.7.2.2/specs gcc version 2.7.2.2 </verb></tscreen> <!-- In this case, i486-unknown-linux is the system, and 2.7.2.2 is the version. You need to copy the <tt>/usr/lib/gcc-lib/<system></tt> to the new test system directory: --> この場合は、i486-unknown-linuxがシステム、2.7.2.2がバージョンです。 <tt>/usr/lib/gcc-lib/<システム></tt>をテストシステムディレクトリにコピー します。 <tscreen><verb> cd /usr/lib/gcc-lib/ cp -r i486-unknown-linux i486-linuxglibc2 </verb></tscreen> <!-- Change into your new test system directory and version directory --> テスト用の新しいシステムディレクトリとバージョンディレクトリに移動します。 <tscreen><verb> cd /usr/lib/gcc-lib/i486-linuxglibc2/2.7.2.2 </verb></tscreen> <!-- and edit the file <tt>specs</tt> found in this directory. In this file, change <tt>/lib/ld-linux.so.1</tt> to <tt>/lib/ld-linux.so.2</tt>. You also need to remove all expressions <tt/%{...:-lgmon}/ in the file, since glibc does not use the gmon library for profiling. A sample specs file can be found in the <ref id="specs" name="Sample specs file"> section. --> そして、そのディレクトリのファイル<tt>specs</tt>を編集します。 このファイルの中の<tt>/lib/ld-linux.so.1</tt>を<tt>/lib/ld-linux.so.2</tt> に変更します。 また、<tt/%{...:-lgmon}/と書かれた部分を削除します。 glibcはプロファイリングにgmonライブラリを使用しないからです。 サンプルのspecsファイルは <ref id="specs" name="specsファイルのサンプル"> セクションを参照してください。 <!--<sect1>Updating header file links.--> <sect1>ヘッダーファイルへのリンクのアップデート <p> <!--<quote>glibc!テスト!ヘッダーファイル, アップデート</quote>--> <!-- You need create links in your new include directory to other include directories: --> 新しいディレクトリの下に、ほかのディレクトリへのリンクを張ります。 <tscreen><verb> cd /usr/i486-linuxglibc2/include ln -s /usr/src/linux/include/linux ln -s /usr/src/linux/include/asm ln -s /usr/X11R6/include/X11 </verb></tscreen> <!-- You might also have other libraries such as ncurses which need their header files put in this directory. You should copy or link the files from <tt>/usr/include</tt>. (Some libraries may need to be recompiled with glibc2 in order to work with it. In these cases, just compile and install the package to <tt>/usr/i486-linuxglibc2</tt>.) --> ncursesなど、新しいディレクトリにヘッダーファイルを入れるべき ライブラリを使用している場合、<tt>/usr/include</tt>からファイルをコピーするか リンクを張ります。(ライブラリによっては、glibc2と一緒に再コンパイル しないと適切に動作しないものがあります。その場合、そのパッケージを 単にコンパイルして<tt>/usr/i486-linuxglibc2</tt>にインストールしてください) <!--<sect1>Testing your installation.--> <sect1>インストール完了の確認 <p> <!--<quote>glibc!テスト</quote>--> <!-- To test the installation, create the following program in a file glibc.c: --> インストール完了を確認するために、次のプログラムをglibc.cファイルとして 作成してください。 <tscreen><verb> #include <stdio.h> main() { printf("hello world!\n"); } </verb></tscreen> <!-- and compile with the options of &dquot;-b <base install directory> -nostdinc -I<install directory>/include -I/usr/lib/gcc-lib/<new system dir>/<gcc version>/include&dquot;: --> そして、&dquot;-b <base install directory> -nostdinc -I<install directory>/include -I/usr/lib/gcc-lib/<new system dir>/ <gcc version>/include&dquot; というオプションでコンパイルします。 <tscreen><verb> % gcc -b i486-linuxglibc2 -nostdinc -I/usr/i486-linuxglibc2/include -I/usr/lib/gcc-lib/i486-linuxglibc2/2.7.2.2/include glibc.c -o glibc </verb></tscreen> (訳注)私のシステムでは下記のようにしないと正しくリンクされませんでした。 gcc -b i686-linuxglibc2 -nostdinc -I/usr/i686-linuxglibc2/include -I/usr/local/lib/gcc-lib/i686-linuxglibc2/2.8.1/include glibc.c -o glibc -L/usr/i686-linuxglibc2/lib (-Lオプションがみそ) <!-- Use ldd to verify the program was linked with glibc2, and not your old libc: --> lddを使って、プログラムが古いlibcではなく新しいglibc2にリンクされたことを 確認します。 <tscreen><verb> % ldd glibc libc.so.6 => /usr/i486-linuxglibc2/lib/libc-2.0.6.so (0x4000d000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) </verb></tscreen> <!-- If it compiles, the links check out, and it generates &dquot;hello world!&dquot; when run, the installation succeeded. --> コンパイルができて、正しいリンクが確認でき、実行したときに &dquot;hello world!&dquot;というメッセージが出れば、インストールは成功です。 <!--<sect>Installing as the primary C library.<label id="primary-install">--> <sect>メインのCライブラリとしてのインストール <label id="primary-install"> <p> <!--<quote>glibc!インストール</quote>--> <!-- This section covers installing glibc 2 as your primary C library. Any new programs you compile will be linked with this library, unless you use special compile options to link with another version. If you are are using Redhat or Debian and have downloaded the appropriate rpm or deb files, see the Redhat or Debian installion instructions. You can then skip this section. --> このセクションでは、glibc2をメインのCライブラリとしてインストールする方法を 説明します。新しくコンパイルされるプログラムは、オプション指定をしない 限り、このライブラリにリンクされるようになります。 RedhatかDebianを使っていて、適切なebファイルをダウンロードしたのであれ ば、RedhatかDebianのインストールインストラクションをご覧下さい。その 場合、このセクションは読み飛ばしてかまいません。 <!--<sect1>Building the library from source.<label id="compiling">--> <sect1>ソースからのライブラリ構築 <label id="compiling"> <p> <!--<quote>glibc!インストール!コンパイル</quote>--> <!-- This section explains how to compile glibc 2 and add-ons from the sources. You must compile the library if you want to change optimization or configuration options or use a package you do not have the binaries for. --> この節では、ソースからglibc2とアドオンをコンパイルする方法を説明します。 最適化レベルや設定を変更したい場合、およびバイナリパッケージのない場合、 ライブラリのコンパイルが必要になります。 <!--<sect2>Prerequisites.--> <sect2>必要条件 <p> <!--<quote>glibc!インストール!必用条件</quote>--> <itemize> <!-- <item>About 150 MB free disk space <item>GNU make 3.75 <item>gcc >= 2.7.2 (better 2.7.2.1) <item>binutils 2.8.1 (for alpha you need a snapshot) <item>bash 2.0 <item>autoconf 2.12 (if you change configure.in) <item>texinfo 3.11 --> <item>約150MBの空きディスク容量 <item>GNU make 3.75 <item>gcc >= 2.7.2 (2.7.2.1が望ましい) (訳注: gcc-2.8.1以上が必要です。) <item>binutils 2.8.1 (alpha用にはsnapshotが必要) <item>bash 2.0 <item>autoconf 2.12 (configure.inを変更する場合) <item>texinfo 3.11 </itemize> <!-- On an i586@133 with 64 MB of RAM, it takes about 3 hours to compile with full libraries with add-ons. On a loaded i686@200, it takes about half an hour. --> i586@133, 64 MB RAMのシステムでは、全ライブラリとアドオンのコンパイルに 約3時間かかります。フル装備のi686@200では、約30分です。 <!--<sect2>Extracting the source.--> <sect2>ソースの展開 <p> <!--<quote>glibc!インストール!ソース, 展開</quote>--> <!-- You need to extract the source from the archives so you can compile it. The best way to do this is: --> コンパイルするためには、アーカイブを展開してソースを取り出す必要があり ます。最良の方法は次の通りです。 <tscreen><verb> tar xzf glibc-2.0.6.tar.gz cd glibc-2.0.6 tar xzf ../glibc-linuxthreads-2.0.6.tar.gz tar xzf ../glibc-crypt-2.0.6.tar.gz tar xzf ../glibc-localedata-2.0.6.tar.gz </verb></tscreen> <!-- This will put linuxthreads, crypt, and localedata directories in the glibc-2.0.6 directory where configure can find these add-ons. --> これにより、linuxthreads, crypt, localedataディレクトリがglibc-2.0.6 ディレクトリ内に置かれ、configureがこれらのアドオンを認識できるように なります。 <!--<sect2>Configuring.--> <sect2>設定 <p> <!--<quote>glibc!インストール!設定</quote>--> <!-- In the <tt>glibc-2.0.6</tt> directory, create a directory named compile, and cd into it. All work will be done in this directory, which will simplify cleaning up. (The developers have not been very concerned with getting 'make clean' perfect yet.) --> <tt>glibc-2.0.6</tt>ディレクトリ内にcompileというディレクトリを作成し、そこへ cdして、全ての作業をこの中で行います。これにより、インストール後の 消去作業が楽になります。(プログラム開発者が、'make clean'をまだ完全に 働くようにはしていないからです。) <tscreen><verb> mkdir compile cd compile </verb></tscreen> <!-- Run <tt>../configure</tt>. To use the add-on packages, you need to specify them with -enable-add-ons, such as -enable-add-ons=linuxthreads,crypt,localedata. You probably will also want to specify paths where it will be installed. To match the standard linux distributions, specify -prefix=/usr. (When a prefix of <tt>/usr</tt> is specified on a linux system, configure knows to adjust other paths to place libc.so and other important libraries in <tt>/lib</tt>.) The whole configure line would be: --> 次に<tt>../configure</tt>を実行します。アドオンパッケージを使うためには、 --enable-add-ons=linux-threads,crypt,localedataのようにしてオプション 指定する必要があります。インストールするパスを指定する必要もあるかも しれません。標準的なlinuxディストリビューションに合わせるには、 --prefix=/usrを指定します。(linuxシステムで<tt>/usr</tt>がprefixとして指定さ れるとconfigureはlibc.soやほかの重要なライブラリを<tt>/lib</tt>に格納し、ほかの pathを適切に調整します。)最終的なコマンドラインは次のようになるで しょう。 <tscreen><verb> ../configure --enable-add-ons=linuxthreads,crypt,localedata --prefix=/usr </verb></tscreen> <!--<sect2>Compiling.--> <sect2>コンパイル <p> <!--<quote>glibc!インストール!コンパイル</quote>--> <!--To compile and verify, run:--> コンパイルとチェックは次の通りです。 <tscreen><verb> make make check </verb></tscreen> <!--<sect1>Preparing for installation.--> <sect1>インストールの準備 <p> <!--<quote>glibc!インストール!準備</quote>--> <!-- Now you need to move some files around to prepare for the new library, whether you are installing from source or binaries. Any new program compiled will be linked to glibc, but old programs which are not statically linked will still depend on libc 5, so you can not just overwrite the old version. --> ソースからインストールする場合にせよ、バイナリからインストールする場合 にせよ、新しいライブラリの準備のために、いくつかのファイルを待避する 必要があります。新しくコンパイルされるプログラムは、glibcにリンクされ ますが、古いプログラムのうち、動的にリンクされたものはlibc5に依存している ため、単に古いバージョンを上書きするわけには行かないのです。 <enum> <!--<item>Create a new directory to hold the old files to:--> <item>古いファイルを待避するための新しいディレクトリを作成します。 <tscreen><verb> mkdir -p /usr/i486-linuxlibc5/lib </verb></tscreen> <!--<item>The old header files must be evacuated from <tt>/usr/include</tt>:--> <item> 古いヘッダーファイルを<tt>/usr/include</tt>から待避させます。 <tscreen><verb> mv /usr/include /usr/i486-linuxlibc5/include </verb></tscreen> <!-- <item>Create a new include directory and set up the links to other include directories: --> <item>新しいincludeディレクトリを作成し、ほかのincludeディレクトリへの リンクを作成します。 <tscreen><verb> mkdir /usr/include ln -s /usr/src/linux/include/linux /usr/include/linux ln -s /usr/src/linux/include/asm /usr/include/asm ln -s /usr/X11R6/include/X11 /usr/include/X11 ln -s /usr/lib/g++-include /usr/include/g++ </verb></tscreen> <!-- The links may need adjusting according to your distribution. At least Slackware puts g++ headers in <tt>/usr/local/g++-include</tt>, while Debian puts the headers in <tt>/usr/include/g++</tt>, and links <tt>/usr/lib/g++-include</tt> to <tt>/usr/include/g++</tt>. In the later case, you probably will want to move the original g++ include directory back to <tt>/usr/include</tt>. --> ディストリビューションによっては、リンク先を調整する必要があるかも しれません。少なくとも、Slackwareはg++ヘッダーファイルを /usr/local/g++-includeに置いてあり、Debianでは/usr/include/g++に 置いてあって、/usr/lib/g++-includeを/usr/include/g++にリンクしてあり ます。後者の場合は、元のg++ includeディレクトリを/usr/includeに 戻しておいた方が良いでしょう。 <!-- <item>Restore any extra header files and links. Some non-standard libraries such as ncurses put files in <tt>/usr/include</tt> or put a link to their include directories in the <tt>/usr/include</tt>. These files and links need to be restored in order to use the extra libraries properly. --> 上記以外の全てのヘッダーファイルやリンクの回復を行います。ncursesなど の非標準ライブラリのいくつかは、ファイルか独自のincludeディレクトリへの リンクを<tt>/usr/include</tt>に置いています。 そういったライブラリを適切に使用するためには、それらのファイル やリンクの設定を適切が行われている必要があるのです。 <!-- <item>Add your new library directory (such as <tt>/usr/i486-linuxlibc5/lib</tt>) <em>at the top</em> of your <tt>/etc/ld.so.conf</tt> file. You should have ld.so 1.8.8 or better installed to avoid getting strange messages once glibc is installed. --> <item> 新しいライブラリディレクトリ(<tt>/usr/i486-linuxlibc5/lib</tt>)を <tt>/etc/ld.so.conf</tt>ファイルの<em>先頭</em>に加えます。 glibcがインストールされたあと奇妙なメッセージが出るのを避けるためには、 ld.so 1.8.8以降を使った方がよいでしょう。 <!-- <item>Move/copy all the old C libraries into the new directory. --> <item>古いCライブラリを新しいディレクトリに移動/コピーします。 <tscreen><verb> mv /usr/lib/libbsd.a /usr/i486-linuxlibc5/lib mv /usr/lib/libc.a /usr/i486-linuxlibc5/lib mv /usr/lib/libgmon.a /usr/i486-linuxlibc5/lib mv /usr/lib/libm.a /usr/i486-linuxlibc5/lib mv /usr/lib/libmcheck.a /usr/i486-linuxlibc5/lib mv /usr/lib/libc.so /usr/i486-linuxlibc5/lib mv /usr/lib/libm.so /usr/i486-linuxlibc5/lib cp /lib/libm.so.5.* /usr/i486-linuxlibc5/lib cp /lib/libc.so.5.* /usr/i486-linuxlibc5/lib </verb></tscreen> <!-- <tt>libm.so.5</tt> and <tt>libc.so.5</tt> should be copied and not moved if <tt>/usr</tt> is a seperate partition from <tt>/</tt>, because they are required by programs used to start linux and must be located on the root drive partition. --> <tt>/usr</tt>が<tt>/</tt>とは別のパーティションにある場合、 <tt>libm.so.5</tt>と<tt>libc.so.5</tt>は、移動せずにコピーしてください。 これらはlinuxを起動する際に使われるプログラムが必要とするファイルであり、 ルートドライブパーティションになくてはならないからです。 <!--<item>Move the <tt>/usr/lib/*.o</tt> files into the new directory.--> <item><tt>/usr/lib/*.o</tt>ファイルを新しいディレクトリに移動します。 <tscreen><verb> mv /usr/lib/crt1.o /usr/i486-linuxlibc5/lib mv /usr/lib/crti.o /usr/i486-linuxlibc5/lib mv /usr/lib/crtn.o /usr/i486-linuxlibc5/lib mv /usr/lib/gcrt1.o /usr/i486-linuxlibc5/lib </verb></tscreen> <!--<item>Update your library cache after your libraries are moved.--> <item>ライブラリを移動したら、ライブラリキャッシュを更新します。 <tscreen><verb> ldconfig -v </verb></tscreen> </enum> <!--<sect1>Installing from the binary package.--> <sect1>バイナリパッケージからのインストール <p> <!--<quote>glibc!インストール!コンパイル済バイナリ</quote>--> <!-- If you are installing glibc from precompiled binaries, you must: --> glibcをコンパイル済バイナリを使ってインストールするときは、次のように する必要があります。 <tscreen><verb> cd / gzip -dc glibc-2.0.bin.i386.tar.gz | tar tvvf - gzip -dc glibc-crypt-2.0.bin.i386.tar.gz | tar tvvf - ldconfig -v </verb></tscreen> <!-- If you have a different architecture or version, substitute the proper file names. --> 異なったアーキテクチャかバージョンを使用している場合は、適当なファイル名 に読み替えてください。 <!--<sect1>Installing from the source.--> <sect1>ソースからのインストール <p> <!--<quote>glibc!インストール!ソースから</quote>--> <!--To install the library from source, run:--> ライブラリをソースからインストールするには次のようにします。 <tscreen><verb> make install ldconfig -v </verb></tscreen> <!--<sect1>Updating the gcc specs.--> <sect1>gcc specsファイルの更新 <p> <!--<quote>glibc!インストール!gcc specs ファイル, アップデート</quote>--> <!-- The final step of the installation (for both binary and source installs) is to update the gcc <tt>specs</tt> file so you can link your programs properly. To determine which specs file is the one used by gcc, use: --> インストールの最終段階は、バイナリからの場合もソースからの場合も、 リンクが適切に行われるようにするためのgcc specsファイルの更新です。 gccがどのspecsファイルを使っているかを調べるには、次のようにして ください。 <tscreen><verb> % gcc -v reading specs from /usr/lib/gcc-lib/i486-unknown-linux/2.7.2.2/specs gcc version 2.7.2.2 </verb></tscreen> <!-- In this case, i486-unknown-linux is the system, and 2.7.2.2 is the version. You need to copy the <tt>/usr/lib/gcc-lib/<system></tt> to the old system directory: --> 上の例では、i486-unknown-linuxがシステム名、2.7.2.2がバージョン番号 です。/usr/lib/gcc-lib/<システム>を古いシステムディレクトリにコピー します。 <tscreen><verb> cd /usr/lib/gcc-lib/ cp -r i486-unknown-linux i486-linuxlibc5 </verb></tscreen> <!--Change into the original directory and version directory --> 次に、元のディレクトリとバージョンディレクトリに移動します。 <tscreen><verb> cd /usr/lib/gcc-lib/i486-unknown-linux/2.7.2.2 </verb></tscreen> <!-- and edit the file <tt>specs</tt> found in this directory. In this file, change <tt>/lib/ld-linux.so.1</tt> to <tt>/lib/ld-linux.so.2</tt>. You also need to remove all expressions <tt/%{...:-lgmon}/ in the file, since glibc does not use the gmon library for profiling. A sample specs file can be found in the <ref id="specs" name="Sample specs file"> section. --> そして、そのディレクトリのspecsファイルをコピーします。このファイル中 で、/lib/ld-linux.so.1と書かれた部分を/lib/ld-linux.so.2に変更します。 また、%{...:-lgmon}という記述を全て削除します。glibcはプロファイリング にgmonライブラリを使わないためです。specsファイルの例は <ref id="specs" name="specsファイルの例"> 節を参照してください。 <!--<sect1>Testing your installation.--> <sect1>インストール完了の確認 <p> <!--<quote>glibc!インストール!テスト</quote>--> <!-- To test the installation, create the following program in a file glibc.c: --> インストール完了を確認するために、次のプログラムをファイルとして 作成してください。 <tscreen><verb> #include <stdio.h> main() { printf("hello world!\n"); } </verb></tscreen> <!--and compile the program.--> そして、コンパイルします。 <tscreen><verb> % gcc glibc.c -o glibc </verb></tscreen> <!-- Use ldd to verify the program was linked with glibc2, and not your old libc: --> lddを使って、プログラムが、古いlibcでなく新しいglibc2にリンクされている ことを確認します。 <tscreen><verb> % ldd glibc libc.so.6 => /lib/libc.so.6 (0x4000e000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) </verb></tscreen> <!-- If this compiles and generates &dquot;hello world!&dquot; when run, the installation was successful. --> コンパイルがうまく行き、プログラムを実行したときに"hello world!"と表示 されればインストール成功です。 (訳注)make を使用してコンパイルする場合、設定にも因りますが、 /usr/bin/ccが呼ばれてリンクがうまく行かないことがあります。 この場合、gccを/usr/bin/ccにコピーするか、環境変数(またはmakeマクロ)CCを gccを指すように変更してください。 <!--<sect>Compiling with the non-primary libc.--> <sect>メインライブラリでないlibcを使ったコンパイル <p> <!--<quote>glibc!副ライブラリを使ったコンパイル</quote>--> <!-- There are times you will want to use an alternate library to compile your programs with. This section explains how to accomplish this, using the directories and installation names used in the examples in the previous two sections. Remember to change the names to fit your setup. --> プログラムのコンパイルの際、メインライブラリ以外のライブラリを使ということも あるでしょう。このセクションでは、このような場合にどうしたら良いのか を、前の2節のディレクトリとインストール名を使って説明します。実際に 使用するときは、各自の設定に合わせて名前を読み替えて下さい。 <!--<sect1>A warning when using non-primary libcs.--> <sect1>メインでないlibcを使う場合の注意 <p> <!--<quote>glibc!副ライブラリを使ったコンパイル!注意</quote>--> <!-- Before compiling any programs which is used in the system boot process, remember that if the program is dynamically linked and is used before the non-root partitions are mounted, all linked libraries must be on the root partition. Following the installation process in the previous section for installing glibc as your primary C library, the old libc is left in <tt>/lib</tt>, which will be on your root partition. This means all of your programs will still work during booting. However, if <tt>/usr</tt> is on a different partition and you install glibc as a test library in <tt>/usr/i486-linuxglibc2</tt>, any new programs you compile with glibc will not work until your <tt>/usr</tt> partition is mounted. --> システムブートプロセスが使用するプログラムをコンパイルする時は、 注意が必要です。 プログラムが動的にリンクされていて、かつルートでないパーティションが マウントされる前に使用されるプログラムである場合には、リンクされる 全てのライブラリがルートパーティションになくてはなりません。 前節のメインライブラリとしてglibcをインストールする場合 の説明に従えば、古いlibcはルートパーティション上の<tt>/lib</tt>に 残されるので、ブートプロセス中、全てのプログラムが適正に動作するはずです。 しかし、<tt>/usr</tt>が別のパーティションにあって、glibcをテスト ライブラリとして<tt>/usr/i486-linuxglibc2</tt>にインストールした場合、 glibcを使ってコンパイルされた新しいプログラムは、<tt>/usr</tt> パーティションがマウントされるまで動作しません。 <!--<sect1>Compiling programs with a test glibc.--> <sect1>テスト用glibcを使ったコンパイル <p> <!--<quote>glibc!副ライブラリを使ったコンパイル!glibc</quote>--> <!-- To compile a program with a test-install glibc, you need to reset the include paths to point to the glibc includes. Specifying &dquot;-nostdinc&dquot; will negate the normal paths, and &dquot;-I/usr/i486-linuxglibc2/include&dquot; will point to the glibc includes. You will also need to specify the gcc includes, which are found in <tt>/usr/lib/gcc-lib/i486-linuxglibc2/2.7.2.2/include</tt> (assuming you installed the test lib in i486-linuxglibc2 with gcc version 2.7.2.2). --> テスト用にインストールされたglibcを使ってコンパイルするときは、glibc のincludeを指すようにincludeパスを再設定する必要があります。"-nostdinc" 指定によって、通常のパスを無効にし、"-I/usr/i486-linuxglibc2/include" を指定することで、glibc includeを指定できます。gcc includeも指定する 指定する必要があります。これは/usr/lib/gcc-lib/i486-linuxglibc2/ 2.7.2.2/include にあります。(テスト用ライブラリがi486-linuxglibc2で gccのバージョンが2.7.2.2の場合) <!-- To link a program with a test-install glibc, you need to specify the gcc setup. This is done by using the option &dquot;-b i486-linuxglibc2&dquot;. --> テスト用glibcへプログラムをリンクする場合は、gccの設定を指定する必要 があります。これには、"-b i486-linuxglibc2"オプションを使います。 <!-- For most programs, you can specify these new options by adding them to the <tt>$CFLAGS</tt> and <tt>$LDFLAGS</tt> makefile options: --> 多くのプログラムでは、makefileの<tt>$CFLAGS</tt>と <tt>$LDFLAGS</tt>オプションを下記の ように設定することで新しいオプションの指定ができます。 <tscreen><verb> CFLAGS = -nostdinc -I/usr/i486-linuxglibc2/include -I/usr/lib/gcc-lib/i486-linuxglibc2/2.7.2.2/include -b i486-linuxglibc2 LDFLAGS = -b i486-linuxglibc2 </verb></tscreen> <!-- If you are using a configure script, define the <tt>$CFLAGS</tt> and <tt>$LDFLAGS</tt> shell variables (by using env/setenv for csh/tcsh, or set/export for sh/bash/etc) before running configure. The makefiles generated by this should contain the proper <tt>$CFLAGS</tt> and <tt>$LDFLAGS</tt>. Not all configure scripts will pick up the variables, so you should check after running configure and edit the makefiles by hand if necessary. --> configureスクリプトを使っている場合、configureを実行する前に <tt>$CFLAGS</tt>と<tt>$LDFLAGS</tt>シェル変数を定義します (csh/tcshの場合env/setenv,sh/bash等ではset/exportを使用)。 これによって生成されるmakefileは適切な<tt>$CFLAGS</tt>と <tt>$LDFLAGS</tt>を含んでいるはずです。 ただし、全てのスクリプトがこれらの変数を確認するわけではないので、 configureを実行した後、makefileを確認し、必要に応じて編集してください。 <!-- If the programs you are compiling only call gcc (and not cpp or binutils directly), you can use the following script to save having to specify all of the options each time: --> コンパイルしようとしているプログラムが、gccのみを使用しているときは (cppやbinutilsディレクトリを直接使用しなければ)、下記のスクリプトを使えば 毎回全オプションを指定せずに済みます。 <tscreen><verb> #!/bin/bash /usr/bin/gcc -b i486-linuxglibc2 -nostdinc \ -I/usr/i486-linuxglibc2/include \ -I/usr/lib/gcc-lib/i486-linuxglibc2/2.7.2.2/include "$@" </verb></tscreen> You can then use this script instead of &dquot;gcc&dquot; when compiling. gccの代わりにこのスクリプトを使用してください。 <!--<sect1>Compiling programs with libc 5 when glibc is primary library.--> <sect1>glibcがメインライブラリのときのlibc5を使ったコンパイル <p> <!--<quote>glibc!副ライブラリを使ったコンパイル!libc 5</quote>--> <!-- To compile a program with your old libraries when you have installed glibc as your main library, you need to reset the include paths to the old includes. Specifying &dquot;-nostdinc&dquot; will negate the normal paths, and &dquot;-I/usr/i486-linuxlibc5/include&dquot; will point to the glibc includes. You must also specify &dquot;-I/usr/lib/gcc-lib/i486-linuxlibc5/2.7.2.2/include&dquot; to include the gcc specific includes. Remember to adjust these paths based on the what you named the new directories and your gcc version. --> glibcをメインライブラリとしてインストールしてあるときに、古いライブラリを 使ってプログラムをコンパイルするには、古いライブラリ用にパスを再設定 する必要があります。これには、&dquot;-nostdinc&dquot;オプションを指定して 通常のパスを無効にし、&dquot;-I/usr/i486-linuxlibc5&dquot;を使ってglibc(*) のincludeディレクトリを指定します。 また、&dquot;-I/usr/lib/gcc-lib/i486-linuxlibc5/2.7.2.2/include&dquot; を指定してgcc特有のincludeファイルディレクトリを指定します。 なお、パス名は各自の設定やgccバージョンに合わせて調整してください。 (*訳注) libc5の間違いと思われます。 <!-- To link a program with your old libc, you need to specify the gcc setup. This is done by using the option &dquot;-b i486-linuxlibc5&dquot;. --> 古いlibcにプログラムをリンクするには、gccの設定を指定する必要があり ます。これは、オプション&dquot;-b i486-linuxlibc5&dquot;を指定すればOKです。 <!-- For most programs, you can specify these new options by appending them to the <tt>$CFLAGS</tt> and <tt>$LDFLAGS</tt> makefile options: --> 多くのプログラムでは。makefile中で<tt>$CFLAGS</tt>と <tt>$LDFLAGS</tt>に新しいオプションを加えればよいはずです。 <tscreen><verb> CFLAGS = -nostdinc -I/usr/i486-linuxlibc5/include -I/usr/lib/gcc-lib/i486-linuxlibc5/2.7.2.2/include -b i486-linuxlibc5 LDFLAGS = -b i486-linuxlibc5 </verb></tscreen> <!-- If you are using a configure script, define the <tt>$CFLAGS</tt> and <tt>$LDFLAGS</tt> shell variables (by using env/setenv for csh/tcsh, or set/export for sh/bash/etc) before running configure. The makefiles generated by this should contain the proper <tt>$CFLAGS</tt> and <tt>$LDFLAGS</tt>. Not all configure scripts will pick up the variables, so you should check after running configure and edit the makefiles by hand if necessary. --> configureスクリプトを使っているときは、configure実行前に、シェル変数 <tt>$CFLAGS</tt>と<tt>$LDFLAGS</tt>を定義します (csh/tcshではenv/setenv, sh/bash等ではset/exportを使用)。 自動生成されたmakefileには、適切に<tt>$CFLAGS</tt>と <tt>$LDFLAGS</tt>が記述されているはずですが、 全てのconfigureスクリプトがこれを行ってくれるわけではないので、 configure実行後makefileを確認し、必要に応じて編集してください。 <!-- If the programs you are compiling only call gcc (and not cpp or binutils directly), you can use the following script to save having to specify all of the options each time: --> もし、コンパイルしようとしているプログラムがgccのみを呼び出している ならば(cppやbinutilsを直接必要としていないならば)、下記のスクリプトを 使えば、毎回オプションを指定しなくてもすみます。 <tscreen><verb> #!/bin/bash /usr/bin/gcc -b i486-linuxlibc5 -nostdinc \ -I/usr/i486-linuxlibc5/include \ -I/usr/lib/gcc-lib/i486-linuxlibc5/2.7.2.2/include "$@" </verb></tscreen> You can then use this script instead of &dquot;gcc&dquot; when compiling. コンパイル時に&dquot;gcc&dquot;の代わりにこれを使えば良いわけです。 <!--<sect>Compiling C++ programs.--> <sect>C++プログラムのコンパイル <p> <!--<quote>glibc!C++ プログラム, コンパイル</quote>--> <!-- Libg++ uses parts of the math library, so is link to libm. Since your existing libg++ will be compiled with your old library, you will have to recompile libg++ with glibc or get a binary copy. The latest source for libg++ along with a binary linked with glibc (for x86) can be found at <url url="ftp://ftp.yggdrasil.com/private/hjl/">. --> libg++は数学ライブラリの一部を使用しているので、libmにリンクされていま す。既存のlibg++は古いライブラリを使用するようにコンパイルされている でしょうから、libg++をglibcを使って再コンパイルするか、バイナリ版を 入手する必要があります。最新のlibg++ソースと、glibcにリンクされたバイ ナリ(x86用)は <url url="ftp://ftp.yggdrasil.com/private/hjl/">にあります。 <!--<sect1>Installing libg++ for a test glibc install.--> <sect1>テスト用glibcを使うlibg++のインストール <p> <!--<quote>glibc!libg++, インストール!テストライブラリとして</quote>--> <!-- If you have installed glibc as a test library, you need to install the files into the directory you installed glibc into (such as <tt>/usr/i486-linuxglibc2</tt> for the example in the previous sections). If you are installing from the binary package (which i would recommend, since i never had any luck compiling libg++ this way), you need to extract the files into a temporary directory and move all the <tt>usr/lib/</tt> files into the <tt><install directory>/lib/</tt> directory, the <tt>usr/include/</tt> files into the <tt><install directory>/include/</tt> directory (remember to delete your <tt>include/g++</tt> link first!), and the <tt>usr/bin/</tt> files into the <tt><install directory>/bin/</tt> directory. --> glibcをテストライブラリとしてインストールした場合、glibcと同じディレク トリにlibg++のファイルもインストールする必要があります(前節の例では <tt>/usr/i486-linuxglibc2</tt>)。バイナリパッケージからインストール する場合は(私自身はこのようにしてlibg++をコンパイルしたことがありま せんが、もしそのようなものがあるとすれば、おすすめします)、 ファイルをテンポラリディレクトリに展開してから、<tt>usr/lib</tt>の ファイルを<tt><インストール先ディレクトリ>/lib/</tt>へ <tt>usr/lib</tt>ディレクトリのファイルを<tt><インストール先 ディレクトリ>/lib/</tt>ディレクトリへ(はじめに<tt>include/g++</tt> のリンクを削除しておくことをお忘れなく!)そして、<tt>usr/bin/</tt> のファイルを<tt><インストール先ディレクトリ>/bin/</tt>ディレク トリへ移動します。 <!--<sect1>Installing libg++ for a primary glibc install.--> <sect1>メインライブラリとしてglibcを使う場合のlibg++のインストール <p> <!--<quote>glibc!libg++, インストール!メインライブラリとして</quote>--> <!-- If you have installed glibc as the primary library, you first need to move your old libg++ files into your old libc directory if you still want to be able to compile g++ programs with your old libc. Probably the easiest way to do this is by installing a new copy of the libg++ compiled with libc 5 as in the previous section, and then installing the glibc version normally. --> glibcをメインライブラリとしてインストールした場合で、g++プログラムを以前 のCライブラリとともに使用したいならば、まず、古いlibg++ファイルを古い libcディレクトリに移動します。たぶん一番簡単な方法は、前節で説明した ようにしてlibc5を使ってlibg++をコンパイルしてインストールし、次に glibc版を通常どおりインストールすることです。 <!--<sect1>Compiling C++ programs with the non-primary libc.--> <sect1>メインライブラリでないlibcを使ったC++プログラムのコンパイル <p> <!--<quote>glibc!C++ プログラム, コンパイル!メインでないlibcと</quote>--> <!-- If you are trying to compile a C++ program with a non-primary libc, you will need to include the g++ include dir, which in the examples above would be <tt>/usr/i486-linuxglibc2/include/g++</tt> for a test glibc install or <tt>/usr/i486-linuxlibc5/include/g++</tt> for a primary glibc install. This can usually be done by appending the <tt>$CXXFLAGS</tt> variable: --> C++プログラムをメインでないlibcとともに使用した場合、g++のincludeディレク トリをincludeするように指定する必要があります。上の例で言えば、 テスト用glibcなら<tt>/usr/i486-linuxglibc2/include/g++</tt>、メインのglibcなら <tt>/usr/i486-linuxlibc5/include/g++</tt>になります。このためには通常、 <tt>$CXXFLAGS</tt>変数指定を付加します。 <tscreen><verb> CXXFLAGS = -nostdinc -I/usr/i486-linuxglibc2/include -I/usr/lib/gcc-lib/i486-linuxglibc2/2.7.2.2/include -I/usr/i486-linuxlibc5/include/g++ -b i486-linuxglibc2 </verb></tscreen> <!--<sect>Reporting bugs.--> <sect>バグレポート <p> <!--<quote>glibc!バグレポート</quote>--> <!-- If you think the lib is buggy, please read first the FAQ. It might be that others had the same problem and there's an easy solution. You should also check the section "Recommended Tools to Install the GNU C Library" in the <tt>INSTALL</tt> file since some bugs are bugs of the tools and not of glibc. --> もしライブラリにバグがあると思うときは、まずにFAQに目を通してくだ さい。ほかの人がすでにこの問題を見つけていて、簡単な解決方法が示されて いるかもしれません。また、<tt>INSTALL</tt>ファイル内の"GNU Cライブラリを インストールするための推奨ツール (Recommended Tools to Install the GNU C Library)"の項目も確認してください。バグによっては、 glibc自身のものではなく、ほかのツールに原因のある可能性があるからです。 <!-- Once you've found a bug, make sure it's really a bug. A good way to do this is to see if the GNU C library behaves the same way some other C library does. If so, probably you are wrong and the libraries are right (but not necessarily). If not, one of the libraries is probably wrong. --> バグを見つけたらまず、それが本当にバグかどうか確かめてください。 確認のための良い方法は、GNU Cライブラリが他のライブラリと同じ動作を するかどうか確めることです。もし動作が同じなら、おそらく間違っているの はあなたで、(必ずしもそうとは言えませんが)ライブラリは正しいのでしょう。 そうでなければ、たぶんんどちらかのライブラリが間違っているのでしょう。 <!-- Next, go to <url url="http://www-gnats.gnu.org:8080/cgi-bin/wwwgnats.pl">, and look through the bug database. Check here to verify the problem has not already be reported. You should also look at the file <tt>BUGS</tt> (distributed with libc) to check for known bugs. --> 次に、<url url="http://www-gnats.gnu.org:8080/cgi-bin/wwwgnats.pl">に行き、 バグデータベースを確認して、同じ問題が報告済でないかどうか確認します。 分かっているバグについては、(libcと共に配布されている)BUGSも確認すべ きです。 <!-- Once you're sure you've found a new bug, try to narrow it down to the smallest test case that reproduces the problem. In the case of a C library, you really only need to narrow it down to one library function call, if possible. This should not be too difficult. --> 新しいバグだということが確認できたら、問題を再現できる最低限のテスト ケースの範囲まで問題の幅を狭めてください。Cライブラリの場合は、可能 な限り、一つのライブラリ関数呼び出しにまで問題を狭めるべきです。 これはさほど難しくないでしょう。 <!-- The final step when you have a simple test case is to report the bug. When reporting a bug, send your test case, the results you got, the results you expected, what you think the problem might be (if you've thought of anything), your system type, the versions of the GNU C library, the GNU CC compiler, and the GNU Binutils which you are using. Also include the files <tt>config.status</tt> and <tt>config.make</tt> which are created by running <tt>configure</tt>; they will be in whatever directory was current when you ran <tt>configure</tt>. --> 簡単なテストケースに絞ることができたら、最後のステップはバグを報告す ることです。バグを報告するときは、テストケース、実際に得られた結果と 期待される結果、そして(もしあれば)この問題の原因と考えられる要因、 テストに使ったシステムの種類、GNU CライブラリとGNU Cコンパイラ、 GNU Binutilsのバージョンを送ってください。configureによって生成された <tt>config.status</tt>と<tt>config.make</tt>も含めてください。 これらは、<tt>configure</tt>を実行したときのカレントディレクトリにあります。 <!-- All bug reports for the GNU C library should be sent using the <tt/glibcbug/ shell script which comes with the GNU libc to <url url="bugs@gnu.org"> (the older address <url url="bugs@gnu.ai.mit.edu"> is still working), or submitted through the GNATS web interface at <url url="http://www-gnats.gnu.org:8080/cgi-bin/wwwgnats.pl">. --> GNU Cライブラリのバグは、GNU libcに付属の<tt/glibcbug/シェルスクリプトを 使って <url url="mailto:bugs@gnu.org">へ送ってください(古いアドレス <url url="mailto:bugs@gnu.ai.mit.edu">もまだ使えます)。 あるいは、<url url="http://www-gnats.gnu.org:8080/cgi-bin/wwwgnats.pl"> から、GNATS WEBインターフェースを使って投稿することもできます。 <!-- Suggestions and questions should be sent to the mailing list at <url url="bugs-glibc@prep.ai.mit.edu">. If you don't read the gnewsgroup gnu.bug.glibc, you can subscribe to the list by asking <url url="bug-glibc-request@prep.ai.mit.edu">. --> 提案や質問はメーリングリスト<url url="mailto:bugs-glibc@prep.ai.mit.edu"> へ送ってください。もし、gnewsgroup gnu.bug.glibc を読んでいない場合、 <url url="mailto:bug-glibc-request@prep.ai.mit.edu"> に請求すれば、リストを取り寄せることができます。 <!-- Please DO NOT send bug report for the GNU C library to <bug-gcc@prep.ai.mit.edu>. That list is for bug reports for GNU CC. GNU CC and the GNU C library are separate entities maintained by separate people. --> GNU Cライブラリのバグレポートを <bug-gcc@prep.ai.mit.edu>に送ること は避けてください。こちらは、GNU CCのバグレポートのためのものです。 GNU CCは別の人々によってメンテナンスされており、GNU Cライブラリとは 別物だからです。 <!--<sect>Sample specs file.<label id="specs">--> <sect>specs ファイルの例 <label id="specs"> <p> <!--<quote>glibc!GCC specs ファイル, 例</quote>--> <!-- Included here is a sample <tt>specs</tt> file for glibc 2 which is used by gcc for compiling and linking. It should be found in the directory <tt>/usr/lib/gcc-lib/<new system dir>/<gcc version></tt>. If you are running an x86 system, you probably can copy this section to the file exactly. --> ここでは、gccがコンパイルとリンクに使用する glibc2 用の<tt>specs</tt> ファイルの例を紹介します。このファイルは、<tt>/usr/lib/gcc-lib/ <新しいシステムディレクトリ>/<gccのバージョン></tt>にあります。 x86システムを使用している場合、このセクションの内容をそのままファイルにコピー すれば良いでしょう。 <tscreen><verb> *asm: %{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} *asm_final: %{pipe:-} *cpp: %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{!m386:-D__i486__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT} *cc1: %{profile:-p} *cc1plus: *endfile: %{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s *link: -m elf_i386 %{shared:-shared} %{!shared: %{!ibcs: %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} %{static:-static}}} *lib: %{!shared: %{pthread:-lpthread} %{profile:-lc_p} %{!profile: -lc}} *libgcc: -lgcc *startfile: %{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:%{profile:gcrt1.o%s} %{!profile:crt1.o%s}}}} crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s} *switches_need_spaces: *signed_char: %{funsigned-char:-D__CHAR_UNSIGNED__} *predefines: -D__ELF__ -Dunix -Di386 -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(i386) -Amachine(i386) *cross_compile: 0 *multilib: . ; </verb></tscreen> <!--<sect>Miscellanea.--> <sect>その他 <p> <!--<quote>glibc!その他</quote>--> <!--<sect1>Further information.--> <sect1>他の情報 <p> <!--<quote>glibc!情報源</quote>--> <p> <!--<sect2>Web pages.--> <sect2>Webページ <p> <!--<quote>glibc!情報源!WWW</quote>--> <itemize> <!-- <item><url url="http://www.gnu.org/software/libc/libc.html" name="FSF's GNU C Library Home Page"> <item><url url="http://www.imaxx.net/~thrytis/glibc/" name="Using GNU Libc 2 with Linux"> <item><url url="http://huizen.dds.nl/~frodol/glibc/"name="Installing glibc-2 on Linux">. <item><url url="http://www.gate.net/~storm/FAQ/libc5-libc6-Mini-HOWTO.html" name="Debian libc5 to libc6 Mini-HOWTO">. --> <item><url url="http://www.gnu.org/software/libc/libc.html" name="FSFのGNU C ライブラリホームページ"> <item><url url="http://www.imaxx.net/~thrytis/glibc/" name="LinuxでGNU Libc2を使う"> <item><url url="http://huizen.dds.nl/~frodol/glibc/" name="Linuxにglibc-2をインストールする"> <item><url url="http://www.gate.net/~storm/FAQ/libc5-libc6-Mini-HOWTO.html" name="Debianでのlibc5からlibc6の移行Mini-HOWTO"> </itemize> <!--<sect2>Newgroups.--> <sect2>ニュースグループ <p> <!--<quote>glibc!情報源!ニュースグループ</quote>--> <itemize> <!-- <item><htmlurl url="news:comp.os.linux.development.system" name="comp.os.linux.development.system"> <item><htmlurl url="news:comp.os.linux.development.apps" name="comp.os.linux.development.apps"> <item><htmlurl url="news:linux.dev.kernel" name="linux.dev.kernel"> <item><htmlurl url="news:gnu.bug.glibc" name="gnu.bugs.glibc"> --> <item><htmlurl url="news:comp.os.linux.development.system" name="comp.os.linux.development.system"> <item><htmlurl url="news:comp.os.linux.development.apps" name="comp.os.linux.development.apps"> <item><htmlurl url="news:linux.dev.kernel" name="linux.dev.kernel"> <item><htmlurl url="news:gnu.bug.glibc" name="gnu.bugs.glibc"> </itemize> <!--<sect2>Mailing lists.--> <sect2>メーリングリスト <p> <!--<quote>libc!情報源!メーリングリスト</quote>--> <descrip> <!--<tag/Glibc 2 Linux discussion list./ This list is intended for discussion among Linux users who have installed glibc2, the new GNU C libraries. Topics might include compatibility issues and questions about the compilation of code in a Linux/glibc setting. To subscribe, send mail to <url url="mailto:Majordomo@ricardo.ecn.wfu.edu" name="Majordomo@ricardo.ecn.wfu.edu"> with a body of "subscribe glibc-linux <your email address>. --> <tag/Glibc2 Linuxディスカッションリスト/ このリストは新しいGNU Cライブラリであるglibc2をインストールした Linuxユーザ間での情報交換を意図したものです。トピックは互換性 から、Linux/glibcセットでのコンパイルについての質問のものまで 含みます。購読するには、<htmlurl url="mailto:Majordomo@ricardo.ecn.wfu.edu" name="Majordomo@ricardo.ecn.wfu.edu">宛に subscribe glibc-linux <あなたのemailアドレス> と書いてメールを送ってください。 </descrip> <!--<sect1>Credits.--> <sect1>謝辞 <p> <!-- Most of this information was stolen from the <url url="http://www.gnu.org/software/libc/libc.html" name="GNU Libc web page"> and from Ulrich Drepper's <drepper@gnu.ai.mit.edu> glibc 2 announcement and his comments. Andreas Jaeger <aj@arthur.rhein-neckar.de> provided some of the Reporting bugs section. --> 掲載した情報のほとんどは、GNU Libc WEBページ <url url="http://www.gnu.org/software/libc/libc.html" name="GNU Libc web page"> とUlrich Drepper's <dreppers@gnu.ai.mit.edu> glibc2 アナウンス、および 彼のコメントからとってきたものです。 Andreas Jaeger <aj@arthur.rhein-neckar.de> は、バグレポートの節についての情報の一部を提供してくれました。 <!-- The following people have provided information and feedback for this document: --> 以下は情報提供およびこの文書についてのフィードバックをしてくれた人たちです。 <itemize> <item>Allex <allex@ms2.accmail.com.tw> <item>Mark Brown <M.A.Brown-4@sms.ed.ac.uk> <item>Ulrich Drepper <drepper@gnu.ai.mit.edu> <item>Scott K. Ellis <ellis@valueweb.net> <item>Aron Griffis <agriffis@coat.com> <item>Andreas Jaeger <aj@arthur.rhein-neckar.de> <item>Frodo Looijaard <frodol@dds.nl> <item>Ryan McGuire <rmcguire@freenet.columbus.oh.us> <item>Shaya Potter <spotter@capaccess.org> <item>Les Schaffer <godzilla@futuris.net> <item>Andy Sewell <puck@pookhill.demon.co.uk> <item>Gary Shea <shea@gtsdesign.com> <item>Stephane <sr@adb.fr> <item>Jan Vandenbos <jan@imaxx.net> </itemize> <!--Translations of this document are being done by:--> 翻訳は下記の人たちが行っています。 <itemize> <!-- <item>Chinese: Allex <allex@ms2.accmail.com.tw> <item>French: Olivier Tharan <tharan@int-evry.fr> <item>Japanese: Kazuyuki Okamoto <ikko-@pacific.rim.or.jp> --> <item>中国語: Allex <allex@ms2.accmail.com.tw> <item>フランス語: Olivier Tharan <tharan@int-evry.fr> <item>日本語: Kazuyuki Okamoto <ikko-@pacific.rim.or.jp> </itemize> (訳注) 日本語v1.5に置いて、下記の人たちから助言と協力を頂きました。(敬称略) <itemize> <item>岡本一幸 <ikko-@pacific.rim.or.jp> <item>中野@成蹊大 <nakano@apm.seikei.ac.jp> <item>中野@asahi-net <sx3m-nkn@asahi-net.or.jp> <item>川岸良治 <kawagisi@ky.rim.or.jp> </itemize> <!--<sect1>Feedback.--> <sect1>フィードバック <p> <!-- Besides writing this HOWTO, maintaining the <url url="http://www.imaxx.net/~thrytis/glibc" name="glibc 2 for Linux"> page, and using it on my machine, I have nothing to do with the glibc project. I am far from knowledgeable on this topic, though I try to help with problems mailed to me. I welcome any feedback, corrections, or suggestions you have to offer. Please send them to <url url="mailto:ejg3@cornell.edu" name="ejg3@cornell.edu">. --> 私自身は、このHOWTOを書くこと、Linux 用 glibc2のホームページ <url url="http://www.imaxx.net/~thrytis/glibc" name="glibc 2 for Linux"> を維持していること、 glibc2 を使っていること以外、glibc プロジェクトには関与していません。 メールで送られてきた問い合わせにはなるべく答えられるよう努力はしている ものの、私は glibc2 について知識が十分にありません。 フィードバック、訂正、提案などは歓迎しますので <htmlurl url="mailto:ejg3@cornell.edu" name="ejg3@cornell.edu"> 宛にお願いします。 (訳注) 日本語訳 (v1.5)に関しては、<url url="mailto:tendo@fas.harvard.edu" name="遠藤俊徳">へお願いします。 <!--<sect1>Copyright.--> <P> <!-- Copyright (c) 1997 by Eric Green. This document may be distributed under the terms set forth in the LDP license. --> Copyright (c) 1997 by Eric Green. (原文)<newline> Copyright (c) 1997 by Kazuyuki Okamoto (日本語訳)<newline> Copyright (c) 1998 by Toshinori Endo (日本語訳) <newline> この文書はLDPライセンスに基づいて配布可能です。 </article>