gfortran missing /usr/lib/libgfortran.so

Bug #156524 reported by John Pye
12
Affects Status Importance Assigned to Milestone
gcc-4.2 (Ubuntu)
Invalid
Low
Matthias Klose

Bug Description

Binary package hint: gcc-4.2

As of Ubuntu 7.10, there is no longer a file in /usr/lib/libgfortran.so, which means that I can't easily create link my fortran code to my C code any more. Previously I was able to use the following, but it now fails:

gcc -o solvers/lsode/liblsode_ascend.so -g -shared solvers/lsode/lsode.os solvers/lsode/asc_lsode.os solvers/lsode/linpack/d1mach.os solvers/lsode/linpack/dgbfa.os solvers/lsode/linpack/dgbsl.os solvers/lsode/linpack/dgefa.os solvers/lsode/linpack/dgesl.os -L. -lm -lblas -lgfortran -lascend

I do see that I have /usr/lib/gcc/i486-linux-gnu/4.2.1/libgfortran.so

What is the proposed approach in such a case as this now? Shouldn't there still be a symlink in /usr/lib/libgfortran.so?

Cheers
JP

Revision history for this message
Rafael de Pelegrini Soares (rafael-rps) wrote :

Hi JP,

Same problem here. I've posted some tips on Bug #158673

Tchau.

Revision history for this message
John Pye (jdpipe) wrote :

Ubuntu 7.04:

apt-get install gfortran automatically gives me libgfortran1-dev installed by dependencies.

jpye@ascend:~/ascend$ dpkg -L libgfortran1-dev
/.
/usr
/usr/share
/usr/share/doc
/usr/lib
/usr/lib/libgfortran.a
/usr/lib/libgfortran.la
/usr/lib/libgfortranbegin.a
/usr/lib/libgfortranbegin.la
/usr/lib64
/usr/lib64/libgfortran.a
/usr/lib64/libgfortran.la
/usr/lib64/libgfortranbegin.a
/usr/lib64/libgfortranbegin.la
/usr/share/doc/libgfortran1-dev
/usr/lib/libgfortran.so
/usr/lib64/libgfortran.so

jpye@ascend:~/ascend$ ls -l /usr/lib/libgfortran.so
lrwxrwxrwx 1 root root 20 2007-11-11 19:14 /usr/lib/libgfortran.so -> libgfortran.so.1.0.0

Ubuntu 7.10:

"apt-get install gfortran" does *NOT* install libgfortran2-dev:

john@thunder:~/ascend$ sudo apt-get install gfortran
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  gfortran-4.2 libgfortran2 libmpfr1ldbl
Suggested packages:
  gfortran-multilib gfortran-doc gfortran-4.2-multilib gfortran-4.2-doc
The following NEW packages will be installed:
  gfortran gfortran-4.2 libgfortran2 libmpfr1ldbl
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 3375kB of archives.

In fact it appears that no libfortran2-dev package exists! What's the rationale there?

Revision history for this message
Matthias Klose (doko) wrote :

The libgfortran1-dev package is merged into the gfortran-4.1 package; Please make sure that gfortran-4.1 is installed (if you do use gcc-4.1), or gfortran-4.2 is installed (if you do use gcc-4.2). The .so symlink is found in the private gcc libdir to be able to have both gfortran versions installed in parallel.

Changed in gcc-4.2:
assignee: nobody → doko
importance: Undecided → Low
status: New → Invalid
Revision history for this message
Russel Winder (russel) wrote :

The lack of this file or some installed way round it should be considered a blocker. I cannot link fortran code without manually adding the symlink. It may be the wrong thing to do but it is the only simple way of getting a link to work.

I assume this and Bug # 158673 are effectively the same.

Revision history for this message
John Pye (jdpipe) wrote :

I have looked at this again, and I found that I have got gcc-4.1, gcc-4.2, and gfortran-4.2 installed on my system. For some reason, 'gcc' is linked to gcc-4.1, rather than the newer gcc-4.2. This is the cause of the problem, AFAICT, because libgfortran.so is not in the library path used by gcc-4.1.

Is there solution here to modify the packages for gcc-4.1 and gcc-4.2 so that /usr/bin/gcc links to gcc-4.2 instead of gcc-4.1?

Revision history for this message
Russel Winder (russel) wrote :

On Gutsy 4.1 is the standard for gcc and g++ whereas the standard for gfortran and gij is 4.2, so the linking is probably as it should be -- except that I am not sure why the alternatives system is not used to handle the linking to versions, instead hardwired symbolic lionks are used.

The upshot appears to be then that you can't use -lgfortran without the cheat of manually linking /usr/lib/libgfortran.so unless you change the gcc link to point to gcc-4.2 instead of gcc-4.1 (but this may well break lots of other thing :-(

Revision history for this message
shanki (shanki-na-s) wrote :

Hi JP,

I am using Ubuntu 7.10.
I have some .cc codes which I need to convert into .so in order to run them
from octave. While doing this, I discover that the current ubuntu version
does not have lgfortranbegin package. Below is the error messege.

mkoctfile --verbose resample2x.cc
/usr/bin/g++ -c -fPIC -I/usr/include/octave-2.1.73 -I/usr/include/octave-2.1.73/octave -mieee-fp -O2 resample2x.cc -o resample2x.o
/usr/bin/g++ -shared -Wl,-Bsymbolic -o resample2x.oct resample2x.o -L/usr/lib/octave-2.1.73 -loctinterp -loctave -lcruft -s -llapack-3 -lblas-3 -lfftw3 -lreadline -lncurses -ldl -lhdf5 -lz -lm -L/usr/lib/gcc/i486-linux-gnu/4.1.2 -L/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib -L/lib/../lib -L/usr/lib/../lib -lhdf5 -lz -lgfortranbegin -lgfortran -lm
/usr/bin/ld: cannot find -lgfortranbegin
collect2: ld returned 1 exit status
make: *** [resample2x.oct] Error 1

I noticed that you had simiilar problem few months ago.
Did you find the solution to your problem?

Cheers
Shanki

Revision history for this message
Kevin Squire (kevin-squire+ubuntu) wrote :

A number of people (including myself) are having trouble compiling standard programs that either worked before, or should work out of the box, but for a missing libgfortran.so link. Should it be that for every fortran program we compile, we must modify the makefile to look in /usr/lib/gcc/<arch>/<version>/ for the libgfortran.so link (and change it for every new release)? If so, that's annoying, and please regard this as a formal request to use the debian alternatives mechanism to point at the right library. If this is not the best solution, can you please suggest a more standard way to deal with this?

Thanks,

   Kevin

Revision history for this message
Ondrej Certik (ondrej-certik) wrote :

Indeed, I have the same problem, the /usr/lib/libgfortran.so is missing, so I need to use /usr/lib/gcc/<arch>/<version>/libgfortran.so, which is nonstandard I believe.

Is there any solution to this? Maybe some automatic determination of the location of libgfortran.so.

Revision history for this message
Ondrej Certik (ondrej-certik) wrote :

Here is one way to do it, that seems to work for me:

$ gfortran -print-file-name=libgfortran.so

/usr/lib/gcc/x86_64-linux-gnu/4.4.3/libgfortran.so

Changed in gcc-4.2 (Ubuntu):
status: Invalid → Confirmed
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.