gcc-4.6.1を使用してソースからgcc-4.7.2をコンパイルしようとしています。
まず、contrib / download_prerequisitesを実行して必要なパッケージをダウンロードしてから、LFShttp://www.linuxfromscratch.org/blfs/view/svn/general/gcc.htmlの指示に従います。
実行するmake bootstrap
と、次のエラーメッセージが表示されます。
In file included from ../../gcc-4.7.2/gcc/c-lang.c:24:0:
../../gcc-4.7.2/gcc/system.h:499:20: error: conflicting types for ‘strsignal’
/usr/include/string.h:566:14: note: previous declaration of ‘strsignal’ was here
私の状況はここに投稿されたものと同じです:http://gcc.gnu.org/ml/gcc-help/2011-12/msg00062.html。理由も同じです。gccは間違ったを検出しますconfig.h
。これは現在のディレクトリにあるはずですが、実際には。の下にあるものを使用しgmp
ます。
その理由は、コマンドラインが-I.
他のすべての-I
オプションの前に指定していても-I.
、すでに標準の検索パスにあるため無視されるためです。これが私が実行して得たメッセージですgcc -v
:
ignoring duplicate directory "."
as it is a non-system directory that duplicates a system directory
この問題に関連するパス検索の順序は次のとおりです(http://gcc.gnu.org/onlinedocs/cpp/Search-Path.html):「唯一の例外は、デフォルトでdirがすでに検索されている場合です。この場合、このオプションは無視され、システムディレクトリの検索順序は変更されません。」
-I
オプションで指定された他のパスの前にgccに現在のディレクトリを検索させるにはどうすればよいですか?
エラーメッセージを生成するコマンドは次のとおりです。
gcc -c -DIN_GCC_FRONTEND -g -fkeep-inline-functions -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat -fno-common -DHAVE_CONFIG_H -I. -I. -I../../gcc-4.7.2/gcc -I../../gcc-4.7.2/gcc/. -I../../gcc-4.7.2/gcc/../include -I../../gcc-4.7.2/gcc/../libcpp/include -I/home/dwang/Downloads/gcc-build/./gmp -I/home/dwang/Downloads/gcc-4.7.2/gmp -I/home/dwang/Downloads/gcc-build/./mpfr -I/home/dwang/Downloads/gcc-4.7.2/mpfr -I/home/dwang/Downloads/gcc-4.7.2/mpc/src -I../../gcc-4.7.2/gcc/../libdecnumber -I../../gcc-4.7.2/gcc/../libdecnumber/bid -I../libdecnumber ../../gcc-4.7.2/gcc/c-lang.c -o c-lang.o
ありがとう。