3

I tried to install gcc6.4.0 in Fedora28, while something wrong happened as following.

In file included from ../.././libgcc/unwind-dw2.c:401:0:
./md-unwind-support.h: In function ‘x86_64_fallback_frame_state’:
./md-unwind-support.h:65:47: error: dereferencing pointer to incomplete type ‘struct ucontex_t’
       sc = (struct sigcontext *) (void *) &uc_->uc_mcontext;
                                               ^~

And at the end the message is here:

make[3]: *** [../.././libgcc/shared-object.mk:14: unwind-dw2.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory '/home/rx/program/gcc-6.4.0/x86_64-pc-linux-gnu/libgcc'
make[2]: *** [Makefile:17378: all-stage1-target-libgcc] Error 2
make[2]: Leaving directory '/home/rx/program/gcc-6.4.0'
make[1]: *** [Makefile:23677: stage1-bubble] Error 2
make[1]: Leaving directory '/home/rx/program/gcc-6.4.0'
make: *** [Makefile:914: all] Error 2

I have try the previous solution, but it still failed.

Am I missing something? Thank you!

Jianhao
  • 91
  • 2
  • 5

1 Answers1

5

This is due to a change in recent versions of glibc which required changes to the GCC sources. GCC 6.4.0 was released before those changes happened, so you'll need to patch the code yourself. The fix needed is https://gcc.gnu.org/viewcvs/gcc/trunk/libgcc/config/i386/linux-unwind.h?r1=249731&r2=249730&pathrev=249731

I have try the previous solution, but it still failed.

That's not possible. Are you sure you made both changes suggested there, not just on line 61?

Jonathan Wakely
  • 166,810
  • 27
  • 341
  • 521
  • That link is no longer accessible. Can it be updated please? – codesniffer Mar 09 '20 at 13:59
  • 2
    The gcc.gnu.org server has just been replaced and some links are not working yet. That commit is also visible as https://gcc.gnu.org/g:883312dc79806f513275b72502231c751c14ff72 – Jonathan Wakely Mar 09 '20 at 22:28
  • Thanks for the quick update. I was able to find the commit by searchig based on your answer. – codesniffer Mar 09 '20 at 23:44
  • Any chance this patch is available for GCC 4.9? – codesniffer Mar 10 '20 at 13:12
  • 1
    It's not but you only need to change one or two lines in one file (the one relevant to the architecture you're building GCC for) so I'm sure you can figure it out. – Jonathan Wakely Mar 10 '20 at 16:47
  • It worked for me, using @Jonathan Wakely's commit link where I had to manually change the "struct ucontext" to "ucontext_t" in my multiple linux-unwind.h files. That resolved THIS error, but nonetheless I still encountered another error after that, something with 'sanitizer_stoptheworld_linux_libcdep.lo' – tamtam Dec 17 '20 at 12:01
  • @tamtam see the commits at https://github.com/gcc-mirror/gcc/compare/releases/gcc-7.1.0...jwakely:renovated/gcc-7.1.0 which fix gcc-7.1.0 to compile on modern systems. The fixes for gcc-6.4.0 will be similar. – Jonathan Wakely Dec 18 '20 at 08:06