gcc-5.4.0 static dwarf2 compile

-------------------------------------------------------------------------------
又开始折腾了, 静态编译 gcc-5.4.0 dwarf2
-------------------------------------------------------------------------------
http://ftp.gnu.org/gnu/mpfr/mpfr-3.1.4.tar.xz
-------------------------------------------------------------------------------
./configure 
--prefix=/usr/local 
--disable-shared 
--enable-static
make && make install
-------------------------------------------------------------------------------
ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz
-------------------------------------------------------------------------------
./configure 
--prefix=/usr/local 
--disable-shared 
--enable-static
make && make install
-------------------------------------------------------------------------------
https://gmplib.org/download/gmp/gmp-6.1.1.tar.xz
-------------------------------------------------------------------------------
./configure 
--host=i686-w64-mingw32 
--build=i686-w64-mingw32 
--target=i686-w64-mingw32 
--host=i686-w64-mingw32 
--prefix=/usr/local 
--disable-shared 
--enable-static 
--enable-cxx

configure: summary of build options:

  Version:           GNU MP 6.1.1
  Host type:         i686-w64-mingw32
  ABI:               32
  Install prefix:    /usr/local
  Compiler:          gcc
  Static libraries:  yes
  Shared libraries:  no  
  
__declspec(dllexport)                    fix to -->   __attribute__((visibility ("default")))
__declspec(dllimport)                    fix to -->   

make && make install

-------------------------------------------------------------------------------
http://isl.gforge.inria.fr/isl-0.17.1.tar.xz
-------------------------------------------------------------------------------
./configure 
--host=i686-w64-mingw32 
--build=i686-w64-mingw32 
--target=i686-w64-mingw32 
--host=i686-w64-mingw32 
--disable-shared 
--enable-static
make && make install
-------------------------------------------------------------------------------
http://www.mr511.de/software/libelf-0.8.13.tar.gz
-------------------------------------------------------------------------------
./configure 
--prefix=/usr/local 
--disable-shared 
--enable-static
make && make install
-------------------------------------------------------------------------------
http://bugseng.com/products/ppl/download/ftp/releases/1.2/ppl-1.2.tar.xz        don't install the ppl-1.2
http://bugseng.com/products/ppl/download/ftp/releases/0.11.2/ppl-0.11.2.tar.bz2
http://bugseng.com/products/ppl/download/ftp/releases/0.12.1/ppl-0.12.1.tar.xz
-------------------------------------------------------------------------------
./configure 
--prefix=/usr/local 
--disable-shared 
--enable-static 
--enable-cxx 
--with-gmp=/usr/local 

make && make install
===============================================================================
configure: error: Cannot find GMP version 4.1.3 or higher.
GMP is the GNU Multi-Precision library:
see http://www.swox.com/gmp/ for more information.
When compiling the GMP library, do not forget to enable the C++ interface:
add --enable-cxx to the configuration options.

So I also faced the same issue and what I did was:

1) Went inside gmp-6.1.1 folder
2) make distclean
3) ./configure --prefix=/usr/local ... add --enable-cxx
4) make && make install
5) Went inside ppl-0.12.1 folder
6) ./configure --prefix=/usr/local ...
7) make & make install

Took some 10-20 mins to compile and things were fine.
===============================================================================
GMP version 5.1.0 (and, presumably, later versions) defines std::numeric_limits.
 src/mp_std_bits.cc      |    6 ++++++
 src/mp_std_bits_defs.hh |    6 ++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/mp_std_bits.cc b/src/mp_std_bits.cc
index c8da535..918b9af 100644
--- a/src/mp_std_bits.cc
+++ b/src/mp_std_bits.cc
@@ -25,6 +25,9 @@ site: http://bugseng.com/products/ppl/ . */
 #include "ppl-config.h"
 #include "mp_std_bits_defs.hh"
 
+#if __GNU_MP_VERSION < 5 
+  || (__GNU_MP_VERSION == 5 && __GNU_MP_VERSION_MINOR < 1)
+
 const bool std::numeric_limits::is_specialized;
 const int std::numeric_limits::digits;
 const int std::numeric_limits::digits10;
@@ -70,3 +73,6 @@ const bool std::numeric_limits::is_modulo;
 const bool std::numeric_limits::traps;
 const bool std::numeric_limits::tininess_before;
 const std::float_round_style std::numeric_limits::round_style;
+
+#endif // __GNU_MP_VERSION < 5
+       // || (__GNU_MP_VERSION == 5 && __GNU_MP_VERSION_MINOR < 1)


diff --git a/src/mp_std_bits_defs.hh b/src/mp_std_bits_defs.hh
index f71595a..0d078ec 100644
--- a/src/mp_std_bits_defs.hh
+++ b/src/mp_std_bits_defs.hh
@@ -38,6 +38,9 @@ void swap(mpz_class& x, mpz_class& y);
 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
 void swap(mpq_class& x, mpq_class& y);
 
+#if __GNU_MP_VERSION < 5 
+  || (__GNU_MP_VERSION == 5 && __GNU_MP_VERSION_MINOR < 1)
+
 namespace std {
 
 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
@@ -164,6 +167,9 @@ public:
 
 } // namespace std
 
+#endif // __GNU_MP_VERSION < 5
+       // || (__GNU_MP_VERSION == 5 && __GNU_MP_VERSION_MINOR < 1)
+
 #include "mp_std_bits_inlines.hh"
 
 #endif // !defined(PPL_mp_std_bits_defs_hh)
===============================================================================
-------------------------------------------------------------------------------

http://www.bastoul.net/cloog/pages/download/cloog-0.18.4.tar.gz
-------------------------------------------------------------------------------
./configure 
--prefix=/usr/local 
--disable-shared 
--enable-static 
--with-ppl=/usr/local 
--with-isl=system 
-------------------------------------------------------------------------------
http://ftp.osuosl.org/pub/clfs/conglomeration/cloog-ppl/cloog-ppl-0.15.11.tar.gz
-------------------------------------------------------------------------------
./configure 
--prefix=/usr/local 
--disable-shared 
--enable-static 
--with-ppl=/usr/local 
--with-gmp=/usr/local 

modify Makefile add -lstdc++
LIBS =  -lpsapi -lws2_32 -lmswsock  -lgmp -lppl_c -lppl -lgmpxx -lstdc++
-------------------------------------------------------------------------------
http://ftp.gnu.org/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.bz2
-------------------------------------------------------------------------------
export CPP=/mingw/bin/cpp 
export LD_LIBRARY_PATH=/usr/local/lib 
export LIBS= 
export   CFLAGS=' -I/usr/local/include -I/usr/mingw/i686-w64-mingw32/include ' 
export CPPFLAGS=' -I/usr/local/include -I/usr/mingw/i686-w64-mingw32/include  ' 
export CXXFLAGS=' -I/usr/local/include -I/usr/mingw/i686-w64-mingw32/include  ' 
export  LDFLAGS=' -L/usr/local/lib  -L/usr/mingw/i686-w64-mingw32/lib  ' 

mkdir _build
cd _build

../gcc-5.4.0/configure 
--prefix=/mingw32 
--with-local-prefix=/mingw/local 
--build=i686-w64-mingw32 
--host=i686-w64-mingw32 
--target=i686-w64-mingw32 
--with-native-system-header-dir=/mingw/i686-w64-mingw32/include 
--libexecdir=/usr/local/lib 
--enable-bootstrap 
--with-arch=i686 
--with-tune=generic 
--enable-languages=c,lto,c++,objc,obj-c++,fortran 
--enable-shared 
--enable-static 
--disable-64bit 
--enable-threads=win32 
--enable-libatomic 
--enable-graphite 
--enable-fully-dynamic-string 
--enable-libstdcxx-time=yes 
--disable-libstdcxx-pch 
--disable-libstdcxx-debug 
--disable-isl-version-check 
--enable-lto 
--enable-libgomp 
--disable-multilib 
--enable-checking=release 
--disable-rpath 
--disable-win32-registry 
--disable-nls 
--disable-werror 
--disable-symvers 
--with-libiconv 
--with-system-zlib 
--with-gmp=/usr/local 
--with-mpfr=/usr/local 
--with-mpc=/usr/local 
--with-isl=/usr/local 
--with-gnu-as 
--with-gnu-ld 
--disable-sjlj-exceptions 
--with-dwarf2

make && make install
-------------------------------------------------------------------------------
结论:自己编译太麻烦了, 现在最好用 MSYS2 
MSYS2 支持 pacman 可以自动安装解决依赖关系库
下面链接中包含几乎所有的库
http://repo.msys2.org/mingw/i686/
有些遗憾的是有些库没有静态库, 需要静态库时还是自己编译.
-------------------------------------------------------------------------------
mingw32-gcc-5.4.0-win32-dwarf2-2016-08-21.7z
mingw32-gcc-5.4.0-win32-sjlj-2016-08-21.7z
原文地址:https://www.cnblogs.com/nlsoft/p/5782034.html