Intel Cコンパイラ(icc)10

既に英語版ではIntel C Compiler(icc)10.1が出たようですが,それほどメジャーなバージョンアップじゃないようだったので,とりあえず以前にicc 9を入れた経験を元に,買ってあったicc 10.0をlinuxにインストールしました.
しかし,すぐには動きません.
とりあえずインストールスクリプトを走らせ,ライセンス番号を入れてインストール完了させると,自動的にテストプログラムの実行結果が表示されます.まずは,エラーが出ました.

compilation aborted for /tmp/test_cc.18540.cpp (code 4)

                                                                                                        • -

Problems with C++ compiler: !=

                                                                                                        • -

こちらはログを見たら原因が分かりました.

result.h:426: undefined reference to`__cxa_allocate_exception'
result.h:426: undefined reference to`std::allocator::allocator()'
result.h:426: undefined reference to`std::basic_string, std::allocator >::basic_string(charconst*, std::allocator const&)'
result.h:426: undefined reference to`__cxa_throw'

という具合で,いかにも根本的にC++が動いていない気配.これは以前にicc9をインストールした時に,グーグル先生で調べたヤツでした.
http://157.82.240.165/~yousuke/keisannki/faq.html

Q2-4 ifort(バージョン8.1)をインストールしたがコンパイルしようとすると
ifort: error: could not find directory in which g++ resides
とのエラーが出て使えない。


Q2-4 環境変数GXX_ROOTを設定することで正常にコンパイルできるようになります。

$ gcc --print-search-dirs

でインストールされたディレクトリを探し、

$ export GXX_ROOT=/usr/lib/gcc-lib/i386-vine-linux/3.3.2/ (bash)
$ setenv GXX_ROOT /usr/lib/gcc-lib/i386-vine-linux/3.3.2/ (tcsh)

のように環境変数を設定します。

そこで,icc 9.0の時は,以下のようにしていました.

export GXX_ROOT=/usr/lib/gcc/i386-redhat-linux/4.1.1/

なので今回もその環境変数のパス設定をしてみたのですが...やはりダメでした.

/tmp/test_cc.18540.cpp(2): catastrophic error: could not open source
file "iostream.h"
#include
^
compilation aborted for /tmp/test_cc.18540.cpp (code 4)

                                                                                                        • -

Problems with C++ compiler: !=

                                                                                                        • -

iccgccも,コンパイルの時にオプション「-v」を付けると,includeやリンクを探す足跡を表示してくれます.そのオプションを付けて見てみると,ちょっとだけ気になるところがありました.includeパスとして,

/usr/lib/gcc/i386-redhat-linux/4.1.1//

を探していました.
そこで,わずか一バイトを変更してみました.

export GXX_ROOT=/usr/lib/gcc/i386-redhat-linux/4.1.1

オッケー.icc 10.0でHello, Worldは通りました.
そこで次に,mysql-proxyをiccコンパイルすると,やはり明らかに根本的におかしいエラーが.

% icc -v -o resetdb resetdb_resetdb.o -L/usr/local/mysql/lib/
-L. -lz -lmysqlpp_util -lmysqlclient_r -lmysqlpp -lz -lstdc++

./libmysqlpp_util.a(util_util.o): In function
`mysqlpp::Result::at(unsigned int) const'
:
./mysql++-2.3.2/lib/result.h:426: undefined reference to `__cxa_allocate_exception'
./mysql++-2.3.2/lib/result.h:426: undefined reference to `std::allocator::allocator()'
./mysql++-2.3.2/lib/result.h:426: undefined reference to `std::basic_string, std::allocator >::basic_string(char const*, std::allocator const&)'

cxaやらallocatorって,明らかに根本的なライブラリがリンクされてないだけだろうということで,Makefileに次のような訂正を入れてみました.

LDFLAGS += -lstdc++

はい,とりあえず,コンパイルは通りました.
まだちょっと挙動がおかしいですが,それはまた報告致します.