0

私のボックスには、root ユーザーとして GCC 4.1.2 がインストールされていますが、LLVM と clang をコンパイルするには、GCC の上位バージョンが必要でした。そこで、ローカル ディレクトリに GCC 4.5.0をダウンロードしてインストールしました。

既存のプログラムで GCC 4.5.0 のライブラリとインクルードを参照するにはどうすればよいですか。

> gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

> which gcc
/usr/bin/gcc

> setenv PATH gcc-4.5.0/bin/gcc/gcc-4.5.0/bin:$PATH

> gcc --version
gcc (GCC) 4.5.0
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

> which gcc
gcc-4.5.0/bin/gcc/gcc-4.5.0/bin/gcc

システム PATH を設定するだけで役立つのでしょうか、それとも既存のコードが GCC 4.5.0 スイートを参照するために必要なことはありますか?

gcc-4.5.0/bin/gcc/gcc-4.5.0/> ls -l
total 24
drwxrwxr-x 2 prasad ppusers 4096 Jun 13 21:32 bin
drwxrwxr-x 3 prasad ppusers 4096 Jun 13 21:32 include
drwxrwxr-x 3 prasad ppusers 4096 Jun 13 21:32 lib
drwxrwxr-x 2 prasad ppusers 4096 Jun 13 21:32 lib64
drwxrwxr-x 3 prasad ppusers 4096 Jun 13 21:32 libexec
drwxrwxr-x 6 prasad ppusers 4096 Jun 13 21:32 share
4

1 に答える 1

1

これを行う最善の方法は、ビルド システムによって大きく異なります。

make (および場合によっては他のシステム) の場合、C コンパイラはCC変数で指定されるため、単に呼び出すことができます。

CC=/path/to/new/gcc make

プロジェクトがautoconfのconfigureスクリプトを使用している場合、同様のものを使用できます

./configure CC=/path/to/new/gcc
于 2012-06-14T06:32:55.390 に答える