This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Bug: Undefined reference to MAIN__
- To: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Subject: Re: Bug: Undefined reference to MAIN__
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 03 Oct 2001 03:41:23 -0300
- Cc: martin dot kahlert at infineon dot com, gcc at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Organization: GCC Team, Red Hat
- References: <20011001104419.A31910@keksy.muc.infineon.com><3BBA3BE3.C465F034@moene.indiv.nluug.nl>
On Oct 2, 2001, Toon Moene <toon@moene.indiv.nluug.nl> wrote:
> Martin Kahlert wrote:
>> /home/kahlert/LOCAL/OBJ-3.1/i686-pc-linux-gnu/libf2c/libF77/../../../../gcc-3.1/libf2c/libF77/main.c:61:
>> undefined reference to `MAIN__'
>> collect2: ld returned 1 exit status
> I think I solved this problem with the attached patch.
It appears to me that the problem is that the fortran shared library
is being linked with frtbegin.o, which is inappropriate. My
understanding is that shared libraries shouldn't be linked with
frtbegin.o, only the main program should.
I'd rather arrange for frtbegin.o to not be linked in if either
`-shared' or `-r' are seen in the command line. Otherwise, other
fortran shared libraries may fall on the same trap. Besides, it might
break existing multi-language code that knows about frtbegin.o and
explicitly links it in.
> Unfortunately, this patch doesn't solve the problem that one cannot run
> the Fortran testsuite successfully without installing the compiler -
> that's a problem I'm going to tackle tomorrow ...
`grep -i library_path gcc/testsuite/lib/g++.exp' for some ideas on how
to do it, in case you find yourself wondering how to fix it.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me