MinGW64 how-to(内含编译openssl,libjpeg,libcurl等例子)
Index of contents
- Setting up the MinGW 64 environment
- Step 1) building libiconv
- Step 2) building libz
- Step 3) building libjpeg
- Step 4) building libpng
- Step 5) building libtiff
- Step 6) building libproj
- Step 7) building libgeotiff
- Step 8) building libgeos
- Step 9) building libexpat
- Step 10) building libspatialite
- Step 11) building spatialite-tools
- Step 12) building wxWidgets MSW
- Step 13) building libfreetype
- Step 14) building libfontconfig
- Step 15) building libpixman
- Step 16) building libcairo
- Step 17) building libgaiagraphics
- Step 18) building spatialite_gui
- Step 19) building OpenSSL
- Step 20) building libcurl
Setting up the MinGW 64 environment
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:
- I already had MinGW32+MSYS installed on the Windows 7 64 bit box I use to develop Win32 sw:
so I decided to install MinGW 64 as well on the same platform. - mixing up at random 32 bit and 64 bit binaries doesn't seem so good at all:
so I've purposely choosen an appropriate configuration, completely avoiding any undesirable confusion. - anyway, you are absolutely free to choose the configuration best fit for your specific requirements: simply read the appropriate documentation.
Once I decided the most appropriate disk layout, I duly started installing MinGW 64 on Windows 7 Pro 64 bit:
- first I've downloaded the most recent mingw-w64-bin_i686-mingw_yyyymmdd.zip for Win32
- then I've unzipped all this stuff into the C:\MinGW64 directory.
- and finally I've downloaded the most recent MinGW 64 own MSYS
- once I've installed it into the C:\msys64 directory (completing the postinstall procedure) I was immediately ready to work.
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) 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. 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. |
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 |
|
|
64 bit binaries | file iconv.exe PE32+ executable for MS Windows (console) Mono/.Net assembly file libiconv-2.dll |
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.
But when using MinGW 64 a catastrophical issue arises:
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 !
Be warned: building on MinGW 64 is more or less the same as building on MinGW 32: anyway here and there some further patch is absolutely required.
Please, carefully read and verbatim follow any given instruction.
Step 1) building libiconv
libiconv is the standard GNU library supporting locale charsets.
Required by: libspatialite, spatialite-tools
Building under Windows is not too much difficult.
- download libiconv-1.13.1.tar.gz
- uncompress this gzipped-file
- then untar the tarball
- and finally open an MSYS shell
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:
- download libiconv.la and libcharset.la
- then copy both files: cp libiconv.la libcharset.la /usr/local/lib
Step 2) building libz
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.
- download the latest sources: zlib125.zip
- uncompress this zip-file
- then open an MSYS shell
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:
- download libz.la
- and then copy this file: cp libz.la /usr/local/lib
Step 3) building libjpeg
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:
- libjpeg is the standard, plain library
- libjpeg-turbo is a new library, that fully takes profit from the most recent Intel/AMD CPUs
If you are planning to deploy your software on such platforms, then using libjpeg-turbo can ensure a 200% performance boost (and even more than this).
I strongly recommend using libjpeg-turbo: both libraries share the same identical API/ABI (they are absolutely inter-changeable), but libjpeg-turbo runs in an impressively faster mode.
Building the one or the other under Windows is absolutely a plain and easy task.
How-to-build libjpeg-turbo
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.
- download the latest sources: libjpeg-turbo-1.1.1.tar.gz
- uncompress this gzipped-file
- then untar the tarball
- and finally open an MSYS shell
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.
How-to-build libjpeg
- download the latest sources: jpegsr8b.zip
- uncompress this zip-file
- then open an MSYS shell
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.
Step 4) building libpng
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.
- download the latest sources: libpng-1.5.2.tar.gz
- uncompress this gzipped-file
- then untar the tarball
- and finally open an MSYS shell
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.
Step 5) building libtiff
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.
- download the latest sources: tiff-3.9.5.zip
- uncompress this zip-file
- then open an MSYS shell
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:
- search for a line starting with: dependency_libs=
- you'll find within the associated value a crazy path like:
/c/bb/vista64-mingw32/mingw-x86-x86_64/build/build/root/x86_64-w64-mingw32/lib/../lib/libstdc++.la
-L/c/bb/vista64-mingw32/mingw-x86-x86_64/build/build/gcc/obj/x86_64-w64-mingw32/libstdc++-v3/src
-L/c/bb/vista64-mingw32/mingw-x86-x86_64/build/build/gcc/obj/x86_64-w64-mingw32/libstdc++-v3/src/.libs
-L/c/bb/vista64-mingw32/mingw-x86-x86_64/build/build/root/x86_64-w64-mingw32/lib
-L/c/bb/vista64-mingw32/mingw-x86-x86_64/build/build/root/mingw/lib - simply replace all the above garbage with: C:/MinGW64/x86_64-w64-mingw32/lib/libstdc++.la
- save and exit
Step 6) building libproj
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.
- download the latest sources: proj-4.7.0.zip
- uncompress this zip-file
- then open an MSYS shell
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__) |
Step 7) building libgeotiff
libgeotiff is a library supporting the GeoTIFF raster format
Depends on: libtiff, libproj
Required by: libgaiagraphics
Building under Windows is an easy task.
- download the latest sources: libgeotiff130.zip
- uncompress this zip-file
- then open an MSYS shell
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' |
|
Step 8) building libgeos
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.
- download the latest sources: geos-3.3.0.tar.bz2
- uncompress this bzip2-file
- then untar the tarball
- and finally open an MSYS shell
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:
- search for a line starting with: dependency_libs=
- simply replace any crazy path with: C:/MinGW64/x86_64-w64-mingw32/lib/libstdc++.la
- save and exit
Step 9) building libexpat
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.
- download the latest sources: expat-2.0.1.tar.gz
- uncompress this gzipped-file
- then untar the tarball
- and finally open an MSYS shell
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.
Step 10) building libspatialite
libspatialite is the main core of SpatiaLite
Depends on: libiconv, libproj, libgeos
Required by: spatialite-tools, librasterlite
Building under Windows is an easy task.
- download the latest sources: libspatialite-amalgamation-3.0.0-beta.zip
- uncompress this zip-file
- then open an MSYS shell
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:
- search for a line starting with: dependency_libs=
- simply replace any crazy path with: C:/MinGW64/x86_64-w64-mingw32/lib/libstdc++.la
- save and exit
Step 11) building spatialite-tools
spatialite-tools the SpatiaLite command-line management tools
Depends on: libiconv, libproj, libgeos, libspatialite, libexpat
Building under Windows is an easy task.
- download the latest sources: spatialite-tools-3.0.0-beta.zip
- uncompress this zip-file
- then open an MSYS shell
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
Step 12) building wxWidgets MSW
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.
- download the latest sources: wxMSW-2.8.12.zip
- uncompress this zip-file
- then open an MSYS shell
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 |
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:
- search for a line starting with: ldlibs_base=
- and on the corresponding value then simply delete: -lwctl3d32
(this obsolete library doesn't exists any longer on Win64, and isn't actually required at all). - now search for any occurrenct of the string: --define __WIN32__ --define __WIN95__ --define __GNUWIN32__
- and replace the above value with: --define WX_CPU_AMD64
(this is required so to create 64 bit resource files) - save and exit
Step 13) building libfreetype
libfreetype is a standard library supporting TrueType fonts.
Depends on: nothing
Required by: libcairo, ...
Building under Windows is an easy task.
- download the latest sources: freetype-2.4.4.tar.gz
- uncompress this gzipped-file
- then untar the tarball
- and finally open an MSYS shell
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.
Step 14) building libfontconfig
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.
- download the latest sources: fontconfig-2.8.0.tar.gz
- uncompress this gzipped-file
- then untar the tarball
- and finally open an MSYS shell
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.
Step 15) building libpixman
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:
- download the latest sources: pixman-0.20.2.tar.gz
- uncompress this gzipped-file
- then untar the tarball
- and finally open an MSYS shell
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.
Step 16) building libcairo
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:
- download the latest sources: cairo-1.10.2.tar.gz
- uncompress this gzipped-file
- then untar the tarball
- and finally open an MSYS shell
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.
Step 17) building libgaiagraphics
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:
- download the latest sources: libgaiagraphics-0.4.zip
- uncompress this zip-file
- then open an MSYS shell
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.
Step 18) building spatialite_gui
spatialite_gui the SpatiaLite GUI user-friendly tool
Depends on: libspatialite, wxWidgets, libgaiagraphics
Building under Windows is an easy task.
- download the latest sources: spatialite_gui-1.5.0-beta.zip
- uncompress this zip-file
- then open an MSYS shell
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
Step 19) building OpenSSL
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.
- download the latest sources: openssl-1.0.0d.tar.gz
- Important notice: you cannot use tools such as 7z to untar the tarball: this will cause fatal errors during compilation (broken links).
You absolutely have to run all the following commands from the MSYS shell.
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.
Step 20) building libcurl
libcurl is a well known library supporting URLs (networking, web protocols)
Depends on: libz, OpenSSL
Required by: ?
Building under Windows is an easy task.
- download the latest sources: curl-7.21.7.zip
- uncompress this zip-file
- then open an MSYS shell
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等例子)的更多相关文章
- 在window平台下,自己DIY编译OpenSSL,Libcurl ,来支持HTTPS传输协议
1 缘起 原来就了解些libcurl,一直没有机会在项目实际使用libcurl. 恰好最近一个云存储的项目,服务器使用openstack 恰好我负责现在的一个云存储SDK c++版本的开发中. 与 ...
- msys2-x86_64 Mingw64 编译openssl
windows 刚开始编译时提示找不到gcc 添加环境变量export PATH=$PATH:/mingw64/bin$source /etc/profile 将openssl源码复制到C:\msys ...
- Ubuntu+NDK编译openssl(为了Android上使用libcurl且支持HTTPS协议)
为了Android上使用libcurl且支持HTTPS协议,需要依赖openssl,因此先来了解一下如何编译OpenSSL1.编译ARM下的共享库(默认的)我使用的是guardianproject的o ...
- 利用openssl管理证书及SSL编程第2部分:在Windows上编译 openssl
利用openssl管理证书及SSL编程第2部分:在Windows上编译 openssl 首先mingw的环境搭建,务必遵循下文: http://blog.csdn.net/ubuntu64fan/ar ...
- Windows7下使用mingw编译openssl
Windows7下使用mingw编译openssl 首先参考这篇文章安装mingw/minsys: http://blog.csdn.net/ubuntu64fan/article/details/8 ...
- MinGW下编译openssl, json-c
目的:在windows环境下,编译开源库openssl 环境:windows 10 ,Mingw及自带msys工具,openssl-1.0.2j 工具主要使用MinGW(含msys1.0), IDE选 ...
- Ubuntu+NDK编译openssl
为了Android上使用libcurl且支持HTTPS协议,需要依赖openssl,因此先来了解一下如何编译OpenSSL1.编译ARM下的共享库(默认的)我使用的是guardianproject的o ...
- [转] Windows下编译OpenSSL
简述 OpenSSL是一个开源的第三方库,它实现了SSL(Secure SocketLayer)和TLS(Transport Layer Security)协议,被广泛企业应用所采用.对于一般的开发人 ...
- net-snmp源码VS2013编译添加加密支持(OpenSSL)(在VS里配置编译OpenSSL)
net-snmp源码VS2013编译添加加密支持(OpenSSL) snmp v3 协议使用了基于用户的安全模型,具有认证和加密两个模块. 认证使用的算法是一般的消息摘要算法,例如MD5/SHA等.这 ...
随机推荐
- Android中使用achartengine生成图表
今天在做项目的时候用到了图表功能,记录下来 achartengine是google的一个开源项目,可以在https://code.google.com/p/achartengine/ 下载技术文档,j ...
- rac下一个/tmp/bootstrap权限问题
原创作品,离 "深蓝blog" 博客,欢迎转载,请务必注明转载如下源,否则追究其版权责任. 深蓝的blog:http://blog.csdn.net/huangyanlong/ar ...
- 经典卷积神经网络的学习(二)—— VGGNet
1. 简介 VGGNet 是牛津大学计算机视觉组(Visual Geometry Group)和 Google DeepMind 公司的研究员一起研发的深度卷积神经网络,其主要探索了卷积神经网络的深度 ...
- matlab 格式化文本文件的解析
比如这样一种格式化的文本文件,文件说明及下载地址:/pub/machine-learning-databases/statlog/german/ 的索引 fid = fopen('german.dat ...
- 【37.50%】【codeforces 732D】Exams
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- 使用readLine()方法遇到的坑
程序很简单,客户段从控制台读取用户输入,然后发送至服务器端,主要代码如下 服务端代码: 客户端代码: 结果运行的时候,当开启服务端和客户端后,在客户端的控制台 键盘输入 内容,服务端却没有显示内容 原 ...
- 正割函数(sec)
1. 定义 正割与余弦互为倒数,余割与正弦互为倒数.即: ⎧⎩⎨⎪⎪⎪⎪secθ=1cosθcscθ=1sinθ 也即在几何上,设 △ABC,∠C=90°,AC=b,BC=a,AB=c, 正割函数:s ...
- .NET 即时通信,WebSocket
.NET 即时通信,WebSocket 即时通信常用手段 1.第三方平台 谷歌.腾讯 环信等多如牛毛,其中谷歌即时通信是免费的,但免费就是免费的并不好用.其他的一些第三方一般收费的,使用要则限流(1s ...
- OpenCV实现朴素贝叶斯分类器诊断病情
贝叶斯定理由英国数学家托马斯.贝叶斯(Thomas Baves)在1763提出,因此得名贝叶斯定理.贝叶斯定理也称贝叶斯推理,是关于随机事件的条件概率的一则定理. 对于两个事件A和B,事件A发生则B也 ...
- WPF实现抽屉效果
原文:WPF实现抽屉效果 界面代码(xaml): <Window x:Class="TransAnimation.MainWindow" xmlns="http:/ ...