參考資訊:
https://gist.github.com/unity-car-tutorials/0ce692a5ecb06c656182
https://reviews.llvm.org/rG383fe5c8668f63ef21c646b43f48da9fa41aa100
https://patchwork.ozlabs.org/project/gcc/patch/6824253.3U2boEivI2@devpool21/
步驟如下:
1. 手動掛載SWAP 2GB
2. 編譯安裝coreutils(/usr/bin/install記得symlink到/usr/local/bin/install)
3. 執行如下命令
$ export GCC_VERSION="4.9.4" $ export WORKDIR="/home/nemo/Downloads/gcc-${GCC_VERSION}" $ export INSTALLDIR="/opt/gcc-${GCC_VERSION}" $ rm -rf ${WORKDIR} $ mkdir -p ${WORKDIR} $ cd $WORKDIR $ wget http://www.netgull.com/gcc/releases/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.bz2 $ tar -xf gcc-${GCC_VERSION}.tar.bz2 $ cd gcc-${GCC_VERSION} $ ./contrib/download_prerequisites $ cd .. $ mkdir gcc-build $ cd gcc-build $ ../gcc-${GCC_VERSION}/configure --prefix=${INSTALLDIR} --with-gnu-as --with-gnu-ld --disable-libmudflap --enable-lto --enable-objc-gc --enable-shared --without-included-gettext --enable-nls --disable-sjlj-exceptions --enable-gnu-unique-object --enable-linker-build-id --disable-libstdcxx-pch --enable-c99 --enable-clocale=gnu --enable-libstdcxx-debug --enable-long-long --with-cloog=no --with-ppl=no --with-isl=no --disable-multilib --with-float=hard --with-mode=thumb --with-tune=cortex-a9 --with-arch=armv7-a --with-fpu=vfpv3-d16 --enable-threads=posix --enable-multiarch --enable-libstdcxx-time=yes --enable-checking=release --disable-bootstrap --enable-languages=c,c++,fortran,lto $ make ../../../../gcc-4.9.4/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:84:23: fatal error: sys/ustat.h: No such file or directory #include <sys/ustat.h> $ vim ../gcc-4.9.4/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc 84 //#include <sys/ustat.h> 153 #if SANITIZER_LINUX 154 unsigned struct_rlimit_sz = sizeof(struct rlimit); 155 unsigned struct_epoll_event_sz = sizeof(struct epoll_event); 156 unsigned struct_sysinfo_sz = sizeof(struct sysinfo); 157 unsigned struct_timespec_sz = sizeof(struct timespec); 158 unsigned __user_cap_header_struct_sz = 159 sizeof(struct __user_cap_header_struct); 160 unsigned __user_cap_data_struct_sz = sizeof(struct __user_cap_data_struct); 161 unsigned struct_utimbuf_sz = sizeof(struct utimbuf); 162 unsigned struct_new_utsname_sz = sizeof(struct new_utsname); 163 unsigned struct_old_utsname_sz = sizeof(struct old_utsname); 164 unsigned struct_oldold_utsname_sz = sizeof(struct oldold_utsname); 165 unsigned struct_itimerspec_sz = sizeof(struct itimerspec); 166 167 #if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) || defined(__x86_64__) 168 #define SIZEOF_STRUCT_USTAT 32 169 #elif defined(__arm__) || defined(__i386__) || defined(__mips__) || defined(__powerpc__) || defined(__s390__) 170 #define SIZEOF_STRUCT_USTAT 20 171 #else 172 #error Unknown size of struct ustat 173 #endif 174 175 unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT; 176 #endif // SANITIZER_LINUX $ make ../../../../gcc-4.9.4/libsanitizer/asan/asan_linux.cc:107:20: error: 'SIGSEGV' was not declared in this scope return signum == SIGSEGV && flags()->handle_segv; ^ ../../../../gcc-4.9.4/libsanitizer/asan/asan_linux.cc:108:1: warning: control reaches end of non-void function [-Wreturn-type] } $ vim ../gcc-4.9.4/libsanitizer/asan/asan_linux.cc 29 #include <signal.h> $ make $ sudo make install