This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: fPIC error hard to diagnose
- From: Ian Lance Taylor <iant at google dot com>
- To: Mathieu Lacage <mathieu dot lacage at gmail dot com>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Mon, 12 Oct 2009 00:16:07 -0700
- Subject: Re: fPIC error hard to diagnose
- References: <74fef6df0910111507v5a4a9da1q82b58d5d9fe955fb@mail.gmail.com>
Mathieu Lacage <mathieu.lacage@gmail.com> writes:
> I tried to build gcc trunk to test -flto but I keep getting the same
> error during link:
> /usr/bin/ld: /tmp/cclQrpIm.lto.o: relocation R_X86_64_PC32 against
> symbol `_ZN3ns316g_logTi
> mePrinterE' can not be used when making a shared object; recompile with -fPIC
> /usr/bin/ld: final link failed: Bad value
> collect2: ld returned 1 exit status
>
> So, I added -fPIC instead of -fpic to my build lines but still get the
> error which means that I probably forgot one file somewhere but I am
> stuck while trying to figure out which of them I forgot:
> /tmp/cclQrpIm.lto.o does not exist anymore when gcc returns so, I
> can't just go and look at it to figure which source file it
> corresponds to. Would someone know of a nice gcc option which can make
> it report a more useful error (or which can make it leave the file in
> place) ?
You could try using the --save-temps option.
The '.lto.o' in the name suggests that you are using LTO, which
suggests that -fpic may not be carrying through LTO somehow.
Ian