0

I want a workin g77 compiler on my Ubuntu 12.04 64 bit laptop. so did the following:

  1. I change the sources.list by adding the following lines:

deb http...hu.archive.ubuntu.com/ubuntu/ hardy universe
deb-src ..//hu.archive.ubuntu.com/ubuntu/ hardy universe
deb http:...hu.archive.ubuntu.com/ubuntu/ hardy-updates universe
deb-src ..//hu.archive.ubuntu.com/ubuntu/ hardy-updates universe


2. then I on a terminal i did the following:

sudo apt-get update
sudo apt-get install g77

Things looked very nice then. But when I tried to compile with g77 on my Fortran77 program. I got the following errors:

/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status


3. Why doesn't the g77 work properly. Many people need g77 why cannot Ubuntu offer a workable g77?


4. Please Help me ! Thanks from a ubuntu-beginner

2 Answers 2

1

I had the same problem, with SAME SYSTEM today and SOLVED. It may serve for you.

If you are an expert, you can jump to the end for a 3 line solution or follow my way,

that was:
1)
$ locate crt1.o
/usr/lib/x86_64-linux-gnu/Mcrt1.o
/usr/lib/x86_64-linux-gnu/Scrt1.o
/usr/lib/x86_64-linux-gnu/crt1.o
/usr/lib/x86_64-linux-gnu/gcrt1.o
/usr/lib32/Mcrt1.o
/usr/lib32/Scrt1.o
/usr/lib32/crt1.o
/usr/lib32/gcrt1.o

As I'm using x86_64, just copied "/usr/lib/x86_64-linux-gnu/"

2)
$ locate crti.o
/usr/lib/x86_64-linux-gnu/crti.o
/usr/lib32/crti.o

It was the same as above, so, nothing new.

3a)
$ locate lgcc_s
NOTHING

panic...

But, I tried:

3b)
$ locate gcc_s
/lib/i386-linux-gnu/libgcc_s.so.1
/lib/x86_64-linux-gnu/libgcc_s.so.1
/usr/lib/gcc/x86_64-linux-gnu/4.4/libgcc_s.so
/usr/lib/gcc/x86_64-linux-gnu/4.6/libgcc_s.so
/usr/lib/gcc/x86_64-linux-gnu/4.6/libgcc_s_32.so
/usr/lib/gcc/x86_64-linux-gnu/4.6/32/libgcc_s.so
/usr/lib32/libgcc_s.so.1
/usr/libexec/autopackage/libgcc_s.so.1

Now, I just choose the older version, 4.4, so just copied "/usr/lib/gcc/x86_64-linux-gnu/4.4/"

The software in question was in a makefile. Openned the one and changed:

(from) FFLAGS=-g -O2

(to) FFLAGS=-g -O2 -B/usr/lib/x86_64-linux-gnu/ -B/usr/lib/gcc/x86_64-linux-gnu/4.4/

To be simple: I just add -B for each path I copied

If you are using the g77 direct in terminal, may be:

$ g77 (...) -B/usr/lib/x86_64-linux-gnu/ -B/usr/lib/gcc/x86_64-linux-gnu/4.4/ (...)

Expert:

1) Use the locate to find the path of crt1.o, crti.o and-lgcc_s (search for gcc_s);
2) Copy the paths for your distro/bits;
3) Add a "-B path_1" "-B path_2" (where path_i are the paths above) in your g77 compile call.

EDIT
cogitoergosum,
In my case, the software is VERY old and fort77, gfortran and f77 gave tons of problems. I first successfully compiled with ifort (Intel Fortran compiler). But I tried g77 for an opensource alternative. And it works!

-1

Try installing fort77 (sudo apt-get install fort77) which also installs f2c. Use f77 which invokes f2c translator to compile/link. Good luck.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .