2

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

jww
  • 97,681
  • 90
  • 411
  • 885
yCalleecharan
  • 4,656
  • 11
  • 56
  • 86

2 Answers2

2

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

yCalleecharan
  • 4,656
  • 11
  • 56
  • 86
1

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.

Rommudoh
  • 1,844
  • 10
  • 11
  • @ oenone. Thanks. I installed the GNAT GPL from Adacore libre. I had the Debian packaged Ada (stable) version 4.4 earlier but the makefile stopped just after 2 lines. So I assumed there was a problem with the GNAT. This is why I went for GNAT GPL that is not packaged for Debian. – yCalleecharan Jul 24 '12 at 14:09
  • With the GNAT GPL, the makefile is executed longer (i.e. more lines) than with the GNAT 4.4 but then I get the complain about lgfortran. But do u really believe it is GNAT's fault or something with lgfortran or gfortran? Thanks. – yCalleecharan Jul 24 '12 at 14:11
  • Yes I noticed that the official or packaged debian GNAT uses /usr/bin/gcc and not /usr/gnat/bin/gcc. 1 vote up. – yCalleecharan Jul 24 '12 at 14:12