public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* multiple definition of `MAIN__'
@ 2003-12-28 18:58 Fabian Braennstroem
  2003-12-28 19:59 ` Fabian Braennstroem
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Fabian Braennstroem @ 2003-12-28 18:58 UTC (permalink / raw)
  To: gcc-help

Hello,

I am still trying to adjust an sgi-fortran-code to linux g77.  I get
this error-message:

main.o(.text+0x10c3): In function `MAIN__':
: undefined reference to `save_vel__'
main.o(.text+0x10d2): In function `MAIN__':
: undefined reference to `save_pres__'
collect2: ld returned 1 exit status
make: *** [calc_les_03_cube] Error 1

Without the two subroutines 'save_vel.f''save_pres.f' the program works
well.

So I tried the 'nm'-utility for the first time and I get this:

         U do_fio
         U do_lio
         U dphidx_
         U dphidy_
         U e_wsfe
         U e_wsle
         U f_clos
         U f_open
         U s_cat
         U s_wsfe
         U s_wsle
00000000 T save_vel__
00000000 D visit_
00000002 C prin1_
00000004 C caser_
0000000c C pres_
00000010 C prin2_
00000020 C vecti_
00000020 C vectl_
00000024 C allc_
00000024 C turb_
00000030 C alll_
00000030 C point_
00000034 C casei_
00000038 C alli_
000000c0 C vectc_
00000cd1 T MAIN__
00061a9c C allr_
00340d10 C flupr_
0035eda0 C geom_
00b722b0 C node_
02709c00 C coef_
061986a0 C vectr_

On http://www.bo.infn.it/alice/alice-doc/mll-doc/migvms/node22.html I
read:
"In this way the location of MAIN in the code is found and the wrong
routine detected."
So in my example the wrong routine should be placed between vectc allr.
But, how can I find the mistake? What does that mean?

Greetings!
Fabian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: multiple definition of `MAIN__'
  2003-12-28 18:58 multiple definition of `MAIN__' Fabian Braennstroem
@ 2003-12-28 19:59 ` Fabian Braennstroem
  2003-12-28 20:22 ` SORRY again, " Fabian Braennstroem
  2003-12-29 13:03 ` Toon Moene
  2 siblings, 0 replies; 7+ messages in thread
From: Fabian Braennstroem @ 2003-12-28 19:59 UTC (permalink / raw)
  To: gcc-help

Hello,

sorry, it is the wrong subject. I could get rid of that error.

Greetings!
Fabian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: SORRY again, multiple definition of `MAIN__'
  2003-12-28 18:58 multiple definition of `MAIN__' Fabian Braennstroem
  2003-12-28 19:59 ` Fabian Braennstroem
@ 2003-12-28 20:22 ` Fabian Braennstroem
  2003-12-29 13:03 ` Toon Moene
  2 siblings, 0 replies; 7+ messages in thread
From: Fabian Braennstroem @ 2003-12-28 20:22 UTC (permalink / raw)
  To: gcc-help

Hello,
again sorry, I just thought I found the error, but I did not :-(

On Sun, 2003-12-28 at 19:58, Fabian Braennstroem wrote:
> Hello,
> 
> I am still trying to adjust an sgi-fortran-code to linux g77.  I get
> this error-message:
> 
THAT is the correct error-message:

save_vel.o(.text+0xcd1): In function `MAIN__':
: multiple definition of `MAIN__'
main.o(.text+0x0): first defined here
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/../../../../i686-pc-linux-gnu/bin/ld: Warning: size of symbol `MAIN__' changed from 5155 in main.o to 5 in save_vel.o
save_pres.o(.text+0x763): In function `MAIN__':
: multiple definition of `MAIN__'
main.o(.text+0x0): first defined here
collect2: ld returned 1 exit status
make: *** [calc_les_03_cube] Error 1

> Without the two subroutines 'save_vel.f''save_pres.f' the program works
> well.
> 
> So I tried the 'nm'-utility for the first time and I get this:
The command was: 'nm --numeric-sort --extern-only save_vel.o'
> 
>          U do_fio
>          U do_lio
>          U dphidx_
>          U dphidy_
>          U e_wsfe
>          U e_wsle
>          U f_clos
>          U f_open
>          U s_cat
>          U s_wsfe
>          U s_wsle
> 00000000 T save_vel__
> 00000000 D visit_
> 00000002 C prin1_
> 00000004 C caser_
> 0000000c C pres_
> 00000010 C prin2_
> 00000020 C vecti_
> 00000020 C vectl_
> 00000024 C allc_
> 00000024 C turb_
> 00000030 C alll_
> 00000030 C point_
> 00000034 C casei_
> 00000038 C alli_
> 000000c0 C vectc_
> 00000cd1 T MAIN__
> 00061a9c C allr_
> 00340d10 C flupr_
> 0035eda0 C geom_
> 00b722b0 C node_
> 02709c00 C coef_
> 061986a0 C vectr_
> 
> On http://www.bo.infn.it/alice/alice-doc/mll-doc/migvms/node22.html I
> read:
> "In this way the location of MAIN in the code is found and the wrong
> routine detected."
> So in my example the wrong routine should be placed between vectc allr.
> But, how can I find the mistake? What does that mean?
> 
> Greetings!
> Fabian

Once again, sorry!
Greetings
Fabian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: multiple definition of `MAIN__'
  2003-12-28 18:58 multiple definition of `MAIN__' Fabian Braennstroem
  2003-12-28 19:59 ` Fabian Braennstroem
  2003-12-28 20:22 ` SORRY again, " Fabian Braennstroem
@ 2003-12-29 13:03 ` Toon Moene
  2003-12-29 22:15   ` Fabian Braennstroem
  2 siblings, 1 reply; 7+ messages in thread
From: Toon Moene @ 2003-12-29 13:03 UTC (permalink / raw)
  To: f.braennstroem; +Cc: gcc-help

Fabian Braennstroem wrote:
> Hello,
> 
> I am still trying to adjust an sgi-fortran-code to linux g77.  I get
> this error-message:
> 
> main.o(.text+0x10c3): In function `MAIN__':
> : undefined reference to `save_vel__'
> main.o(.text+0x10d2): In function `MAIN__':
> : undefined reference to `save_pres__'
> collect2: ld returned 1 exit status
> make: *** [calc_les_03_cube] Error 1
> 
> Without the two subroutines 'save_vel.f''save_pres.f' the program works
> well.

Did you compile save_vel.f and save_pres.f with g77 as well ?

Note that g77 appends two underscores to the name of a subroutine that 
contains an underscore.

If you just assume the loader will get save_vel and save_pres from a 
library compiled with another compiler that doesn't append the extra 
underscore, you're out of luck.

Anyways, don't assume g77-compiled code and code compiled with another 
compiler on your SGI machine will work together flawlessly, even if the 
loader phase succeeds ...

Hope this helps,

-- 
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://gcc.gnu.org/fortran/ (under construction)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: multiple definition of `MAIN__'
  2003-12-29 13:03 ` Toon Moene
@ 2003-12-29 22:15   ` Fabian Braennstroem
  2003-12-30 13:50     ` Toon Moene
  0 siblings, 1 reply; 7+ messages in thread
From: Fabian Braennstroem @ 2003-12-29 22:15 UTC (permalink / raw)
  To: Toon Moene; +Cc: gcc-help

On Mon, 2003-12-29 at 14:08, Toon Moene wrote:
> Fabian Braennstroem wrote:
> > Hello,
> > 
> > I am still trying to adjust an sgi-fortran-code to linux g77.  I get
> > this error-message:
> > 
> > main.o(.text+0x10c3): In function `MAIN__':
> > : undefined reference to `save_vel__'
> > main.o(.text+0x10d2): In function `MAIN__':
> > : undefined reference to `save_pres__'
> > collect2: ld returned 1 exit status
> > make: *** [calc_les_03_cube] Error 1
> > 
THAT is the correct error-message:

save_vel.o(.text+0xcd1): In function `MAIN__':
: multiple definition of `MAIN__'
main.o(.text+0x0): first defined here
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/../../../../i686-pc-linux-gnu/bin/ld: Warning: size of symbol `MAIN__' changed from 5155 in main.o to 5 in save_vel.o
save_pres.o(.text+0x763): In function `MAIN__':
: multiple definition of `MAIN__'
main.o(.text+0x0): first defined here
collect2: ld returned 1 exit status
make: *** [calc_les_03_cube] Error 1

> Did you compile save_vel.f and save_pres.f with g77 as well ?
> 
> Note that g77 appends two underscores to the name of a subroutine that 
> contains an underscore.
> 
> If you just assume the loader will get save_vel and save_pres from a 
> library compiled with another compiler that doesn't append the extra 
> underscore, you're out of luck.
> 
> Anyways, don't assume g77-compiled code and code compiled with another 
> compiler on your SGI machine will work together flawlessly, even if the 
> loader phase succeeds ...
> 
Thanks for the tips, but all subroutines were compiled with g77 under
linux. 
When I copy the subroutine save_vel into 'main.f', the compilation works
fine. Why? Is it a 'makefile'-mistake?

Greetings!
Fabian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: multiple definition of `MAIN__'
  2003-12-29 22:15   ` Fabian Braennstroem
@ 2003-12-30 13:50     ` Toon Moene
  2003-12-31  9:08       ` Fabian Braennstroem
  0 siblings, 1 reply; 7+ messages in thread
From: Toon Moene @ 2003-12-30 13:50 UTC (permalink / raw)
  To: f.braennstroem; +Cc: gcc-help

Fabian Braennstroem wrote:

> THAT is the correct error-message:
> 
> save_vel.o(.text+0xcd1): In function `MAIN__':
> : multiple definition of `MAIN__'
> main.o(.text+0x0): first defined here
> /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/../../../../i686-pc-linux-gnu/bin/ld: Warning: size of symbol `MAIN__' changed from 5155 in main.o to 5 in save_vel.o
> save_pres.o(.text+0x763): In function `MAIN__':
> : multiple definition of `MAIN__'
> main.o(.text+0x0): first defined here
> collect2: ld returned 1 exit status
> make: *** [calc_les_03_cube] Error 1

Ah, this is a slightly different problem.  Somehow, g77 thinks there is 
a main program in the file save_vel.f - this can happen if you have a 
single (extraneous) END statement for instance.

If you can't find the problem, send me (and only me - not the list) the 
whole file save_vel.f and I'll take a look.

Cheers,

-- 
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://gcc.gnu.org/fortran/ (under construction)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: multiple definition of `MAIN__'
  2003-12-30 13:50     ` Toon Moene
@ 2003-12-31  9:08       ` Fabian Braennstroem
  0 siblings, 0 replies; 7+ messages in thread
From: Fabian Braennstroem @ 2003-12-31  9:08 UTC (permalink / raw)
  To: Toon Moene; +Cc: gcc-help

On Tue, 2003-12-30 at 14:56, Toon Moene wrote:
> Fabian Braennstroem wrote:
> 
> > THAT is the correct error-message:
> > 
> > save_vel.o(.text+0xcd1): In function `MAIN__':
> > : multiple definition of `MAIN__'
> > main.o(.text+0x0): first defined here
> > /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/../../../../i686-pc-linux-gnu/bin/ld: Warning: size of symbol `MAIN__' changed from 5155 in main.o to 5 in save_vel.o
> > save_pres.o(.text+0x763): In function `MAIN__':
> > : multiple definition of `MAIN__'
> > main.o(.text+0x0): first defined here
> > collect2: ld returned 1 exit status
> > make: *** [calc_les_03_cube] Error 1
> 
> Ah, this is a slightly different problem.
Sorry, it was a different error which I had before.
>   Somehow, g77 thinks there is 
> a main program in the file save_vel.f - this can happen if you have a 
> single (extraneous) END statement for instance.
Yes, that's it. I had two 'end' and one 'return'. Now it works :-)

> 
> If you can't find the problem, send me (and only me - not the list) the 
> whole file save_vel.f and I'll take a look.
> 
> Cheers,

Thanks a lot and happy new year!
Fabian

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-12-31  9:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-28 18:58 multiple definition of `MAIN__' Fabian Braennstroem
2003-12-28 19:59 ` Fabian Braennstroem
2003-12-28 20:22 ` SORRY again, " Fabian Braennstroem
2003-12-29 13:03 ` Toon Moene
2003-12-29 22:15   ` Fabian Braennstroem
2003-12-30 13:50     ` Toon Moene
2003-12-31  9:08       ` Fabian Braennstroem

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).