MPIを用いたFortranプログラムのコンパイル エラー

このQ&Aのポイント
  • PHASE ver. 4.00をダウンロードしてmakeしようとした際にエラーが発生しました
  • エラーメッセージにはglibcと関連しているようですが、対処法が分かりません
  • OSはFedora Core 5 Linux、Fortranコンパイラはintel Fortran Compiler 9.0 for Linux、Cコンパイラはgcc、MPIはmpich-1.2.7を使用しています
回答を見る
  • ベストアンサー

MPIを用いたFortranプログラムのコンパイル エラー

前回(http://okwave.jp/kotaeru.php3?q=2361804)に続いてエラーで困っています。 バンド構造などをシミュレーションできるソフトPHASE ver. 4.00を下のサイトからダウンロードし、makeしようとしたのですが出来ません。 http://www.fsis.iis.u-tokyo.ac.jp/result/software/? OS Fedora Core 5 Linux Fortranコンパイラ intel Fortran Compiler 9.0 for Linux Cコンパイラ gcc MPI mpich-1.2.7 PHASEはMPIを使ったFortranのプログラムで、オブジェクトファイルは作られたのですが、最後のリンクのところで下のようなエラーが出てしまいます。 /opt/intel/fc/9.0/lib/libifcore.a(for_open_proc.o): In function `for__compute_filename.':./src/libfor/for_open_proc.c:(.text+0xc14): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /opt/intel/mpich/lib/libmpich.a(p4_secure.o): In function `start_slave':p4_secure.c:(.text+0x80): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking この後に次のような/usr/lib/libc.a ... undefined reference to ...という形のエラーが43行あります。 /usr/lib/libc.a(iofclose.o):(.eh_frame+0x121): undefined reference to `__gcc_personality_v0' /usr/lib/libc.a(iofflush.o): In function `fflush': undefined reference to `_Unwind_Resume' どうやらglibcが関係しているような気がするのですが、自分ではどうすればよいのか分かりません。 エラーの意味とその対処法をお願いします。

質問者が選んだベストアンサー

  • ベストアンサー
  • chirubou
  • ベストアンサー率37% (189/502)
回答No.1

/opt/intel/fc/9.0/lib/libifcore.a(for_open_proc.o): In function `for__compute_filename.':./src/libfor/for_open_proc.c:(.text+0xc14): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking リンクのオプションで static の指定があるのではないでしょうか。最近の Linux では static にリンクしようとすると上記のメッセージがでますが、無視しても大丈夫です。 問題は、ndefined reference の方ですが、情報が少ないので憶測ですが、gcc を C のコンパイルに使っているのが問題なようなきがします。Intel の C コンパイラを PHASE のビルドに使うとどうなるでしょう?

ha2ru2
質問者

お礼

Linux用のBorland C++ Compilerが存在しないようなので残念です。 Googleで"libc.a __gcc_personality_v0"と検索すると同様なエラーメッセージが沢山ありましたので、参考にしてみようと思います。 回答どうもありがとうございました。

ha2ru2
質問者

補足

回答ありがとうございます。 遅くなりましたが、gccの代わりにiccを指定してPHASEをビルドしたところ、gccの場合と全く同じエラーが出ました。 iccを指定してもエラーの中にusr/lib/libc.aと`__gcc_personality_v0'という文字が入っている理由が分かりません。 makefileを見た限りlibc.aをリンクする指定はないのですが、libc.aというのはC言語関係の処理の際には自動的に参照されるものなのですか?その中でgccという特定のコンパイラの名前が入っているのも不思議です。 先に書いてませんでしたが、PHASEのソースはFortranのコンパイルの前にC言語プリプロセッサで前処理をするようになっており、そのC言語プリプロセッサとしてcppを指定しています。もしかしたらこれが関係しているかもしれないので、C言語プリプロセッサとしてcppの代わりにBorland C++ Compiler 5.5のcpp32を、Cコンパイラとしてgccの代わりにbcc32を使ってみようかなと思っています。 それにしても、PHASEだけが使うわけではないlibc.aが未定義のものを参照しているということは、LINUXのC言語開発環境なら当然あるべきものが不足しているということなのでしょうか…

関連するQ&A

  • Fedora7で libpthread.aをリンクすると、コンパイルエラーになってしまいました

    はじめまして、 Fedora7でマルチスレッドのプログラムをビルドし、 libpthread.aをリンクしたところ、コンパイルエラーになってしまいました。 Fedora4~5では、起きなかったため、 libpthread.aのバージョン変更により、問題がおきたのではないかと思っております。 libpthreadのバージョンは2.6-4で [root@localhost]# rpm -qf /usr/lib/libpthread.a glibc-devel-2.6-4 glibc-develをダウングレードしようと思いましたが、 glibc-commonの依存関係が厳しく、forceしてもうまくいきませんでした。 makeのエラーは下記の内容で、main.cppにlibpthread.aをリンクしてビルドすると、 libpthread.a内で使ってる関数がundefinedでこけてしまいます。 ネットを検索して、pthreadのについて書かれているサイトを読みましたが、あまり見つからずどうして良いやらわからない状態です。 ttp://uyota.asablo.jp/blog/2007/01/27/1142762 Fedora7でlibpthread.aをリンクし、 undefinedを回避して、うまくビルドする方法をご存知でしたら、お教えください。 ---------------- エラー内容 [root@localhost test]# make make clean make[1]: ディレクトリ `/src/test' に入ります rm Main.o removed `Main.o' make[1]: ディレクトリ `/src/test' から出ます make test make[1]: ディレクトリ `/src/test' に入ります g++ -c -o Main.o Main.cpp g++ -o test Main.o /usr/lib/libpthread.a -lpthread /usr/lib/libpthread.a(pthread_create.o): In function `pthread_create': (.text+0xca3): undefined reference to `_dl_stack_flags' /usr/lib/libpthread.a(pthread_create.o): In function `pthread_create': (.text+0x1126): undefined reference to `_dl_stack_flags' /usr/lib/libpthread.a(ptw-accept.o): In function `accept': (.text+0x23): undefined reference to `__syscall_error' /usr/lib/libpthread.a(ptw-accept.o): In function `accept': (.text+0x52): undefined reference to `__syscall_error' /usr/lib/libpthread.a(ptw-send.o): In function `__send': (.text+0x23): undefined reference to `__syscall_error' /usr/lib/libpthread.a(ptw-send.o): In function `__send': (.text+0x52): undefined reference to `__syscall_error' /usr/lib/libpthread.a(ptw-pause.o): In function `__pause_nocancel': (.text+0x18): undefined reference to `__syscall_error' /usr/lib/libpthread.a(ptw-pause.o):(.text+0x3b): more undefined references to `__syscall_error' follow /usr/lib/libpthread.a(init.o): In function `__pthread_initialize_minimal': (.text+0x16c): undefined reference to `__libc_setup_tls' /usr/lib/libpthread.a(init.o): In function `__pthread_initialize_minimal': (.text+0x328): undefined reference to `_dl_init_static_tls' /usr/lib/libpthread.a(init.o): In function `__pthread_initialize_minimal': (.text+0x34d): undefined reference to `_dl_wait_lookup_done' /usr/lib/libpthread.a(ptw-read.o): In function `__read_nocancel': (.text+0x26): undefined reference to `__syscall_error' /usr/lib/libpthread.a(ptw-read.o): In function `__read_nocancel': (.text+0x56): undefined reference to `__syscall_error' /usr/lib/libpthread.a(ptw-open.o): In function `__open_nocancel': (.text+0x26): undefined reference to `__syscall_error' /usr/lib/libpthread.a(ptw-open.o): In function `__open_nocancel': (.text+0x56): undefined reference to `__syscall_error' /usr/lib/libpthread.a(sigaction.o): In function `__libc_sigaction': (.text+0x60): undefined reference to `_dl_sysinfo_dso' /usr/lib/libpthread.a(sigaction.o): In function `sigaction': (.text+0x19a): undefined reference to `_dl_sysinfo_dso' collect2: ld はステータス 1 で終了しました make[1]: *** [test] エラー 1 make[1]: ディレクトリ `/src/test' から出ます make: *** [build] エラー 2 -- [root@localhost]# cat /etc/ld.so.conf /usr/lib include ld.so.conf.d/*.conf

  • MPIを用いたFortranプログラムのコンパイル

    バンド構造などをシミュレーションできるソフトPHASE ver. 4.00を下のサイトからダウンロードし、makeしようとしたのですが出来ません。 http://www.fsis.iis.u-tokyo.ac.jp/result/software/ エプソンダイレクト TP715LR CPU名称 Pentium III CPU動作周波数 700MHz メモリ 128MB OS Fedora Core 5 Linux Fortranコンパイラ intel Fortran Compiler 9.0 for Linux Cコンパイラ gcc MPI mpich-1.2.7 PHASEはMPIを使ったFortranのプログラムで、オブジェクトファイルは作られたのですが、最後のリンクのところで IPO link: can not find -lfmpich というエラーメッセージが出てしまいます。 リンクはifortで、オプションに-lfmpich -lmpichなどを指定しました。 -lのオプションは後に続くディレクトリ名をライブラリの検索先として指定するようなので、どこかにfmpichというディレクトリがあるかどうか調べたのですが存在しませんでした。本来ならばどこかにあるものなのでしょうか。

  • コンパイル時のエラー

    UNIXでサーバー、クライアントのCプログラミングをテキストどおりに書いてコンパイルしたのですが、以下のエラーが出ます。gcc, ccでコンパイルすると以下のようになるのですが、これはどういうことなのでしょうか?何が原因なのでしょうか?よろしくお願いいたします。 gcc unix_server.c /var/tmp/ccvpay1f1.o: In function `main': /var/tmp/ccvpay1f1.o(.text+0x8c): undefined reference to `socket' /var/tmp/ccvpay1f1.o(.text+0x104): undefined reference to `unllnk' /var/tmp/ccvpay1f1.o(.text+0x118): undefined reference to `bind' /var/tmp/ccvpay1f1.o(.text+0x150): undefined reference to `listen' /var/tmp/ccvpay1f1.o(.text+0x1a8): undefined reference to `accept' cc unix_server.c ld: /usr/lib/cmplrs/cc/crtn.o: Error: Unresolved: rindex socket bzero bcopy unllnk bind listen accept

  • sendmailのコンパイルエラーについて

    教えてください。>_< お願いします。 sendmail-8.12.2のインストールを試みたのですが、 エラーが返ってきます。 このエラーの意味、対処法などご存知の方 教えてください。 <エラー内容> domain.o: In function `getmxrr': domain.o(.text+0x25f): undefined reference to `__res_query' domain.o(.text+0x266): undefined reference to `__res_search' domain.o(.text+0x39b): undefined reference to `__dn_skipname' domain.o(.text+0x496): undefined reference to `__dn_expand' domain.o(.text+0x603): undefined reference to `__dn_expand' domain.o: In function `dns_getcanonname': domain.o(.text+0xf0c): undefined reference to `__res_querydomain' domain.o(.text+0x100f): undefined reference to `__dn_skipname' domain.o(.text+0x123f): undefined reference to `__dn_expand' domain.o(.text+0x128a): undefined reference to `__dn_expand' sm_resolve.o: In function `parse_dns_reply': sm_resolve.o(.text+0x17e): undefined reference to `__dn_expand' sm_resolve.o(.text+0x1fe): undefined reference to `__dn_expand' sm_resolve.o(.text+0x2e5): undefined reference to `__dn_expand' sm_resolve.o(.text+0x337): more undefined references to `__dn_expand' follow sm_resolve.o: In function `dns_lookup_int': sm_resolve.o(.text+0x612): undefined reference to `__res_search' collect2: ld returned 1 exit status make: *** [sendmail] エラー1 gccはバージョン2.96-81です。 OSはRedhatLinux7.1Jです。 よろしくお願いします。m(_)m

  • FortranのG95コンパイルエラー

    お世話になります。 先日業務の参考に技術書を購入しました。 その技術書には計算するためのFotranのソースプログラムが付属されており、それを実行するためコンパイラのG95をインストールしました。 ですがコンパイルを実行すると以下のエラーが出てしまいます。 c:/g95/bin/../lib/gcc-lib/i686-pc-mingw32/4.1.2//libf95.a(main.o):(.text+0x32):undefined reference to `_MAIN_' このエラーをグーグルで「libf95.a(main.o)」をキーワードに調べてみましたが英語のページに当たり、まるで理解できませんでした。 G95は技術書の付属CDに入っていたので出来るはずなのですが。 このエラーの原因をご存知の方がいらしたらよろしくお願いします。 [追記] OSはXPのSP3です。

  • g95プログラムからg++関数を呼び出したい。

    g95プログラムからg++関数を呼び出したい。 いつもお世話になっています。 Fortran(g95)プログラムからg++関数を呼び出したいのですが、 実行できません。 どのようにすればよいか、教えて頂けませんでしょうか。 (ちなみにg77からC++を呼ぶことはできました。) ===環境設定=== OS:WindowsXP(pro) C++コンパイラ :MinGW g++ (gcc version 3.4.5) Fortranコンパイラ:MinGW g95 (gcc version 4.1.2) Fortranコンパイラ:MinGW g77 (gcc version 3.4.5) ===使用したソース=== <Fortran> ファイル名:f.f    write(*,*) "Hello Fortran World."    call funchelloc()    end ※実際には、各行先頭に半角スペース6個が入ります。 <C++> ファイル名:funcC.cpp #include <stdio.h> #include <iostream> int main(void) {   printf("hello C world!\n");   return 0; } ※見やすくするため、全角スペースでインデントしています。 ===実行手順=== >g++ -c funcC.cpp >g95 -c f.f >g95 f.o funcC.o -lstdc++ c:/mingw/lib///libstdc++.a(eh_throw.o):eh_throw.cc:(.text+0x7b): undefined reference to `_ _w32_sharedptr_unexpected' c:/mingw/lib///libstdc++.a(eh_throw.o):eh_throw.cc:(.text+0x8c): undefined reference to `_ _w32_sharedptr_terminate' c:/mingw/lib///libstdc++.a(eh_globals.o):eh_globals.cc:(.text+0x4e): undefined reference t o `__w32_sharedptr' c:/mingw/lib///libstdc++.a(eh_globals.o):eh_globals.cc:(.text+0xb9): undefined reference t o `__w32_sharedptr' c:/mingw/lib///libstdc++.a(eh_globals.o):eh_globals.cc:(.text+0x179): undefined reference to `__w32_sharedptr' c:/mingw/lib///libstdc++.a(eh_globals.o):eh_globals.cc:(.text+0x186): undefined reference to `__w32_sharedptr' c:/mingw/lib///libstdc++.a(eh_globals.o):eh_globals.cc:(.text+0x1e3): undefined reference to `__w32_sharedptr' c:/mingw/lib///libstdc++.a(eh_globals.o):eh_globals.cc:(.text+0x1ef): more undefined refer ences to `__w32_sharedptr' follow c:/mingw/lib///libstdc++.a(eh_terminate.o):eh_terminate.cc:(.text+0x67): undefined referen ce to `__w32_sharedptr_terminate' c:/mingw/lib///libstdc++.a(eh_terminate.o):eh_terminate.cc:(.text+0x97): undefined referen ce to `__w32_sharedptr_unexpected' c:/mingw/lib///libstdc++.a(eh_terminate.o):eh_terminate.cc:(.text+0xb3): undefined referen ce to `__w32_sharedptr_terminate' c:/mingw/lib///libstdc++.a(eh_terminate.o):eh_terminate.cc:(.text

  • minidlnaのコンパイルが通りません

    CentOS 5.4 2.6.18-164.6.1.el5 i386 Sony BraviaでのDLNA視聴を目論み、 http://mypace75.blog92.fc2.com/blog-entry-725.html http://d.hatena.ne.jp/ka_maru/20090918/1253273660 この辺りを参考にminidlnaの導入を試みています。 ライブラリ依存のエラーはyumで消えましたがSQLiteでこけるようです。 以下、makeの出力です。 $ make Linking minidlna upnpsoap.o: In function `SearchContentDirectory': /home/user/minidlna/upnpsoap.c:1149: undefined reference to `sqlite3_malloc' upnpsoap.o: In function `BrowseContentDirectory': /home/user/minidlna/upnpsoap.c:972: undefined reference to `sqlite3_malloc' sql.o: In function `sql_get_text_field': /home/user/minidlna/sql.c:147: undefined reference to `sqlite3_prepare_v2' /home/user/minidlna/sql.c:183: undefined reference to `sqlite3_malloc' sql.o: In function `sql_get_int_field': /home/user/minidlna/sql.c:82: undefined reference to `sqlite3_prepare_v2' collect2: ld はステータス 1 で終了しました make: *** [minidlna] エラー 1 /usr/include/sqlite3.hは存在しますが、ファイル内を検索しても sqlite3_prepare_v2は無いようです。 yumで確認したところ、sqlite sqlite-devel sqlitemanagerは最新です。 よろしくお願いします。

  • Apace2のインストールでエラー

    VMware PlayerにCentOS5をインストールしてApache2をソースファイルからインストールしようとしているのですが、Apacheのインストールができません。状況は下記の通りです。 # wget ftp://ftp.riken.jp/net/apache/httpd/httpd-2.2.4.tar.gz # tar -xvzf httpd-2.2.4.tar.gz # cd httpd-2.2.4 ここでapr/apr-utilをアップグレードする必要があるということで http://httpd.apache.org/docs/2.2/ja/install.html の「apr/apr-util >= 1.2」を参考にしながら下記の操作を行いました。 # cd srclib/apr # ./configure --prefix=/usr/local/apr-httpd/ # make # make install # make clean # cd ../apr-util # ./configure --prefix=/usr/local/apr-util-httpd/ --with-apr=/usr/local/apr-httpd/ # make # make install # make clean # cd ../../ # ./configure --with-apr=/usr/local/apr-httpd/ --with-apr-util=/usr/local/apr-util-httpd/ (省略) /usr/local/apr-httpd//build-1/libtool --silent --mode=link gcc -g -O2 -pthread -L/usr/local/apr-util-httpd//lib -o htpasswd htpasswd.lo -lm /home/minoru/dl_app/httpd-2.2.4/srclib/pcre/libpcre.la /usr/local/apr-util-httpd//lib/libaprutil-1.la -lexpat /usr/local/apr-httpd//lib/libapr-1.la -lrt -lcrypt -lpthread -ldl /usr/local/apr-util-httpd//lib/libexpat.so: undefined reference to `XmlSizeOfUnknownEncoding' /usr/local/apr-util-httpd//lib/libexpat.so: undefined reference to `XmlInitUnknownEncoding' /usr/local/apr-util-httpd//lib/libexpat.so: undefined reference to `XmlInitEncodingNS' /usr/local/apr-util-httpd//lib/libexpat.so: undefined reference to `XmlUtf8Encode' /usr/local/apr-util-httpd//lib/libexpat.so: undefined reference to `XmlGetUtf8InternalEncoding' /usr/local/apr-util-httpd//lib/libexpat.so: undefined reference to `XmlGetUtf8InternalEncodingNS' /usr/local/apr-util-httpd//lib/libexpat.so: undefined reference to `XmlPrologStateInit' /usr/local/apr-util-httpd//lib/libexpat.so: undefined reference to `XmlParseXmlDeclNS' /usr/local/apr-util-httpd//lib/libexpat.so: undefined reference to `XmlInitUnknownEncodingNS' /usr/local/apr-util-httpd//lib/libexpat.so: undefined reference to `XmlParseXmlDecl' /usr/local/apr-util-httpd//lib/libexpat.so: undefined reference to `XmlInitEncoding' /usr/local/apr-util-httpd//lib/libexpat.so: undefined reference to `XmlPrologStateInitExternalEntity' collect2: ld returned 1 exit status make[2]: *** [htpasswd] エラー 1 make[2]: ディレクトリ `/home/minoru/dl_app/httpd-2.2.4/support' から出ます make[1]: *** [all-recursive] エラー 1 make[1]: ディレクトリ `/home/minoru/dl_app/httpd-2.2.4/support' から出ます make: *** [all-recursive] エラー 1 どなたかわかる方、御教示願います。

  • コンパイルエラーの意味

    最近プログラミングの勉強を始めた初心者です。作成したプログラムをコンパイルしたところ以下のようなエラーが出ましたがなんのエラーなのかまったく分かりません… 初歩的な質問で申し訳ありませんが教えてください! /user/lib/libcygwin.a(libcmain.o)(.text+0x6a):libcmain.c: undefined reference to'WinMain@16' collect2: ld returned 1 exit status

  • C++の関数をfortranから呼びたい。(g++, g77)

    C++の関数をfortranから呼びたい。(g++, g77) いつもお世話になっています。 現在WindowsXPにMinGWというソフトを入れて C++のコンパイルはg++を Fortranのコンパイルはg77を 使用しています。 (いずれも動作は確認できています。) 現在、以下のようなソースを使用して fortranからC++関数を呼ぼうとしていますが できておりません。 ソース内容、コンパイル方法に問題があれば ご指摘頂きたくお願いします。 ■C++ソース #include <stdio.h> #include <iostream> extern "C" void funcHelloC_(); void funcHelloC_(void) { printf("hello C world!\n"); } ■fortranソース    write(*,*) "Hello Fortran World."    call funcHelloC()    end ※実際のソースの各文先頭には、半角スペース6つ分が  記述しています。 ■コンパイル手順 D:\C>g++ -c funcHelloC.cpp D:\C>g77 -c helloFortran.f D:\C>g77 helloFortran.o funcHelloC.o helloFortran.o(.text+0x51):helloFortran.f: undefined reference to `funchelloc_' funcHelloC.o(.text+0xd):funcHelloC.cpp: undefined reference to `_ZNKSs4sizeEv' funcHelloC.o(.text+0x60):funcHelloC.cpp: undefined reference to `_ZNKSsixEj' funcHelloC.o(.text+0x9e):funcHelloC.cpp: undefined reference to `_ZNKSsixEj' funcHelloC.o(.text+0xcc):funcHelloC.cpp: undefined reference to `_ZNKSsixEj' funcHelloC.o(.text+0x12f):funcHelloC.cpp: undefined reference to `_ZNSt8ios_base4InitC1Ev' funcHelloC.o(.text+0x14a):funcHelloC.cpp: undefined reference to `_ZNSt8ios_base4InitD1Ev'

専門家に質問してみよう