gcc 4.6.2(GMP、MPFR、MPC)をダウンロードしてビルドを行いました。 build/gcc
ディレクトリにg++
実行ファイルがあります。gcc 4.6.2 OSX Lionでのインストール:「g ++:exec 'cc1plus'の実行中にエラーが発生しました」
私はそれを使用しようと
./g++ test.cpp
私は次のエラーを取得する:
g++: error trying to exec 'cc1plus': execvp: No such file or directory
どのようにこの問題を解決するには?
デフォルトで新しく作成されたg ++を使用するにはどうすればよいですか?
PS。 これらの手順を実行してインストールしましたが、何のエラーも表示されませんでした。建てのMacOS X 10.7上でGCC 4.6.2を得る上
$ export CC=/usr/bin/gcc-4.2
$ export CXX=/usr/bin/g++-4.2
$ export CPP=/usr/bin/cpp-4.2
$ export LD=/usr/bin/ld # not /usr/bin/gcc-4.2!!
Clean also your $PATH as much as possible:
$ export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/X11/bin
(I don’t know exactly if this is necessary but works fine for me and when you close the Terminal the PATH reverts to its original setting).
1. Download the GCC, GMP, MPFR, and MPC sources. The links are in the original post.
2. Save everything in, say, ~/Downloads (or any directory you prefer).
3. Start the Terminal and run the following commands (change the filenames according to the version you have downloaded):
$ cd # go to your home directory
$ mkdir src ; cd src
$ tar -xzf ~/Downloads/gcc-4.6.1.tar.gz # change the path if you have saved the sources elsewhere!
$ tar -xjf ~/Downloads/gmp-5.0.2.tar.bz2
$ tar -xzf ~/Downloads/mpc-0.9.tar.gz
$ tar -xzf ~/Downloads/mpfr-3.0.1.tar.gz
$ cd gcc-4.6.1
$ ln -s ../gmp-5.0.2 gmp
$ ln -s ../mpc-0.9 mpc
$ ln -s ../mpfr-3.0.1 mpfr
4. Now create a build directory in ~/src but **outside** the gcc source tree, so that it can easily cleaned up to restart everything from scratch:
$ cd ~/src
$ mkdir build ; cd build
$ ../gcc-4.6.1/configure
$ make
$ make install
make installは、既存のg ++インストールには触れていないようです。私が 'print-search-dirs'を実行すると、デフォルトで4.2.1がすべて返されます。私のビルドはビルドと呼ばれるローカルディレクトリにあり、私はどのように進めるべきかわかりません。 'build/gcc/g ++ test.cc'を使ってサンプルプログラムをコンパイルしようとしたところ、問題のようなエラーが出ました。 – devnull
コンパイル中にGCCが実行しているコマンドを見てみると、 '-B'オプションを使ってコンポーネントのどこにあるのかを指し示すことができます。あなたは同じことをする必要があります。あるいは接頭辞について言及していないので、 '/ usr/local'('/usr/local/bin/g ++ ')にあります。 '/ usr/local/bin 'が'/usr/bin'よりも先になるようにPATHを並べ替えることで、 '/ usr/bin/g ++'より優先して使うことができます。 (私のPATHにはシステムディレクトリの前に '/ usr/gcc/v4.6.1/bin'があり、' $ HOME/bin'ディレクトリとシステムディレクトリの前にあるものもあります)。 –