LoginSignup
10

More than 5 years have passed since last update.

update-alternativesで、 ld.bfd と ld.gold の切り替え

Last updated at Posted at 2014-03-09

あらまし

開発時に、/usr/bin/ldを、ld.bfd(GNU ld、昔からある)とld.gold(GNU gold、近年新しく追加された)を切り替える必要があった。

apt-get intsall binutilsした直後は/usr/bin/ld -> ld.bfdとシンボリックリンクされている。
ld.goldを使いたいなら、これをld.goldにシンボリックリンクしなおせば良い。

が、 なんかスマートじゃない ので、もうちょっと良い方法を探してみる。

環境

  • Ubuntu 12.04 LTS 32bit, 64bit

本題

答えはWebKitのページから見つかった。
http://trac.webkit.org/wiki/WebKitGTK/SpeedUpBuild

以下のようにすれば、ld.bfdld.goldを切り替えられるようになる。

$ sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20
$ sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.bfd" 10
$ sudo update-alternatives --config ld # どれにするか聞いてくる
$ sudo update-alternatives --set ld /usr/bin/ld.bfd # 明示的に設定

注意

Be aware that colorgcc might cause linking issues when using ld.gold.

と書いてあるので、colorgccをお使いの方はご注意ください。

結び

不幸にもldがGNU goldを期待するプロジェクトと、
ldがGNU ldを期待するプロジェクトの双方を期待されているときは上記を使うと少し幸せになるかも。

参考

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10