I'd like to specify GCC's search directory for the startfile
and
endfile
: crt1.o
, crti.o
and crtn.o
. Passing -B
on the command line to
the GCC driver works, but is inconvenient. How do I modify the specs
file (lib/gcc/x86_64-unknown-linux-gnu/4.9.2/specs
) to specify the search path for startfile
?
I tried adding the -B
option to the startfile
spec and got the error:
ld: unrecognized option '-B/gsc/btl/linuxbrew/lib'
I then tried adding the -B
option to the cc1
spec and got the error:
cc1: error: command line option '-B/gsc/btl/linuxbrew/lib' is valid
for the driver but not for C
If it's not possible to do this via the specs
file, is there an environment variable or a configure option to GCC that accomplishes the same goal?
I've installed a recent version of glibc
in my home directory. Everything's working great. I've modified the specs
file to link against the new version of glibc
, but it's still linking against the old system version in /usr
of startfile
and endfile
.
Here's a the unanswered question on the gcc-help
mailing list. Here's a related Linuxbrew bug, gfortran is broken with stand alone Linuxbrew, and a proposed fix, gcc, binutils: link to Cellar instead of system libs.
Thanks,
Shaun
You can use an absolute path in the *startfile:
and *endfile:
sections in the specs file, instead of the default relative paths. This will override GCC's choice of the default location.
As per https://wiki.debian.org/Multiarch/LibraryPathOverview, gcc will look for startup files such as crt1.o
in $(sysroot)/lib
, so you can specify the --sysroot
option when running gcc, or compile gcc with --with-sysroot
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With