Intel Compilerを初めて使ってみた
Intel Compiler 9.0が使われないまま棚に眠っていたので今日からオイラノモノにすることに。
インストールはinstall.shとかいうスクリプトで実行。CUI環境でインストールできるやつだった。
対話型CUIインストーラを相手にEnterを押したり"accept"って入力したりなんどかやっているとインストールが完了していた。
デフォルトでは以下のパスにインストールされたようだ。
/opt/intel/cc/9.0
なんだかEclipseまで入ってるらしい。そのためJRockitのインストールとかも行われた。えぇぇぇ。
mir@t43:/opt/intel/cc/9.0$ ll 合計 32 drwxr-xr-x 2 root root 4096 8月 23 15:01 bin/ drwxr-xr-x 6 root root 4096 8月 23 15:00 doc/ drwxr-xr-x 4 root root 4096 8月 23 15:00 eclipse/ drwxr-xr-x 3 root root 4096 8月 23 15:00 include/ drwxr-xr-x 3 root root 4096 8月 23 15:00 lib/ drwxr-xr-x 2 root root 4096 8月 23 15:00 licenses/ drwxr-xr-x 3 root root 4096 8月 23 15:00 man/ drwxr-xr-x 2 root root 4096 8月 23 14:59 substitute_headers/
iccとかのコマンドはbinディレクトリに、Intelお手製ライブラリはlibディレクトリに入っている。
で、とりあえずビルドを試してみるため、この間つくったhello world用のhello.cをビルドしてみることにした。/usr/binとかに入っている訳では無いので、/opt/intel/cc/9.0/binにPATHを通してから実行。
mir@t43:~/scratch/hello_autotools$ icc hello.c Command-line error: invalid GNU version number: 411 compilation aborted for hello.c (code 4)
でもこんな感じでエラーになる。えぇぇ、GNU?? gcc??
ちょっと調べてみたらどうやらiccでビルドするためにはgccが必要らしい(なんだそりゃ・・・)。
mir@t43:~/scratch/hello_autotools$ gcc -v Using built-in specs. Target: i386-redhat-linux コンフィグオプション: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux スレッドモデル: posix gcc バージョン 4.1.1 20070105 (Red Hat 4.1.1-52)
しかも、icc9.0は、gcc4.1.1とかだとだめらしい。gccのバージョンが新しすぎるのだ。
そこで、yumでcompat-gccなんちゃらパッケージをいろいろ入れる。
/usr/bin/gcc34というgcc 3.4.6なやつが入ったので、こいつを指定してiccを実行する。
mir@t43:~/scratch/hello_autotools$ icc -gcc-name=/usr/bin/gcc34 hello.c Warning #1610: Could not open message catalog mcpcom.cat in NLSPATH/LANG. Using internal messages.
なんかよくわからないWarningでてるけど、いちおうa.outはできた。
lddしてみる。
mir@t43:~/scratch/hello_autotools$ ldd a.out linux-gate.so.1 => (0x00400000) libimf.so => not found libm.so.6 => /lib/i686/nosegneg/libm.so.6 (0x00cd9000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00b62000) libc.so.6 => /lib/i686/nosegneg/libc.so.6 (0x00b96000) /lib/ld-linux.so.2 (0x00b74000)
おぉっ! libimfってのはIntelライブラリかな!?
/etc/ld.so.confに/opt/intel/icc/9.0/libを追加してldconfigした後、実行。
mir@t43:~/scratch/hello_autotools$ ./a.out Hello World!
できたできた。