Ubuntu – How to install library that uses g77

gcc

I am trying to install "TAUCS" (http://www.tau.ac.il/~stoledo/taucs/) library. However, I am getting following error:

/usr/bin/ld: skipping incompatible external/lib/linux/libmetis.a when searching for -lmetis
/usr/bin/ld: cannot find -lmetis
/usr/bin/ld: cannot find -lg2c
collect2: error: ld returned 1 exit status
make: [build/linux/taucs_config_tests.h] Error 1 (ignored)
obj/linux/taucs_c99_complex_test build/linux/taucs_config_tests.h
make: obj/linux/taucs_c99_complex_test: Command not found
make: [build/linux/taucs_config_tests.h] Error 127 (ignored)
cc -c -O3 -Wall -Werror -std=c99    -DMACHTYPE_ -I src/ -I build/linux/ -I external/src/   \
      progs/taucs_cilk_test.c \
      -oobj/linux/taucs_cilk_test.o
progs/taucs_cilk_test.c:8:19: fatal error: cilk.h: No such file or directory
 #include <cilk.h> 
                   ^

more errors follow.

I think that this error arises as I already use gcc which uses gfortran instead of g77.

1) I could get the old file by doing this:

wget http://old-releases.ubuntu.com/ubuntu/pool/universe/g/gcc-3.4/libg2c0_3.4.6-6ubuntu5_i386.deb
sudo dpkg -i --force-all libg2c0_3.4.6-6ubuntu5_i386.deb

This created following files in /usr/lib/

libg2c.so.0
libg2c.so.0.0.0

2) After that, I found online link which suggests to create soft link, like this:

cd /usr/lib
ln -s libg2c.so.0 libg2c.so

I guess that I have include this along with

CILKC=$(CC)

So, I commented out this line and added soft link.

But, I get the following error:

build/linux/makefile:11: *** commands commence before first target.  Stop.

Some guidance would be appreciated?

Update based on @steeldriver answer:
After I did as suggested by aforementioned user, everything complied fine. But, I am getting some warnings which I am VERY concerned about.

usr/bin/ld: skipping incompatible external/lib/linux/liblapack.a when searching for -llapack
....
/usr/bin/ld: skipping incompatible external/lib/linux/libf77blas.a when searching for -lf77blas
...
/usr/bin/ld: skipping incompatible external/lib/linux/libcblas.a when searching for -lcblas
....
/usr/bin/ld: skipping incompatible external/lib/linux/libatlas.a when searching for -latlas
....
/usr/bin/ld: skipping incompatible external/lib/linux/libmetis.a when searching for -lmetis

I think that issue could be that these library may be 64 bits vs 32 bits.
Is it possible to have both versions of libraries? I could put less frequent in /usr/local/lib. How could I ensure that a particular versions of libraries are linked in makefile?

Best Answer

I don't know if it build correctly, but I was able to build TAUCS 2.2 on 32-bit Ubuntu 12.04 using gfortran as follows

  1. Download the Version 2.2 of the code, with external libraries, tgz format

    wget http://www.tau.ac.il/~stoledo/taucs/2.2/taucs_full.tgz
    
  2. Unpack it in your chosen location

    mkdir taucs_full
    
    tar xvf taucs_full.tgz -C taucs_full
    
    cd taucs_full
    
  3. If you didn't already do so, install libf2c2-dev (for libf2c)

    sudo apt-get install libf2c2-dev

  4. Remove the -Werror flag from the global compiler options file (there are going to be warnings, so it will never build if we treat them as errors)

    sed -i 's/-Werror//g' config/linux.mk
    
  5. Now run the configure script

    ./configure
    
  6. Finally we need to do some command and library wrangling for the actual make

    make "CC=gcc" "FC=gfortran -ff2c" "LIBF77=-Wl,-Bdynamic -lgfortran"
    

You should get a binary executable in ./bin/linux - I don't have any means to test it functionally but it at least runs:

$ bin/linux/taucs_run 
taucs_run: there is no matrix!