Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compile gcc 6.4.0 with gcc 7.2 in Archlinux

Tags:

gcc

archlinux

I am trying to compile gcc 6.4.0 independently with gcc 7.2 in Archlinux.

Configuration is as follows:

../configure --prefix=${INSTALL_PREFIX} --enable-languages=c,c++,fortran \
    --enable-threads=posix --enable-tls --enable-libgomp --enable-lto \
    --enable-shared --enable-static --disable-nls --disable-multilib \
    --with-fpmath=sse

While compiling, I got the following error in md-unwind-support.h:

md-unwind-support.h:65:47: error: dereferencing pointer to incomplete type 'struct ucontext'

I compared md-unwind-support.h between defined in gcc 6.4.0 and gcc 7.2.0 and found that struct ucontext is defined as ucontext_t in gcc 7.2.0.

So, I made some changes in md-unwind-support.h of gcc 6.4.0 source tree but got some kine of namespace issue as follows:

int std::uncaught_exceptions() should have been declared inside 'std'

I get stuck and have no idea about this issue.

Any help and advice will be helpful.

like image 459
Seong Avatar asked Oct 29 '17 11:10

Seong


2 Answers

In order to have make to work you have to modify the file make_folder/libgcc/config/i386/linux_unwind.h where make_folder is the folder where you type the make command.

In linux_unwind.h you have to change struct ucontext *uc_ = context->cfa; on line 61 to struct ucontext_t *uc_ = context->cfa;

Thanks to Seong that told us what file to modify.

like image 196
Jack Wire Avatar answered Nov 16 '22 18:11

Jack Wire


I finally resolved issue. I should have modified libgcc/config/i386/linux_unwind.h instead of directly md-unwind-support.h

like image 10
Seong Avatar answered Nov 16 '22 19:11

Seong