1

I'm trying to compile the GCC from source with module-TS support and I cloned to the devel branch (as stated here) :

git clone --branch devel/c++-modules git://gcc.gnu.org/git/gcc.git SRCDIR

Here's my configuration options :

./configure --disable-shared --disable-bootstrap --disable-libstdcxx-pch 
--enable-languages=c,c++ --enable-libgomp --enable-lto --enable-threads=posix --enable-tls    
--with-gmp=/tmp/gcc --with-mpfr=/tmp/gcc --with-mpc=/tmp/gcc --with-libelf=/tmp/gcc --with-fpmath=sse

And make gave me the following errors:

/usr/bin/ld: /usr/local/lib/../lib64/libstdc++.a(compatibility.o): relocation R_X86_64_32
against symbol `_ZTIN10__cxxabiv115__forced_unwindE' can not be used when making a shared
object; recompile with -fPIC

/usr/bin/ld: final link failed: Nonrepresentable section on output

collect2: error: ld returned 1 exit status

And similar errors for sso_string.o , istream-inst.o , etc.
What does that mean?
How can I recompile that with -fPIC?

Do I need to patch the Makefiles?
Any help is appreciated.Thanks.

Parsa Mousavi
  • 1,052
  • 1
  • 13
  • 31
  • 1
    You may try with `--enable-cxx-flags='-fPIC'` but I'm not sure this is the solution – Matteo Ragni Mar 18 '20 at 08:26
  • Tried it.Exact same errors. – Parsa Mousavi Mar 18 '20 at 08:28
  • This may sound as silly, but have you done a `make clean`? – Matteo Ragni Mar 18 '20 at 08:29
  • @MatteoRagni Yes. – Parsa Mousavi Mar 18 '20 at 08:32
  • With flag `--with-pic=yes`? – Matteo Ragni Mar 18 '20 at 08:35
  • I did a "make distclean" and repeated the process from beginning with those options.But nothing.It still says recompile with -fPIC. – Parsa Mousavi Mar 18 '20 at 08:53
  • Because I suspect the issue is on the instaled library `libstdc++.a`, not on something you are currently compiling. I'm looking at this issue, check it out to see if there is some information useful for you https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54482 – Matteo Ragni Mar 18 '20 at 09:25
  • 1
    Not sure if your problem has been solved, but this seems quite similar to the problems mentioned in https://stackoverflow.com/questions/40246054/gcc-6-2-0-is-attempting-to-create-shared-object-when-it-shouldnt and https://stackoverflow.com/questions/41470945/relocation-r-x86-64-32s-against-data-can-not-be-used-when-making-a-shared-obj – jcoppens May 18 '20 at 04:38

0 Answers0