问题
Possible Duplicate:
lgfortran not found
I must admit that my question can be considered to be very similar to lgfortran not found, but as I am a newbie in Linux I need more help and I couldn't find what I am looking for in the above post.
I have a fresh linux mint Debian edition installed and I am trying to make a lapack binding for Ada to work.
If I check for gfortran, I get:
gfortran-4.6 -v
Using built-in specs.
COLLECT_GCC=gfortran-4.6
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i486-linux-gnu/4.6/lto-wrapper
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.3-1' --with- bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --enable-targets=all --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.6.3 (Debian 4.6.3-1)
And if I locate libgfortran
, I get:
/usr/lib/gcc/i486-linux-gnu/4.6/libgfortran.a
/usr/lib/gcc/i486-linux-gnu/4.6/libgfortran.so
/usr/lib/gcc/i486-linux-gnu/4.6/libgfortran.spec
/usr/lib/gcc/i486-linux-gnu/4.6/libgfortranbegin.a
/usr/lib/i386-linux-gnu/libgfortran.so.3
/usr/lib/i386-linux-gnu/libgfortran.so.3.0.0
/usr/share/doc/libgfortran3
/var/lib/dpkg/info/libgfortran3.list
/var/lib/dpkg/info/libgfortran3.md5sums
/var/lib/dpkg/info/libgfortran3.postinst
/var/lib/dpkg/info/libgfortran3.postrm
/var/lib/dpkg/info/libgfortran3.shlibs
/var/lib/dpkg/info/libgfortran3.symbols
When I run a makefile
, I get:
make all
gcc -c cxbbase.ads
gcc -c cxbbase.ads
gnatmake cxbi.adb -largs ifinc.o -lgfortran -lm
gnatbind -x cxbi.ali
gnatlink cxbi.ali ifinc.o -lgfortran -lm
/usr/gnat/libexec/gcc/i686-pc-linux-gnu/4.5.3/ld: cannot find -lgfortran
collect2: ld returned 1 exit status
gnatlink: error when calling /usr/gnat/bin/gcc
gnatmake: *** link failed.
make: *** [cxbi] Error 4
The makefile that I'm using is here:
http://12000.org/my_notes/ada/lapack_and_blas/lapack_interf_makefile.txt
As I am very new to Linux, I would be very grateful if I could get detailed instructions on how to fix this.
Thank you
回答1:
The solution was to /usr/lib/gcc/i486-linux-gnu/4.6 to LIBRARY_PATH. This solution is discussed here on Comp Lang Ada:
https://groups.google.com/forum/#!topic/comp.lang.ada/Ii7YljKqu5M
回答2:
The versions of your GNAT and your GCC don't match. Please use the same version for both.
Your GNAT seems to be version 4.5.3, while your GCC is 4.6.3.
My guess would be that you have to update GNAT (gnat package on Debian). How did you even get your GNAT installed? Debian seems to only have 4.4 and 4.6 in the repos. Additionally, the official packages don't use /usr/gnat
at all.
来源:https://stackoverflow.com/questions/11631365/cannot-find-lgfortran-though-gfortran-is-installed