5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Linuxbrewでのgccエラーへの対処法

5
Posted at

症状

linuxbrewで何かをinstallしようとすると

$ brew install lua
Error: lua cannot be built with any available compilers.
To install this formula, you may need to:
  brew install gcc

と表示される。

ではbrew install gccを実行すると

$ brew install gcc
==> Installing dependencies for gcc: gmp, mpfr, libmpc, isl, cloog
==> Installing gcc dependency: gmp
Error: gmp cannot be built with any available compilers.
To install this formula, you may need to:
  brew install gcc

gccがlinuxbrewに認識されてないのでgccのinstallに必要なパッケージもコンパイルできない。

解決策

linuxbrewにgccが認識されていないので,~/.linuxbrew/binに既にインストールされているgccへのsymbolic linkを作って認識されるようにする。

まずgccのバージョンを調べる。

$ gcc -dumpversion
4.9.1

次にインストールされているgccへのsymbolic linkをはる。

$ ln -s `which gcc` `brew --prefix`/bin/gcc-4.9

※gcc-4.9のところは自分の環境のgccのバージョンに合わせる。

完了

念のためgcc以外のcpp,g++にも同様の処理を行ってもいい。

$ ln -s `which cpp` `brew --prefix`/bin/cpp-4.9
$ ln -s `which g++` `brew --prefix`/bin/g++-4.9

参考

[http://qiita.com/thermes/items/1ecb0968ab937ff59164:title]

5
2
0

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
5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?