develooper Front page | perl.perl5.porters | Postings from September 2008

Re: linkers and $cc (Re: FYI - Blead changes to ExtUtils::CBuilder)

Thread Previous | Thread Next
Andy Dougherty
September 1, 2008 09:08
Re: linkers and $cc (Re: FYI - Blead changes to ExtUtils::CBuilder)
Message ID:
On Mon, 1 Sep 2008, Nicholas Clark wrote:

> Well, Jarkko has said that there is something to fix (I see that it's not
> in perltodo.pod), but from memory, it's:
> Right now, Configure probes for two commands, and sets two variables:
> cc (cc.U):
> 	This variable holds the name of a command to execute a C compiler which
> 	can resolve multiple global references that happen to have the same
> 	name.  Usual values are 'cc' and 'gcc'.
> 	Fervent ANSI compilers may be called 'c89'.  AIX has xlc.
> ld (dlsrc.U):
> 	This variable indicates the program to be used to link
> 	libraries for dynamic loading.  On some systems, it is 'ld'.
> 	On ELF systems, it should be $cc.  Mostly, we'll try to respect
> 	the hint file setting.
> There is an implicit historical assumption, probably from Perl 1, that $cc is
> also the correct command for linking object files together to make an
> executable. This may be true on Unix, but it's not true on other platforms,
> and there are a maze of work arounds in other places (such as Makefile.SH)
> to cope with this.

Yes.  Well summarized.  (Though I think I've harped about this more than 
Jarkko, probably because I'm more to blame for the current state of 
confusion than he is.)

> Ideally, we should create a new variable to hold the name of the executable
> linker program, probe for it in Configure, and centralise all the special
> case logic there or in hints files.
> A small bikeshed issue remains - what to call it, given that $ld is already
> taken (arguably for the wrong thing) and $link would be confused with the
> Unix command line executable of the same name, which does something completely
> different.

(Incidentally, I chose the name 'ld' because on SunOS 4.1, that's the 
command you actually used to build dynamically-loadable modules.)

In parrot, I tried to call the command used to link object files and 
libraries into an executable 'link', since that's what my 
vaguely-remembered DOS and VMS experience suggested.  I don't think any 
real confusion has ensued, so it's probably a reasonable name for perl5 to 

Alas, I've always worried that introducing it would make things worse, 
since now the module building utilities would have to look for 
$Config{link} and institute a fall-back plan if it weren't found.

    Andy Dougherty

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About