LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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-26-2017, 02:21 AM   #1
lancer78
LQ Newbie
 
Registered: Sep 2017
Posts: 5

Rep: Reputation: Disabled
Unhappy Makefile problem: file in wrong format? 1d returned 1 exit status?


Hello everyone,

I am trying to run a F77 program but when I try to do a "make" I get the following error:

f77 -o snow snowd.o snowdgt.o snowx.o
/usr/bin/1d: snowd.o: Relocations in generic ELF (EM:2)
/usr/bin/1d: snowd.o: Relocations in generic ELF (EM:2)
snowd.o: could not read symbols: File in wrong format
collect2: 1d returned 1 exit status
make: *** [snow] Error 1

For completion, my makefile looks like this:
Code:
TARGET	= snow
SRC =	 snowd.f  snowdgt.f snowx.f 
OBJS =	snowd.o  snowdgt.o snowx.o
FFLAGS = -g
$(TARGET):	$(OBJS)
	f77  -o $(TARGET) $(OBJS)
Does anyone know what this error means and how to fix it? Thank you very much in advance.

Last edited by lancer78; 09-26-2017 at 10:26 PM.
 
Old 09-26-2017, 10:33 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,316

Rep: Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008
Please edit your post, add [code] and [/code] tags around the code-parts.
Please quote the complete output of this command:
Code:
make clean; make snow
Edit: if 'make clean' doesn't work, add this into the Makefile:
Code:
clean:
        rm -f -- $(OBJS) $(TARGET) 2>/dev/null || true

Last edited by NevemTeve; 09-26-2017 at 10:34 AM.
 
1 members found this post helpful.
Old 09-26-2017, 10:39 PM   #3
lancer78
LQ Newbie
 
Registered: Sep 2017
Posts: 5

Original Poster
Rep: Reputation: Disabled
Code:
PLATFORM = linux_pgi
FC = /usr/local/intel/Compiler/11.1/069/bin/intel64/ifort
TARGET	= snow
SRC =	 snowd.f  snowdgt.f snowx.f 
OBJS =	snowd.o  snowdgt.o snowx.o
FFLAGS = -g 
$(TARGET):	$(OBJS)
	f77  -o $(TARGET) $(OBJS) 
clean:
        rm -f -- $(OBJS) $(TARGET) 2>/dev/null || true
Thank you for your suggestions. Make clean did not work so I put in the statement you had mentioned. Also, I put the path to the compiler I am using.

The error message I obtain is still the following:

/usr/bin/1d: snowd.o: Relocations in generic ELF (EM: 2)
/usr/bin/1d: snowd.o: Relocations in generic ELF (EM: 2)
snowd.o: could not read symbols: File in wrong format.
collect2: 1d returned 1 exit status
make: *** [snow] Error 1

Did I put this in incorrectly?

Quote:
Originally Posted by NevemTeve View Post
Please edit your post, add [code] and [/code] tags around the code-parts.
Please quote the complete output of this command:
Code:
make clean; make snow
Edit: if 'make clean' doesn't work, add this into the Makefile:
Code:
clean:
        rm -f -- $(OBJS) $(TARGET) 2>/dev/null || true
 
Old 09-26-2017, 11:55 PM   #4
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,316

Rep: Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008
Hi, good think you used the [code] tags, I encourage you use them more;
I think you didn't run 'make clean', or didn't quote the complete output of 'make snow', as I miss the parts where the object modules are created. It should be something like this
Code:
..path../ifort -o snowd.o -c snowd.f
 
Old 09-27-2017, 12:19 AM   #5
lancer78
LQ Newbie
 
Registered: Sep 2017
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by NevemTeve View Post
Hi, good think you used the [code] tags, I encourage you use them more;
I think you didn't run 'make clean', or didn't quote the complete output of 'make snow', as I miss the parts where the object modules are created. It should be something like this
Code:
..path../ifort -o snowd.o -c snowd.f
Hi NevemTeve. Thanks for the tips! After I did a "make clean" and "make" I got a whole bunch of "undefined references" along with the "collect2: 1d: returned 1 exit status." error. The good news it that the "Relocations in generic ELF (EM:2) error" is now gone. :

Code:
[rramirez@corot7b UEBoriginal_linux]$ make clean
rm -f -- snowd.o  snowdgt.o snowx.o snow 2>/dev/null || true
[rramirez@corot7b UEBoriginal_linux]$ make
/usr/local/intel/Compiler/11.1/069/bin/intel64/ifort -g   -c -o snowd.o snowd.f
/usr/local/intel/Compiler/11.1/069/bin/intel64/ifort -g   -c -o snowdgt.o snowdg   t.f
/usr/local/intel/Compiler/11.1/069/bin/intel64/ifort -g   -c -o snowx.o snowx.f
f77  -o snow snowd.o  snowdgt.o snowx.o
snowd.o: In function `main$snowd_$BLK':
/usr/local/UEBoriginal_linux/snowd.f:24: undefined reference to `for_set_reentra   ncy'
/usr/local/UEBoriginal_linux/snowd.f:24: undefined reference to `for_write_seq_l   is'
/usr/local/UEBoriginal_linux/snowd.f:25: undefined reference to `for_read_seq_fm   t'
/usr/local/UEBoriginal_linux/snowd.f:26: undefined reference to `for_write_seq_l   is'
/usr/local/UEBoriginal_linux/snowd.f:27: undefined reference to `for_read_seq_fm   t'
/usr/local/UEBoriginal_linux/snowd.f:28: undefined reference to `for_write_seq_l   is'
/usr/local/UEBoriginal_linux/snowd.f:29: undefined reference to `for_read_seq_fm   t'
/usr/local/UEBoriginal_linux/snowd.f:30: undefined reference to `for_write_seq_l   is'
/usr/local/UEBoriginal_linux/snowd.f:31: undefined reference to `for_read_seq_fm   t'
/usr/local/UEBoriginal_linux/snowd.f:32: undefined reference to `for_write_seq_l   is'
/usr/local/UEBoriginal_linux/snowd.f:33: undefined reference to `for_read_seq_fm   t'
/usr/local/UEBoriginal_linux/snowd.f:34: undefined reference to `for_write_seq_l   is'
/usr/local/UEBoriginal_linux/snowd.f:35: undefined reference to `for_write_seq_l   is'
/usr/local/UEBoriginal_linux/snowd.f:36: undefined reference to `for_write_seq_l   is'
/usr/local/UEBoriginal_linux/snowd.f:37: undefined reference to `for_write_seq_l   is'
/usr/local/UEBoriginal_linux/snowd.f:38: undefined reference to `for_write_seq_l   is'
/usr/local/UEBoriginal_linux/snowd.f:39: undefined reference to `for_read_seq_li   s'
/usr/local/UEBoriginal_linux/snowd.f:41: undefined reference to `for_write_seq_l   is'
/usr/local/UEBoriginal_linux/snowd.f:47: undefined reference to `for_open'
/usr/local/UEBoriginal_linux/snowd.f:48: undefined reference to `for_read_seq_li   s'
/usr/local/UEBoriginal_linux/snowd.f:48: undefined reference to `for_read_seq_li   s_xmit'
/usr/local/UEBoriginal_linux/snowd.f:48: undefined reference to `for_read_seq_li   s_xmit'
/usr/local/UEBoriginal_linux/snowd.f:48: undefined reference to `for_read_seq_li   s_xmit'
/usr/local/UEBoriginal_linux/snowd.f:48: undefined reference to `for_read_seq_li   s_xmit'
/usr/local/UEBoriginal_linux/snowd.f:48: undefined reference to `for_read_seq_li   s_xmit'
snowd.o:/usr/local/UEBoriginal_linux/snowd.f:48: more undefined references to `f   or_read_seq_lis_xmit' follow
snowd.o: In function `main$snowd_$BLK':
/usr/local/UEBoriginal_linux/snowd.f:49: undefined reference to `for_read_seq_li   s'
/usr/local/UEBoriginal_linux/snowd.f:52: undefined reference to `for_read_seq_li   s'
/usr/local/UEBoriginal_linux/snowd.f:52: undefined reference to `for_read_seq_li   s_xmit'
/usr/local/UEBoriginal_linux/snowd.f:52: undefined reference to `for_read_seq_li   s_xmit'
/usr/local/UEBoriginal_linux/snowd.f:52: undefined reference to `for_read_seq_li   s_xmit'
/usr/local/UEBoriginal_linux/snowd.f:52: undefined reference to `for_read_seq_li   s_xmit'
/usr/local/UEBoriginal_linux/snowd.f:52: undefined reference to `for_read_seq_li   s_xmit'
snowd.o:/usr/local/UEBoriginal_linux/snowd.f:52: more undefined references to `f   or_read_seq_lis_xmit' follow
snowd.o: In function `main$snowd_$BLK':
/usr/local/UEBoriginal_linux/snowd.f:55: undefined reference to `for_open'
/usr/local/UEBoriginal_linux/snowd.f:62: undefined reference to `for_read_seq_li   s'
/usr/local/UEBoriginal_linux/snowd.f:62: undefined reference to `for_read_seq_li   s_xmit'
/usr/local/UEBoriginal_linux/snowd.f:62: undefined reference to `for_read_seq_li   s_xmit'
/usr/local/UEBoriginal_linux/snowd.f:62: undefined reference to `for_read_seq_li   s_xmit'
/usr/local/UEBoriginal_linux/snowd.f:62: undefined reference to `for_read_seq_li   s_xmit'
/usr/local/UEBoriginal_linux/snowd.f:62: undefined reference to `for_read_seq_li   s_xmit'
snowd.o:/usr/local/UEBoriginal_linux/snowd.f:62: more undefined references to `f   or_read_seq_lis_xmit' follow
snowd.o: In function `main$snowd_$BLK':
/usr/local/UEBoriginal_linux/snowd.f:86: undefined reference to `for_write_seq_l   is'
/usr/local/UEBoriginal_linux/snowd.f:87: undefined reference to `for_write_seq_l   is'
/usr/local/UEBoriginal_linux/snowd.f:87: undefined reference to `for_write_seq_l   is_xmit'
/usr/local/UEBoriginal_linux/snowd.f:88: undefined reference to `for_write_seq_l   is'
/usr/local/UEBoriginal_linux/snowd.f:88: undefined reference to `for_write_seq_l   is_xmit'
/usr/local/UEBoriginal_linux/snowd.f:88: undefined reference to `for_write_seq_l   is_xmit'
/usr/local/UEBoriginal_linux/snowd.f:88: undefined reference to `for_write_seq_l   is_xmit'
/usr/local/UEBoriginal_linux/snowd.f:88: undefined reference to `for_write_seq_l   is_xmit'
/usr/local/UEBoriginal_linux/snowd.f:101: undefined reference to `for_write_seq_   lis'
/usr/local/UEBoriginal_linux/snowd.f:101: undefined reference to `for_write_seq_   lis_xmit'
/usr/local/UEBoriginal_linux/snowd.f:101: undefined reference to `for_write_seq_   lis_xmit'
/usr/local/UEBoriginal_linux/snowd.f:101: undefined reference to `for_write_seq_   lis_xmit'
/usr/local/UEBoriginal_linux/snowd.f:101: undefined reference to `for_write_seq_   lis_xmit'
/usr/local/UEBoriginal_linux/snowd.f:101: undefined reference to `for_write_seq_   lis_xmit'
snowd.o:/usr/local/UEBoriginal_linux/snowd.f:101: more undefined references to `   for_write_seq_lis_xmit' follow
snowd.o: In function `main$snowd_$BLK':
/usr/local/UEBoriginal_linux/snowd.f:110: undefined reference to `for_write_seq_   lis'
/usr/local/UEBoriginal_linux/snowd.f:115: undefined reference to `for_write_seq_   lis'
/usr/local/UEBoriginal_linux/snowd.f:115: undefined reference to `for_write_seq_   lis_xmit'
/usr/local/UEBoriginal_linux/snowd.f:116: undefined reference to `for_close'
/usr/local/UEBoriginal_linux/snowd.f:117: undefined reference to `for_close'
/usr/local/UEBoriginal_linux/snowd.f:118: undefined reference to `for_stop_core'
snowdgt.o: In function `snow':
/usr/local/UEBoriginal_linux/snowdgt.f:173: undefined reference to `for_write_se   q_lis'
/usr/local/UEBoriginal_linux/snowdgt.f:173: undefined reference to `for_write_se   q_lis_xmit'
/usr/local/UEBoriginal_linux/snowdgt.f:173: undefined reference to `for_write_se   q_lis_xmit'
/usr/local/UEBoriginal_linux/snowdgt.f:173: undefined reference to `for_write_se   q_lis_xmit'
/usr/local/UEBoriginal_linux/snowdgt.f:173: undefined reference to `for_write_se   q_lis_xmit'
/usr/local/UEBoriginal_linux/snowdgt.f:173: undefined reference to `for_write_se   q_lis_xmit'
snowdgt.o:/usr/local/UEBoriginal_linux/snowdgt.f:173: more undefined references    to `for_write_seq_lis_xmit' follow
snowdgt.o: In function `qfm':
/usr/local/UEBoriginal_linux/snowdgt.f:378: undefined reference to `__powr4i4'
snowdgt.o: In function `srftmp':
/usr/local/UEBoriginal_linux/snowdgt.f:478: undefined reference to `for_write_se   q_lis'
/usr/local/UEBoriginal_linux/snowdgt.f:479: undefined reference to `for_write_se   q_lis'
/usr/local/UEBoriginal_linux/snowdgt.f:480: undefined reference to `for_write_se   q_lis'
/usr/local/UEBoriginal_linux/snowdgt.f:480: undefined reference to `for_write_se   q_lis_xmit'
/usr/local/UEBoriginal_linux/snowdgt.f:481: undefined reference to `for_write_se   q_lis'
/usr/local/UEBoriginal_linux/snowdgt.f:482: undefined reference to `for_write_se   q_lis'
snowdgt.o: In function `surfeb':
/usr/local/UEBoriginal_linux/snowdgt.f:499: undefined reference to `__powr4i4'
snowdgt.o: In function `srftmpo':
/usr/local/UEBoriginal_linux/snowdgt.f:577: undefined reference to `for_write_se   q_lis'
/usr/local/UEBoriginal_linux/snowdgt.f:577: undefined reference to `for_write_se   q_lis_xmit'
/usr/local/UEBoriginal_linux/snowdgt.f:577: undefined reference to `for_write_se   q_lis_xmit'
/usr/local/UEBoriginal_linux/snowdgt.f:577: undefined reference to `for_write_se   q_lis_xmit'
/usr/local/UEBoriginal_linux/snowdgt.f:577: undefined reference to `for_write_se   q_lis_xmit'
snowdgt.o: In function `snotmp':
/usr/local/UEBoriginal_linux/snowdgt.f:631: undefined reference to `__powr4i4'
/usr/local/UEBoriginal_linux/snowdgt.f:632: undefined reference to `__powr4i4'
snowdgt.o: In function `sntmpb':
/usr/local/UEBoriginal_linux/snowdgt.f:665: undefined reference to `__powr4i4'
snowdgt.o: In function `fmelt':
/usr/local/UEBoriginal_linux/snowdgt.f:791: undefined reference to `__powr4i4'
/usr/local/UEBoriginal_linux/snowdgt.f:794: undefined reference to `for_write_se   q_lis'
/usr/local/UEBoriginal_linux/snowdgt.f:795: undefined reference to `for_stop_cor   e'
snowdgt.o: In function `agesn':
/usr/local/UEBoriginal_linux/snowdgt.f:904: undefined reference to `__powr4i4'
snowx.o: In function `bcparm':
/usr/local/UEBoriginal_linux/snowx.f:17: undefined reference to `for_open'
/usr/local/UEBoriginal_linux/snowx.f:18: undefined reference to `for_read_seq_li   s'
/usr/local/UEBoriginal_linux/snowx.f:18: undefined reference to `for_read_seq_li   s_xmit'
/usr/local/UEBoriginal_linux/snowx.f:19: undefined reference to `for_read_seq_li   s'
/usr/local/UEBoriginal_linux/snowx.f:19: undefined reference to `for_read_seq_li   s_xmit'
/usr/local/UEBoriginal_linux/snowx.f:22: undefined reference to `for_close'
snowx.o: In function `readvals':
/usr/local/UEBoriginal_linux/snowx.f:31: undefined reference to `for_open'
/usr/local/UEBoriginal_linux/snowx.f:32: undefined reference to `for_read_seq_li   s'
/usr/local/UEBoriginal_linux/snowx.f:32: undefined reference to `for_read_seq_li   s_xmit'
/usr/local/UEBoriginal_linux/snowx.f:32: undefined reference to `for_read_seq_li   s_xmit'
/usr/local/UEBoriginal_linux/snowx.f:33: undefined reference to `for_close'
snowx.o: In function `readsv':
/usr/local/UEBoriginal_linux/snowx.f:55: undefined reference to `for_open'
/usr/local/UEBoriginal_linux/snowx.f:56: undefined reference to `for_read_seq_li   s'
/usr/local/UEBoriginal_linux/snowx.f:56: undefined reference to `for_read_seq_li   s_xmit'
/usr/local/UEBoriginal_linux/snowx.f:56: undefined reference to `for_read_seq_li   s_xmit'
/usr/local/UEBoriginal_linux/snowx.f:57: undefined reference to `for_read_seq_li   s'
/usr/local/UEBoriginal_linux/snowx.f:57: undefined reference to `for_read_seq_li   s_xmit'
/usr/local/UEBoriginal_linux/snowx.f:57: undefined reference to `for_read_seq_li   s_xmit'
/usr/local/UEBoriginal_linux/snowx.f:58: undefined reference to `for_close'
snowx.o: In function `qlif':
/usr/local/UEBoriginal_linux/snowx.f:179: undefined reference to `__powr4i4'
collect2: ld returned 1 exit status
make: *** [snow] Error 1
[rramirez@corot7b UEBoriginal_linux]$
 
Old 09-27-2017, 12:22 AM   #6
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,316

Rep: Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008
You should use the same FORTRAN compiler at compilation and linking; edit Makefile:

Code:
$(TARGET):	$(OBJS)
	$(FC) -o $(TARGET) $(OBJS)
 
Old 09-27-2017, 12:39 AM   #7
lancer78
LQ Newbie
 
Registered: Sep 2017
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by NevemTeve View Post
You should use the same FORTRAN compiler at compilation and linking; edit Makefile:

Code:
$(TARGET):	$(OBJS)
	$(FC) -o $(TARGET) $(OBJS)
Ahh.. Thank you NevemTeve. That worked when I changed out the TARGET statement.
For which FORTRAN compiler was my previous TARGET statement for?
 
Old 09-27-2017, 12:42 AM   #8
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,316

Rep: Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008
In your post#5 I can see /usr/local/intel/Compiler/11.1/069/bin/intel64/ifort and f77 -- use the same program for compilation and linkage.
 
Old 09-27-2017, 02:48 AM   #9
lancer78
LQ Newbie
 
Registered: Sep 2017
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by NevemTeve View Post
In your post#5 I can see /usr/local/intel/Compiler/11.1/069/bin/intel64/ifort and f77 -- use the same program for compilation and linkage.
Ahh.. That makes sense. I thank you again, NevemTeve.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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: ld returned 1 exit status przi Linux - Software 2 01-06-2016 01:53 PM
[SOLVED] collect2: ld returned 1 exit status linuxpremi Linux - Newbie 3 01-30-2011 11:54 PM
Makefile: file not recognized:File format not recognized collect2: ld returned 1 exit Bringo Linux - Software 9 12-20-2010 05:08 AM
ld returned 1 exit status shariefbe Linux - Software 3 01-13-2010 10:23 AM
collect2: ld returned 1 exit status makphy Linux - Newbie 0 12-14-2009 03:05 AM

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

All times are GMT -5. The time now is 04:56 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration