2008-09-27

透過的なLLVM (5)

そして、Apple (Computer,) Inc.はlibtoolを発明した。Apple libtoolのマニュアルに曰く、

Libtool with -static is intended to replace ar(5) and ranlib.

動的リンクライブラリはさておくとして、問題はMach-Oユニバーサルバイナリだ。もちろん、-Oで終わる単語(うん、たとえば、シロガネ-OとかPARANOIA-Oとか)はXで始まる単語と同じくらいろくでもないに決まっている。

The libtool command takes the specified input object files and creates a library for use with the link editor, ld(1). The library's name is specified by output (the argument to the -o flag). The input object files may be in any correct format that contains object files ("universal" files, archives, archives, object files). Libtool will not put any non-object input file into the output library (unlike ranlib, which allows this in the archives it operates on).

Mach-OユニバーサルバイナリはNeXTに由来する。CPUタイプ(とサブタイプ)ごとのオブジェクトファイルを合体してユニバーサルバイナリにする(うん、厳密にはオブジェクトファイルがそれぞれのアーキテクチャの機械語コードを内包しているかも)。合体は(釣りバカ日誌の)浜チャンにまかせておきたい。同居人はPowerPCのPowerBookを使いつづけているけれど、私はMacBook Proに移行して久しい(初期型なのでx86-64ではないCoreDuoだけど)。

ユニバーサルバイナリを捨てるとしたら、捨てたのだけれど、利点は、静的ライブラリの作成に際して、ranlibを忘れないことくらいだ(うん、それは実際、悪くはない)。動的ライブラリの作成に際しては、特にC++を使用する場合、使用するのだけれど、素直にg++ -dynamiclibを使用するほうがましだ(悪いのはlibstdc++だ)。

畢竟、Apple libtoolがなくても生きていけるし、生きていく資格なら初手から要らない。じゃあ、なぜ、と言えば、Boostが静的リンクライブラリをビルドするためにApple libtoolを使おうとするからだ。

0 件のコメント: