ldは-lgfortranを見つけることができません

ldは-lgfortranを見つけることができません

コンパイルしようとしています。クヌート(数学プログラム)CMakeを使用するArch Linuxでは、次のエラーが発生します。

/usr/bin/ld: cannot find -lgfortran
/usr/bin/ld: cannot find -lquadmath
collect2: error: ld returned 1 exit status
make[2]: *** [cli/CMakeFiles/knut-cli.dir/build.make:101: cli/knut-cli] Error 1
make[1]: *** [CMakeFiles/Makefile2:498: cli/CMakeFiles/knut-cli.dir/all] Error 2
make: *** [Makefile:128: all] Error 2

gfortran私は両方とも信じてインストールされ、quadmathリンクが正しいようです。

$ ls -al /usr/lib | grep "fortran"
lrwxrwxrwx   1 root root       20 Jun  3 23:11 libgfortran.so -> libgfortran.so.3.0.0
lrwxrwxrwx   1 root root       20 Jun  3 23:11 libgfortran.so.3 -> libgfortran.so.3.0.0
-rwxr-xr-x   1 root root  5858448 Jun  3 23:11 libgfortran.so.3.0.0
-rw-r--r--   1 root root      269 Jun  3 03:11 libgfortran.spec

$ ls -al /usr/lib | grep "libquadmath"
lrwxrwxrwx   1 root root       20 Jun  3 23:11 libquadmath.so -> libquadmath.so.0.0.0
lrwxrwxrwx   1 root root       20 Jun  3 23:11 libquadmath.so.0 -> libquadmath.so.0.0.0
-rwxr-xr-x   1 root root   958384 Jun  3 23:11 libquadmath.so.0.0.0

同じ.soファイルでも使用できます/usr/lib64

私はgfortranバージョン6.1.1を持っています。私はCMakeがわからないので、cmakeコマンドで変更しようとした唯一のものはaddでしたが、それは-D CMAKE_PREFIX_PATH=/usr/lib役に立ちませんでした。

問題を見つける方法に関する提案はありますか?

編集1

これを実行してもフォローアップがcmakeないと、makeすべての依存関係が満たされているようです。

- The C compiler identification is GNU 6.1.1
-- The CXX compiler identification is GNU 6.1.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The Fortran compiler identification is GNU 6.1.1
-- Check for working Fortran compiler: /usr/bin/gfortran
-- Check for working Fortran compiler: /usr/bin/gfortran  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/gfortran supports Fortran 90
-- Checking whether /usr/bin/gfortran supports Fortran 90 -- yes
-- The shell is found: /usr/bin/sh
-- The C++ runtime library is /usr/lib/gcc/x86_64-pc-linux-  gnu/6.1.1/../../../../lib/libstdc++.a
-- The FORTRAN runtime library is libgfortran.a, /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/libgcc.a and libquadmath.a
-- The DYNAMIC FORTRAN runtime library is /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../lib/libgfortran.so
-- openBLAS was found as /usr/lib64/libopenblas.so.
-- Using system UMFPACK and AMD: /usr/lib64/libumfpack.so and /usr/lib64/libamd.so.
-- The includes are at /usr/include and /usr/include.
-- Using system LAPACK and ARPACK /usr/lib64/liblapack.so;/usr/lib64/libarpack.so.
-- The mxml library is /usr/lib64/libmxml.so.
-- The mxml include directory is /usr/include.
-- --> Qt5Core found.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mark/knut/knut/build

その後、実行すると上記のエラーが発生しますmake

編集2

私の/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/に静的ライブラリは含まれていlibgfortran.aませんlibquadmath.a。出力結果gcc-4.8.5によると、cmakeこれら2つのライブラリにパスが指定されていないため、見つかりませんでした。

今、これが何を意味するのかよく分からない。これが私のgfortranのインストールに問題があるのか​​、それとも別の問題ですか?

6月24日3日修正

libgfortranの問題はArchに限定されているようです。明らかに、静的ライブラリは通常Archにパッケージされていません。これがDebianの同じgcc-fortranパッケージにlibgfortran.aファイルとlibquadmath.aファイルが含まれているが、Archに含まれていない理由です。options=('staticlibs')次回コンパイル時に静的ライブラリを含めるようにPKGBUILDのオプションを変更しました。腹部の筋肉)。その後、生成されたlibgfortran.aファイルとlibquadmath.aファイルをここにコピーしましたが、/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/libgfortranの問題が解決したようです。

ただし、Knud Larsenが言及したQt5エラーが発生します。

ベストアンサー1


https://github.com/rs1909/knut/tree/master/knut

/usr/bin/ld: 見つかりません -lgfortran

/usr/bin/ld: -lquadmath が見つかりません

knut/knut/knut.spec.cmakeを読む→ビルド要件:libgfortran-static ....これはlibgfortranです。

-lquadmath 次のようになります。 libquadmath.a

(私のcmake設定にエラーはありません。Makefileが作成されました。)


6月23日編集1:上記は単なる例の構成であるようです。 Makefile が生成されます。

ビルド例:PCLinuxOS 2016、CentOS 7、Fedora 24はQt5エラーのため失敗します。

  • Debian 8 Jessie: 問題ありません。 cmakeがknut/knut/build/src/config.h.$makeと#でmake install動作することを除いてください。 gfortranとg ++のバージョンは4.9.2です。 "libgfortran-4.9-dev"はlibgfortran.a、libquadmath.aを提供します。

6月23日編集2:Ubuntu 16.04でビルド...最新のコンパイラgcc-5.3.1を試しました...

cd knut/knut/build/ && CC=gcc-5 CXX=g++-5 FC=gfortran-5 cmake .. && make && sudo make install
  • 大丈夫です。

編集3:gcc / g ++ / gfortranバージョンでknutをテストする6.1.1→ Debian 9 拡張。

CC=gcc-6 CXX=g++-6 FC=gfortran-6 cmake .. && make ; # make install
  • 大丈夫です。

編集4:ビルド要件..#apt-get install g++ libopenblas-dev libqt5svg5-dev

上記のすべてで私が結論付けることができるのは、使用されたQt5が適切でなければならないということです。 Qt5構成に違いがある可能性がありますか?スポット? ...Qt5ファイルの場所には大きな違いはありません。

おすすめ記事