Subject: Re: 'C compiler cannot create executables' on Darwin
To: Michal Pasternak <michal@pasternak.w.lub.pl>
From: grant beattie <grant@NetBSD.org>
List: tech-pkg
Date: 12/23/2003 11:00:20
On Mon, Dec 22, 2003 at 11:27:01PM +0100, Michal Pasternak wrote:

> As it came out after some googling and a short chat with David and
> Alexander, the problem they have results because of passing malformed options
> like (-Wl,,whatever) to Darwin's ld.
> 
> I am not quite sure if this is the same situation they occur, but
> as it came out:
> 
> mk/defs.Darwin.mk define:
> _OPSYS_RPATH_NAME=      -L      # darwin has no rpath, use -L instead

I can't get this to fail for me on Darwin 6.8, but perhaps something
changed/got broken in 7.0. does passing -L or -Wl,-L to either cc or
ld really not work?

> But, in turn in mk/buildlink2/gen-transforms.sh you have:
> #       no-rpath                removes "-R*", "-Wl,-R", and "-Wl,-rpath,*"
> #       sanitize-rpath          translates "-Wl,-R", and "-Wl,-rpath,*"
> #                                       to whatever is appropriate
> 
> See? There is _no_ option, that would translate -Wl,-L "to whatever is
> appropriate" (I have no idea what does this mean) -- there is also no option
> to remove -Wl,-L (and such situation occurs propably on Darwin).

I tried setting _OPSYS_RPATH_NAME=-R and the rpath arguments were
stripped from the cc command-line. you should be able to just change
this single line in defs.Darwin.mk to test it.

this is not ideal, since -R will sometimes be present in LDFLAGS and
therefore a manual pkg build in the WRKDIR won't work...

> I might be totally wrong here, but it would be really nice if someone could
> provide patches for Darwin's setting of "-Wl,-L" for gen-transforms.sh, send
> it to those two gentlemen and see if this will help them.

please let me know whether any combination of -L and -Wl,-L arguments
to cc/ld work so I know how to address this.

thanks!

grant.