2017-10-29 6 views
2

Archlinux에서 gcc 7.2와 독립적으로 gcc 6.4.0을 컴파일하려고합니다. 다음과 같이Archlinux에서 gcc 7.2와 gcc 6.4.0을 컴파일하는 방법

구성은 다음과 같습니다

../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 

컴파일하는 동안, 나는 md-unwind-support.h에서 다음과 같은 오류있어 : GCC 6.4.0과 GCC 7.2.0과 정의 사이에 나는 md-unwind-support.h

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

비교 struct ucontext은 gcc 7.2.0에서 ucontext_t으로 정의됩니다.

그래서, GCC 6.4.0 소스 트리의 md-unwind-support.h에 약간의 변화를 만들었지 만 다음과 같이 네임 스페이스 문제의 일부 kine를 가지고 :

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

내가 박히면서이 문제에 대해 아무 생각이 없습니다.

도움과 조언이 도움이 될 것입니다.

답변

2

마침내 문제가 해결되었습니다. 난 당신이 make_folder 당신이 make 명령을 입력 폴더에있는 파일 make_folder/libgcc/config/i386/linux_unwind.h을 수정해야 할 일을 make을 위해 직접 md-unwind-support.h

2

대신 libgcc/config/i386/linux_unwind.h을 수정 한 것이다. linux_unwind.h에서

당신은 어떤 파일을 수정하는 우리에게 말했다 Seong-struct ucontext_t *uc_ = context->cfa;

덕분에 라인 (61)에 struct ucontext *uc_ = context->cfa;을 변경해야합니다.

0

다음은 내가 한 일을 소화하는 패치입니다. 즉, ucontext_t에 struct ucontext를 변경하고 void 포인터에 sigaltstack 포인터를 구조체로 변경하고 sigaltstack을 stack_t로 변경합니다.

diff -urN gcc-6.3.0/libgcc/config/i386/linux-unwind.h gcc-6.3.0.new/libgcc/config/i386/linux-unwind.h 
--- gcc-6.3.0/libgcc/config/i386/linux-unwind.h 2016-01-04 23:30:50.000000000 +0900 
+++ gcc-6.3.0.new/libgcc/config/i386/linux-unwind.h 2017-10-29 23:01:21.717240052 +0900 
@@ -58,7 +58,7 @@ 
    if (*(unsigned char *)(pc+0) == 0x48 
     && *(unsigned long long *)(pc+1) == RT_SIGRETURN_SYSCALL) 
    { 
-  struct ucontext *uc_ = context->cfa; 
+  ucontext_t *uc_ = context->cfa; 
     /* The void * cast is necessary to avoid an aliasing warning. 
      The aliasing warning is correct, but should not be a problem 
      because it does not alias anything. */ 
@@ -138,7 +138,7 @@ 
    siginfo_t *pinfo; 
    void *puc; 
    siginfo_t info; 
- struct ucontext uc; 
+ ucontext_t uc; 
     } *rt_ = context->cfa; 
     /* The void * cast is necessary to avoid an aliasing warning. 
      The aliasing warning is correct, but should not be a problem 
diff -urN gcc-6.3.0/libsanitizer/sanitizer_common/sanitizer_linux.cc gcc-6.3.0.new/libsanitizer/sanitizer_common/sanitizer_linux.cc 
--- gcc-6.3.0/libsanitizer/sanitizer_common/sanitizer_linux.cc 2015-11-23 18:07:18.000000000 +0900 
+++ gcc-6.3.0.new/libsanitizer/sanitizer_common/sanitizer_linux.cc 2017-10-29 23:09:00.490577558 +0900 
@@ -546,8 +546,7 @@ 
} 
#endif 

-uptr internal_sigaltstack(const struct sigaltstack *ss, 
-       struct sigaltstack *oss) { 
+uptr internal_sigaltstack(const void *ss, void *oss) { 
    return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss); 
} 

diff -urN gcc-6.3.0/libsanitizer/sanitizer_common/sanitizer_linux.h gcc-6.3.0.new/libsanitizer/sanitizer_common/sanitizer_linux.h 
--- gcc-6.3.0/libsanitizer/sanitizer_common/sanitizer_linux.h 2015-10-21 16:32:45.000000000 +0900 
+++ gcc-6.3.0.new/libsanitizer/sanitizer_common/sanitizer_linux.h 2017-10-29 23:09:43.907244619 +0900 
@@ -19,7 +19,6 @@ 
#include "sanitizer_platform_limits_posix.h" 

struct link_map; // Opaque type returned by dlopen(). 
-struct sigaltstack; 

namespace __sanitizer { 
// Dirent structure for getdents(). Note that this structure is different from 
@@ -28,8 +27,7 @@ 

// Syscall wrappers. 
uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count); 
-uptr internal_sigaltstack(const struct sigaltstack* ss, 
-       struct sigaltstack* oss); 
+uptr internal_sigaltstack(const void* ss, void* oss); 
uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set, 
    __sanitizer_sigset_t *oldset); 
void internal_sigfillset(__sanitizer_sigset_t *set); 
diff -urN gcc-6.3.0/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc gcc-6.3.0.new/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc 
--- gcc-6.3.0/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc 2015-10-21 16:32:45.000000000 +0900 
+++ gcc-6.3.0.new/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc 2017-10-29 23:08:07.260577074 +0900 
@@ -267,7 +267,7 @@ 

    // Alternate stack for signal handling. 
    InternalScopedBuffer<char> handler_stack_memory(kHandlerStackSize); 
- struct sigaltstack handler_stack; 
+ stack_t handler_stack; 
    internal_memset(&handler_stack, 0, sizeof(handler_stack)); 
    handler_stack.ss_sp = handler_stack_memory.data(); 
    handler_stack.ss_size = kHandlerStackSize; 
diff -urN gcc-6.3.0/libsanitizer/tsan/tsan_platform_linux.cc gcc-6.3.0.new/libsanitizer/tsan/tsan_platform_linux.cc 
--- gcc-6.3.0/libsanitizer/tsan/tsan_platform_linux.cc 2016-08-12 17:53:46.000000000 +0900 
+++ gcc-6.3.0.new/libsanitizer/tsan/tsan_platform_linux.cc 2017-10-29 23:10:38.817245120 +0900 
@@ -291,7 +291,7 @@ 
int ExtractResolvFDs(void *state, int *fds, int nfd) { 
#if SANITIZER_LINUX 
    int cnt = 0; 
- __res_state *statp = (__res_state*)state; 
+ struct __res_state *statp = (struct __res_state*)state; 
    for (int i = 0; i < MAXNS && cnt < nfd; i++) { 
    if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1) 
     fds[cnt++] = statp->_u._ext.nssocks[i];