标签:mod mis friend config attr gem tar.gz ane zlib
MinGW 64 is an open source C/C++ compiler based on the popular gcc; basically, it is intended to generate executables for Windows 64 bit.
We‘ll suppose that you already have a basic familiarity with standard MinGW 32 + MSYS: MinGW 64 is more or less the same, but acting (more or less) as a cross-compiler.
This practically means that you can build 64 bit executables on any Win32 platform: but obviously any 64 bit program requires some Windows 64 platform to be executed.
The standard build tool-chain [originally developed for Linux] natively supports cross-compilers: and this works under Windows as well, e.g. using MinGW 64.
As you surely already know, the standard build procedure is the following one:
./configure
make
make install
Using the MinGW 64 cross-compiler is the same of using standard MinGW32: but in this case you are required to always specify the following ./configure argument:
./configure --host=x86_64-w64-mingw32
make
make install
The above --host directive is enough for ./configure to intend that a cross-compilation is required: and that the intended target is Windows 64 bit.
There are many different ways to deploy MinGW 64 (this including cross-compiling on Linux or Cygwin).
After some careful preliminary testing, I choosed the following one because it appairs the most straightforward:
Once I decided the most appropriate disk layout, I duly started installing MinGW 64 on Windows 7 Pro 64 bit:
PostInstallation tasksStep #1: carefully check the C:\msys64\etx\fstab file; it must contain the following row: (this will automatically mount C:\MinGW64 as /mingw)C:/MinGW64 /mingw Step #2: a dangerous issue exists: the MinGW 64 own MSYS is someway broken (as I painfully discoverd by trial and error ...): the C:\msys64\bin\find.exe executable is badly missing. Unhappily enough, Windows has its own FIND.EXE (and it‘s a completely different thing from the Linux find): this may cause several builds to misteriously fail ... but now you are well aware of this dangerous pitfall. You simply have to manually pick find.exe from the standard MinGW 32 / MSYS installation, then copying this executable file into C:\msys64\bin. Step #3: the cross-compiler tool-chain seems to be a little bit confused about strip real name: this simple trick seems to definitively resolve any related issue. cp /mingw/bin/x86_64-w64-mingw32-strip.exe /mingw/bin/strip.exe |
Preparing to use PKG-CONFIG:You simply have to follow the same identical procedure already explained for standard MinGW 32 + MSYS |
Learming to identify 32 bit and 64 bit exacutables |
|
32 bit binaries | file iconv.exe PE32 executable for MS Windows (console) Intel 80386 32-bit file libiconv-2.dll PE32 executable for MS Windows (DLL) (console) Intel 80386 32-bit |
64 bit binaries | file iconv.exe PE32+ executable for MS Windows (console) Mono/.Net assembly file libiconv-2.dll PE32+ executable for MS Windows (DLL) (console) Mono/.Net assembly |
Setting up Windows own (SYSTEM) librariesSome apps (and libraries) require to be actually linked against MS Windows system libraries. And this is a really puzzling task using MinGW 64.Very shortly explained: the standard GCC tool-chain has the ability to link both .DLL dynamic libraries and .a static libraries. When Windows own system libraries are required, this isn‘t at all an issue for MinGW 32:
How to circumvent this dangerous pitfallOnce we have identified the reasons causing the above link failure, caring any nursing isn‘t too much difficult.
|
All right: we are now ready to start creating our Windows 64 bit software. Let‘s go !
libiconv is the standard GNU library supporting locale charsets.
Required by: libspatialite, spatialite-tools
Building under Windows is not too much difficult.
cd libiconv-1.13.1
./configure --host=x86_64-w64-mingw32
make
make install-strip
Anyway, this will simply build and install the DLL: a further step is required in order to get the static library as well.
make distclean
./configure --host=x86_64-w64-mingw32 --disable-shared
make
make install-strip
Now you‘ve built and installed both the static library and the DLL.
However the above process has installed badly misconfigured libcharset.la and libiconv.la files
(which are required to build other libraries in the following steps).
So in order to get a properly configured libiconv you have to accomplish a further operation:
libz is a popular library implementing Deflate, i.e. the compression algorithm used by gzip and Zip.
Depends on: nothing
Required by: libpng, libtiff, ...
Building under Windows is quite easy, but requires to pay some attenction.
A very simple patch is required: you must first edit the zlib-1.2.5/win32/Makefile.gcc file:
38c38 |
< PREFIX = |
--- |
> PREFIX = x86_64-w64-mingw32- |
After applying the above patch you are now to build zlib:
cd zlib-1.2.5
make -f win32/Makefile.gcc
Now you simply have to manually copy the following files:
cp zlib1.dll /usr/local/bin
cp zconf.h zlib.h /usr/local/include
cp libz.a /usr/local/lib
cp libzdll.a /usr/local/lib/libz.dll.a
All this will build and install both the static library and the DLL as well.
Anyway this process will not generate the libz.la file (which is required to build libtiff in one of the following steps.
So in order to get a fully installed libz you have to accomplish a further operation:
libjpeg is a popular library supporting the JPEG image compression.
Depends on: nothing
Required by: libtiff, libgaiagraphics
Important notice: you can now choose between two alternative implementations:
Building the one or the other under Windows is absolutely a plain and easy task.
Please note: the NASM assembler is absolutely required: if you don‘t have it already installed on your system, you can download and install now.
cd libjpeg-turbo-1.1.1
./configure --host=x86_64-w64-mingw32 --prefix=/usr/local
make
make install-strip
This will build and install both the static library and the DLL as well.
cd jpeg-8b
./configure --host=x86_64-w64-mingw32
make
make install-strip
This will build and install both the static library and the DLL as well.
libpng is a popular library supporting the PNG image compression.
Depends on: libz
Required by: libgaiagraphics
Building under Windows is absolutely a plain and easy task.
cd libpng-1.5.2
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure --host=x86_64-w64-mingw32
make
make install-strip
Important notice: you have to properly set the shell environment in order to retrieve the already installed libz; this is the duty of the two above export directives.
This will build and install both the static library and the DLL as well.
Important notice #2: in order to get ./configure support you must absolutely download the .tar.gz, because the .zip doesn‘t supports it.
libtiff is a popular library supporting the TIFF image format.
Depends on: libz, libjpeg
Required by: libgaiagraphics
Building under Windows is absolutely a plain and easy task.
cd tiff-3.9.5
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure --host=x86_64-w64-mingw32
make
make install-strip
Important notice: you have to properly set the shell environment in order to retrieve the already installed libz; this is the duty of the two above export directives.
This will build and install both the static library and the DLL as well.
Important notice: MinGW 64 seems to generate absolutely crazy .la files.
So you have to manually apply the following patch to avoid any possible further issue.
You are now required to manually edit the /usr/local/lib/libtiffxx.la file as follows:
libproj is a library supporting coordinate‘s transformation between different Reference Systems [PROJ.4]
Depends on: nothing
Required by: libgeotiff, libspatialite, spatialite-tools
Building under Windows is an easy task.
cd proj-4.7.0
./configure --host=x86_64-w64-mingw32 --without-mutex
make
make install-strip
Important notice: may well be you‘ll get the following fatal errors:
pj_mutex.c:167: error: redefinition of ‘pj_acquire_lock‘ |
pj_mutex.c:65: error: previous definition of ‘pj_acquire_lock‘ was here |
pj_mutex.c:181: error: redefinition of ‘pj_release_lock‘ |
pj_mutex.c:75: error: previous definition of ‘pj_release_lock‘ was here |
pj_mutex.c:192: error: redefinition of ‘pj_cleanup_lock‘ |
pj_mutex.c:82: error: previous definition of ‘pj_cleanup_lock‘ was here |
pj_mutex.c:206: error: redefinition of ‘pj_init_lock‘ |
pj_mutex.c:91: error: previous definition of ‘pj_init_lock‘ was here |
in such an evenience you have to edit the -/src/pj_mutex.c source as follows:
33c33 |
< #ifndef _WIN32 |
--- |
> #if defined (_WIN32) && !defined(__MINGW32__) |
40c40 |
< #ifndef _WIN32 |
--- |
> #if defined (_WIN32) && !defined(__MINGW32__) |
libgeotiff is a library supporting the GeoTIFF raster format
Depends on: libtiff, libproj
Required by: libgaiagraphics
Building under Windows is an easy task.
cd libgeotiff-1.3.0
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure --host=x86_64-w64-mingw32 --enable-incode-epsg
make
make install-strip
Important notice: it doesn‘t seem possible to build as a DLL using MinGW + MSYS. AFAIK, there is no way to do such a thing.
So you have to manually apply the following patch to circumvent this issue. Edit the /usr/local/lib/libgeotiff.la file as follows:
10c10 |
< library_names=‘‘ |
--- |
> library_names=‘libgeotiff.a‘ |
libgeos is a library representing a C++ porting of JTS [Java Topology Suite].
Depends on: nothing
Required by: libspatialite, spatialite-tools
This library really is an huge and complex piece of software; building on Windows is an incredibly time consuming task.
cd geos-3.3.0
./configure --host=x86_64-w64-mingw32
Important notice: before attempting to start compiling you are required to manually apply the following patch:
(not at all elegant, but fully effective); so edit the geos-3.3.0/include/geos/platform.h header:
near line 62: ------------ |
< #ifdef HAVE_INT64_T_64 < typedef int64_t int64; < #else < # ifdef HAVE_LONG_LONG_INT_64 < typedef long long int int64; < # else < typedef long int int64; < # ifndef HAVE_LONG_INT_64 < # define INT64_IS_REALLY32 1 < # warning "Could not find 64bit integer definition!" < # endif < # endif < #endif |
--- |
> /* > #ifdef HAVE_INT64_T_64 > typedef int64_t int64; > #else > # ifdef HAVE_LONG_LONG_INT_64 > typedef long long int int64; > # else > typedef long int int64; > # ifndef HAVE_LONG_INT_64 > # define INT64_IS_REALLY32 1 > # warning "Could not find 64bit integer definition!" > # endif > # endif > #endif > */ > typedef long long int int64; |
and now you are relly ready to start building GEOS:
make
make install-strip
This will build and install both the static library and the DLL as well.
Important notice: we have already seen this about libtiff: MinGW 64 seems to generate absolutely crazy .la files.
So you have to manually apply the following patch to avoid any possible further issue.
You are now required to manually edit both /usr/local/lib/libgeos.la and /usr/local/lib/libgeos_c.la files as follows:
libexpat is a well known standard library supporting XML parsing.
Depends on: nothing
Required by: libfontconfig, spatialite-tools, ...
Building under Windows really is a piece-of-cake.
cd expat-2.0.1
./configure --host=x86_64-w64-mingw32
Important notice: before attempting to start compiling you are required to manually apply the following patch:
(not at all elegant, but fully effective); so edit the C:\MinGW64\x86_64-w64-mingw32\include\process.h header:
165c165: ------------ |
< int __cdecl execv(const char *_Filename,char *const _ArgList[]) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
--- |
> int __cdecl execv(const char *_Filename,const char * _ArgList[]) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
and now you are really ready to start building expat (you can recover back again the above change once you‘ve terminated):
make
make install
This will build and install both the static library and the DLL as well.
libspatialite is the main core of SpatiaLite
Depends on: libiconv, libproj, libgeos
Required by: spatialite-tools, librasterlite
Building under Windows is an easy task.
cd libspatialite-amalgamation-3.0.0-beta
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure --host=x86_64-w64-mingw32 --target=mingw32
make
make install-strip
This will build and install both the static library and the DLL as well.
Important notice: we have already seen this about libtiff: MinGW 64 seems to generate absolutely crazy .la files.
So you have to manually apply the following patch to avoid any possible further issue.
You are now required to manually edit both /usr/local/lib/libspatialite.la files as follows:
spatialite-tools the SpatiaLite command-line management tools
Depends on: libiconv, libproj, libgeos, libspatialite, libexpat
Building under Windows is an easy task.
First of all, you must check if you‘ve already installed pkg-config.exe
If not, please read the above instructions
And now you must set the PKG_CONFIG_PATH as appropriate:
export "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig"
After this you are now ready to build as usual:
cd spatialite-tools-3.0.0-beta
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure --host=x86_64-w64-mingw32 --target=mingw32
make
make install-strip
Please note: following the above method you‘ll get dynamically linked tools [i.e. depending on DLLs].
If you whish instead to build statically linked tools [i.e. self contained, not depending on DLLs], you must first
manually edit the Makefile-static-MinGW file as follows:
< CC = g++ |
--- |
> CC = x86_64-w64-mingw32-g++‘ |
after this you are now ready to build your statically linked tools:
mkdir static_bin
make -f Makefile-static-MinGW
cp static_bin/* /usr/local/bin
wxWidgets is a popular widgets library, supporting GUI in a cross-platform fashion; MSW is the specific porting supporting Windows.
Depends on: nothing
Required by: spatialite-gui, spatialite-gis
This library really is an huge and complex piece of software; building on Windows is an incredibly time consuming task, but is quite plain and easy.
export "CXXFLAGS=-fpermissive" [this directive is absolutely required to skip some blocking errors]
cd wxMSW-2.8.12
mkdir msw_build
cd msw_build
../configure --host=x86_64-w64-mingw32 --disable-shared --disable-debug \
--disable-threads --enable-monolithic --enable-unicode \
--without-libjpeg --without-libpng --without-zlib\
--without-libtiff --without-expat --without-regex
Please note: the wxMSW ./configure is highly configurable: you must apply exactly the above settings.
Anyway, when ./configure stops, it‘s a good practice to check if the final report looks exactly like this:
Configured wxWidgets 2.8.12 for `x86_64-w64-mingw32‘ Which GUI toolkit should wxWidgets use? msw Should wxWidgets be compiled into single library? yes Should wxWidgets be compiled in debug mode? no Should wxWidgets be linked as a shared library? no Should wxWidgets be compiled in Unicode mode? yes What level of wxWidgets compatibility should be enabled? wxWidgets 2.4 no wxWidgets 2.6 yes Which libraries should wxWidgets use? jpeg no png no regex no tiff no zlib no odbc no expat no libmspack no sdl no |
now, when ./configure stops, you have to continue as usual:
make
make install-strip
Important notice: wxWidgets is now configured for any further usage: but unhappily it assumes being on Win32, and this is obviously wrong.
So you must manually adjust the wx-config script (/usr/local/bin/wx-widgets) as follows:
libfreetype is a standard library supporting TrueType fonts.
Depends on: nothing
Required by: libcairo, ...
Building under Windows is an easy task.
cd freetype-2.4.4
./configure --host=x86_64-w64-mingw32
make
make install
This will build and install both the static library and the DLL as well.
libfontconfig is a standard library supporting font customization and configuration.
Depends on: libexpat, libfreetype, libiconv
Required by: libcairo, ...
Building under Windows is an easy task.
cd fontconfig-2.8.0
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure --host=x86_64-w64-mingw32 --disable-docs
make
make install-strip
This will build and install both the static library and the DLL as well.
libpixman is the standard library implementing pixel manipulation for Cairo.
Depends on: nothing
Required by: libcairo, ...
Building under Windows is an easy task.
First of all, you must check if you‘ve already installed pkg-config.exe
If not, please read the above instructions
And now you must set the PKG_CONFIG_PATH as appropriate:
export "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig"
All right, your system configuration is ready to build fontconfig, so you can now:
cd pixman-0.20.2
./configure --host=x86_64-w64-mingw32
make
make install-strip
This will build and install both the static library and the DLL as well.
libcairo is a very popular graphics library.
Depends on: libpixman, libfreetype, libfontconfig, libpng
Required by: libgaiagraphics, ...
Building under Windows is a little bit harder than usual.
First of all, you must check if you‘ve already installed pkg-config.exe
If not, please read the above instructions
And now you must set the PKG_CONFIG_PATH as appropriate:
export "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig"
All right, your system configuration is ready to build libcairo, so you can now:
cd cairo-1.10.2
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure --host=x86_64-w64-mingw32 --disable-pthread
make
make install-strip
Important notice: you‘ll probably get a fatal error at some time during the compilation:
to resolve this issue you should manually edit the cairo-1.10.2/src/cairo.c source:
near line 149: ------------ |
< }; < #include <assert.h> < < /** < * _cairo_error: |
--- |
> }; > #include <assert.h> > > #ifdef __MINGW32__ > #define ffs __builtin_ffs > #endif > > /** > * _cairo_error: |
This will build and install both the static library and the DLL as well.
libgaiagraphics is a common utility library supporting graphics rendendering
Depends on: libjpeg, libpng, libtiff, libgeotiff, libcairo
Required by: spatialite-gui [next-to-come releases of librasterlite and spatialite-gis]
Building under Windows is an easy task.
First of all, you must check if you‘ve already installed pkg-config.exe
If not, please read the above instructions
And now you must set the PKG_CONFIG_PATH as appropriate:
export "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig"
All right, your system configuration is ready to build libgaiagraphics, so you can now:
cd libgaiagraphics-0.4
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure --host=x86_64-w64-mingw32 --target=mingw32
make
make install-strip
This will build and install both the static library and the DLL as well.
spatialite_gui the SpatiaLite GUI user-friendly tool
Depends on: libspatialite, wxWidgets, libgaiagraphics
Building under Windows is an easy task.
First of all, you must check if you‘ve already installed pkg-config.exe
If not, please read the above instructions
And now you must set the PKG_CONFIG_PATH as appropriate:
export "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig"
After this you are now ready to build as usual:
cd spatialite_gui-1.5.0-beta
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure --host=x86_64-w64-mingw32
make
make install-strip
Please note: following the above method you‘ll get a dynamically linked GUI tool [i.e. depending on DLLs].
If you whish instead to build a statically linked GUI tool [i.e. self contained, not depending on DLLs], now type:
mkdir static_bin
make -f Makefile-static-MinGW
cp static_bin/* /usr/local/bin
OpenSSL is a well known standard library supporting SSL, i.e. the encrypted HTTPS web protocol.
Depends on: nothing
Required by: libcurl
Building under Windows is a little bit difficult, and requires to pay close attention.
The configure script isn‘t at all a standard one: please read carefully the following instructions.
tar zxvf openssl-1.0.0d.tar.gz
cd openssl-1.0.0d
./Configure mingw64 --prefix=/usr/local shared no-asm
Several manual adjustments are now required; you must first edit openssl-1.0.0d/Makefile:
62c62 |
< CC= gcc |
--- |
> CC= x86_64-w64-mingw32-gcc |
62,63c62,63 |
< AR= ar $(ARFLAGS) r < RANLIB= /c/MinGW/bin/ranlib.exe < NM= nm |
--- |
> AR= x86_64-w64-mingw32-ar $(ARFLAGS) r > RANLIB= x86_64-w64-mingw32-ranlib.exe > x86_64-w64-mingw32-nm |
75c75 |
< MAKEDEPPROG= gcc |
--- |
> MAKEDEPPROG= x86_64-w64-mingw32-gcc |
After applying the above patches you are now to build OpenSSL:
export "CROSS_COMPILE=x86_64-w64-mingw32-
make
make install
This will build and install both the static libraries and the DLLs as well.
libcurl is a well known library supporting URLs (networking, web protocols)
Depends on: libz, OpenSSL
Required by: ?
Building under Windows is an easy task.
First of all, you must check if you‘ve already installed pkg-config.exe
If not, please read the above instructions
And now you must set the PKG_CONFIG_PATH as appropriate:
export "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig"
After this you are now ready to build as usual:
cd curl-7.21.7
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure --host=x86_64-w64-mingw32
make
make install-strip
Important notice: you‘ll probably get a fatal error at some time during the compilation:
to resolve this issue you should manually edit the curl-7.21.7/src/main.c source:
near line 465: ------------ |
< static int ftruncate64(int fd, curl_off_t where) < { < if(_lseeki64(fd, where, SEEK_SET) < 0) < return -1; < < if(!SetEndOfFile((HANDLE)_get_osfhandle(fd))) < return -1; < < return 0; < } < #define ftruncate(fd,where) ftruncate64(fd,where) |
--- |
> /* > static int ftruncate64(int fd, curl_off_t where) > { > if(_lseeki64(fd, where, SEEK_SET) < 0) > return -1; > > if(!SetEndOfFile((HANDLE)_get_osfhandle(fd))) > return -1; > > return 0; > } > #define ftruncate(fd,where) ftruncate64(fd,where) > */ |
This will build and install both the static library and the DLL as well.
https://www.gaia-gis.it/spatialite-3.0.0-BETA/mingw64_how_to.html#open-ssl
MinGW64 how-to(内含编译openssl,libjpeg,libcurl等例子)
标签:mod mis friend config attr gem tar.gz ane zlib
原文地址:http://www.cnblogs.com/findumars/p/6372246.html