Subject: Re: linking prob
To: Luke Mewburn <lukem@NetBSD.org>
From: Patrick Welche <prlw1@newn.cam.ac.uk>
List: current-users
Date: 08/18/2004 14:29:24
On Wed, Aug 18, 2004 at 02:42:55AM +1000, Luke Mewburn wrote:
> On Tue, Aug 17, 2004 at 05:09:48PM +0100, Patrick Welche wrote:
>   | I have some code I last compiled in July 2000. I just tried with
>   | yesterday's CVS code and got at the linking stage:
>   | 
>   | ...
>   | f77 -O -g -c /home/prlw1/minp/gulp1.2/angle.f
>   | ...
>   | cc -O2 -g -pipe   -Werror   -Wno-error -DLINUX    -c    /home/prlw1/minp/gulp1.2/cfree.c
>   | ...
>   | #      link  gulp1.2/gulp
>   | cc  -lg2c -lm   -o gulp  -Wl,-rpath-link,/lib:/usr/lib  -L/lib defopt.o fit.o
>   | ...
>   | /usr/lib/crt0.o(.text+0x86): In function `___start':
>   | : undefined reference to `main'
> 
> Please submit a toolchain PR with details.

Hmm.. it turns out all I need to do is LDADD+=lfrtbegin, or make sure that
f77 is used to link rather than cc. I don't see a nice bsd.foo.mk variable
way of doing this..

However, this does remind me of the thread nearby on whether or not to
LDADD+=lstdc++. Don't they both boil down to "by the link stage, we no
longer know what language(s) the original source files were written in,
so we default to using cc to link"?

Cheers,

Patrick