how to tell pgc++ path of ld to be used for linking

Hi,

in our build environment we want to avoid the use of env variables as much as possible. We cannot rely on the local system ld and we therefore use the -B command line option of g++ to tell it the location of */binutils/bin.
Is there a similar option for pgc++? I have searched the doc, but haven’t found anything, but maybe there is an undocumented feature? Or is adding it to the PATH at the right position the only way to handle this?

Thanks,
LS

Hi LS,

The compiler will use the “ld” found in your PATH. Alternatively, you can add the option “LD=/path/to/ld” to the command line.

Hope this helps,
Mat

Hi Mat,

thanks for the info. I have tried it out, but it seems the LD option doesn’t support the specification of a full path like /path/to/ld. Instead, it appends whatever has been specified for LD to the existing entries of PATH variable until it finds a valid ld binary with that path. If I specify e.g. LD=…/…/…/absolute/path/to/ld and there happens to be a entry in PATH with three components, e.g. /usr/local/bin, then it works as the appended path /usr/local/bin/…/…/…/absolute/path/to/ld points to a valid ld binary. However, this is not a real solution as it depends on PATH.
Am I doing something wrong or is there another way to tell PGI compiler that I am specifying an absolute instead of a relative path to ld?

Thanks,
LS

My apologies. You are correct that LD just specifies the name of the linker to use. For the directory, use “LDDIR”.

% pgcc LDDIR=/tmp/path/to/ LD=my-ld test.c
pgcc-Error-Required tool my-ld was not found
pgcc... looked for my-ld at /tmp/path/to//my-ld
pgcc-Error-Tool loader was not found

-Mat

Thanks, now I got it to work as expected.

Best Regards,
LS