Error compiling GCC 3.4.6 in Ubuntu 14.04

2019-04-21 01:31发布

问题:

I am trying to compile GCC 3.4.6 in Ubuntu 14.04 x64. It already has newer version of GCC-4.8.2.

I ran ./configure --prefix=/usr/local/gcc-3.4 and make.

I ended up in several errors for which I could find solutions on searching.

Error 1

Error 2

Finally I ended up in this error, which I couldn't find any solution.

../../gcc/unwind-dw2.c: In function `uw_frame_state_for':
../../gcc/unwind-dw2.c:1031: error: field `info' has incomplete type
make[2]: *** [libgcc/32/unwind-dw2.o] Error 1
make[2]: Leaving directory `/home/hp-11/Documents/gcc-3.4.6/build/gcc'
make[1]: *** [stmp-multilib] Error 2
make[1]: Leaving directory `/home/hp-11/Documents/gcc-3.4.6/build/gcc'
make: *** [all-gcc] Error 2

Does anybody know how to fix it? Please let me know if more details are needed.

回答1:

This is old good-known problem, regarding siginfo and siginfo_t

All you need is to look at you GCC sources for all places like

struct rt_sigframe {            \
  int sig;              \
  struct siginfo *pinfo;          \
  void *puc;              \
  struct siginfo info;            \
  struct ucontext uc;           \
} *rt_ = (CONTEXT)->cfa;          \
sc_ = (struct sigcontext *) &rt_->uc.uc_mcontext;   \

this one is inside gcc/config/i386/linux.h but your arch may differ

And manually replace struct siginfo * to siginfo_t * and struct siginfo to siginfo_t, making it newest POSIX compatible. In every rt_sigframe declaration there is most common to be two such places, including your info field of problem.



标签: ubuntu gcc gcc3