LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-24-2009, 05:32 PM   #1
science_guy
LQ Newbie
 
Registered: Sep 2009
Posts: 3

Rep: Reputation: 0
fortran linux error


Hello,

I am relatively new to linux.

I am trying to execute a fortran program but I get an error (most likely) after the program gets compiled. I am using the pgf90 to compile the program. Since it is a collection of programs, I have a makefile and then use the 'make' command to build the program:

% make
pgf90 -c -C -Mextend -Bstatic tau_wp_oct96.f
tau_wp_oct96.f:
pgf90 -c -C -Mextend -Bstatic RadParams.f
RadParams.f:
pgf90 -c -C -Mextend -Bstatic dkfrwn_0599.f
dkfrwn_0599.f:
pgf90 -c -C -Mextend -Bstatic trmm_wnflt_0599.f
trmm_wnflt_0599.f:
pgf90 -c -C -Mextend -Bstatic rad_0100.f
rad_0100.f:
pgf90 -c -C -Mextend -Bstatic water_hu2.f
water_hu2.f:
pgf90 -c -C -Mextend -Bstatic chou_routines.f
chou_routines.f:
pgf90 -c -C -Mextend -Bstatic iaform3.f
iaform3.f:
pgf90 -c -C -Mextend -Bstatic aerosol_init.f
aerosol_init.f:
pgf90 -c -C -Mextend -Bstatic misc_subs.f
misc_subs.f:
pgf90 -c -C -Mextend -Bstatic readalb.f
readalb.f:
pgf90 -C -Mextend -Bstatic driver.f tau_wp_oct96.o RadParams.o dkfrwn_0599.o trmm_wnflt_0599.o rad_0100.o water_hu2.o chou_routines.o iaform3.o aerosol_init.o misc_subs.o readalb.o -o driver
driver.f:
/usr/bin/ld: cannot find -lc
make: *** [driver] Error 2



I'd really appreciate if someone could tell me how to resolve the '/usr/bin/ld: cannot find -lc' error?

Many thanks,

Alex
 
Old 09-24-2009, 05:41 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Can you post your make file? Also, might be an idea to ask the mods to move this to the programming forum; you can use the 'Report' button.
 
Old 09-24-2009, 05:49 PM   #3
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
I think that the -lc is telling the linker (/usr/bin/ld) to load a library name "libc.so" So (if I'm correct) you need to install that library. On most system, libc.so would be a C library, and I suspect that somewhere in your FORTRAN code, someone has embedded some C code.
 
Old 09-24-2009, 05:58 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Incidentally, the usual compiler would be gfortran http://gcc.gnu.org/wiki/GFortranUsage. any reason you're not using it?
 
Old 09-24-2009, 09:49 PM   #5
science_guy
LQ Newbie
 
Registered: Sep 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks everyone for the quick response.
I have only access to pgf90 in my school, the system admin is not available for installing other compilers.

Here is the makefile:

FFLAGS = -C -Mextend -Bstatic
FC = pgf90

FUCODE = RadParams.o dkfrwn_0599.o trmm_wnflt_0599.o rad_0100.o water_hu2.o chou_routines.o iaform3.o aerosol_init.o misc_subs.o readalb.o

all : driver ${FUCODE}

RadParams.o : RadParams.f
${FC} -c ${FFLAGS} RadParams.f

readalb.o : readalb.f
${FC} -c ${FFLAGS} readalb.f


# STANDALONE

trmm_wnflt_0599.o : trmm_wnflt_0599.f
${FC} -c ${FFLAGS} trmm_wnflt_0599.f

tau_wp_oct96.o : tau_wp_oct96.f
${FC} -c ${FFLAGS} tau_wp_oct96.f

chou_routines.o : chou_routines.f
${FC} -c ${FFLAGS} chou_routines.f

iaform3.o : iaform3.f
${FC} -c ${FFLAGS} iaform3.f

# RADPARAM DEPENDENT
water_hu2.o : water_hu2.f RadParams.o
${FC} -c ${FFLAGS} water_hu2.f

misc_subs.o : misc_subs.f RadParams.o
${FC} -c ${FFLAGS} misc_subs.f

dkfrwn_0599.o : dkfrwn_0599.f RadParams.o
${FC} -c ${FFLAGS} dkfrwn_0599.f

aerosol_init.o : aerosol_init.f RadParams.o
${FC} -c ${FFLAGS} aerosol_init.f


#FULIOU MAIN
rad_0100.o : rad_0100.f RadParams.o trmm_wnflt_0599.o dkfrwn_0599.o
${FC} -c ${FFLAGS} rad_0100.f

#MAIN
driver : driver.f tau_wp_oct96.o ${FUCODE}
${FC} ${FFLAGS} driver.f tau_wp_oct96.o ${FUCODE} -o driver

clean:
rm *.o ; rm *.kmo



thanks,
Alex.
 
Old 09-24-2009, 11:14 PM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Moved: This thread is more suitable in <Programming> and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 09-25-2009, 10:20 AM   #7
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Hum. Well, if you're the only on using it, you can install the gfortran package and libraries in your home directory. But getting it to work would take quite a while.

So, do you have pgcc installed on your system? (I haven't used the Portland Group's compilers, but - from the pgf90 man page - I formed the impression that the pgf90 was a FORTRAN -> C converter preprocessor, and that the pgcc C compiler might be needed to compile the generated code. The C library, if my above speculation is correct, would/should have been installed with the pgcc compiler.)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
error Linux Fortran compiler: libimf.so terrence Programming 6 06-15-2012 03:51 PM
Fortran runtime error mkrems Programming 3 06-24-2008 03:42 PM
g77 in gcc 4.1.0 not found only gfortran fortran 95 compiler! I need fortran 77. TheBrick Linux - Software 3 07-04-2007 06:39 AM
Gnu Fortran versus Intel Fortran tomatoefish Linux - Software 3 02-20-2006 01:31 PM
does linux fortran compiler in fedora 4 support VAX FORTRAN? terrence Programming 17 08-31-2005 08:59 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration