Subject: Re: finding the linker with gcc3
To: James K. Lowden <jklowden@schemamania.org>
From: Frederick Bruckman <fredb@immanent.net>
List: tech-pkg
Date: 03/28/2004 08:29:17
On Sun, 28 Mar 2004, James K. Lowden wrote:

> I am using gcc3-c++-3.3.2 and have had some problems because
> /usr/pkg/gcc3/bin/c++ was using /usr/bin/ld instead of /usr/pkg/bin/ld.
>
> I had assumed pkgsrc would take steps to cause the gcc3 compilers to use
> the "right" linker.  Having reviewed the gcc docs, I understand there's no
> "right", but I still think it's a little queer that pkgsrc compilers don't
> automatically use the linker installed by pkgsrc.
>
> Anyone who fails to tie the new compiler to the new linker is apt to trip
> on "Dwarf" errors, at least on i386 machines.

By "new", do you mean ld 2.14? "binutils" and "gcc" are distributed by
separate entities, so there's no exact correspondence.

> I'm not sure there's a good answer.  It's not strictly necessary make
> binutils a dependency of the gcc3 tools, and without a pkgsrc dependency
> it would be irresponsible to configure gcc3 to use /usr/pkg/bin/ld.  I
> looked for a way to make it prefer /usr/pkg/bin/ld and fallback to
> /usr/bin/ld -- which seems like it would DTRT most of the time -- but I
> didn't find a way.

The real problem is, the binutils package may well be older than the
one in the tree, or if not that, exactly the same, and it's annoying
when pkgsrc install multiple versions of the same program.

Look in "lang/gcc3-c/Makefile.common" at the addition of
--with-as=fullpath, conditionally on ${USE_BINUTILS} being set. If
we're pulling in binutils anyhow, we might as hardcode the path to
"ld", too, with --with-ld. We should probably just switch the test
from "${AS}" to "{LD}, and bump the version tested for to 2.14.


Frederick