This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Bug: Undefined reference to MAIN__


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]