windows下使用mingw64编译libxml2,libxslt,libwebp,zilb,libpng,libjpeg,libiconv,freetype,openssl

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_43296326/article/details/88353942

环境准备
在windows下使用mingw64编译libxml2,libxslt,libwebp,zilb,libpng,libjpeg,libiconv,freetype,openssl

Msys2的安装,并整合到cmder中可以参考这篇文章:https://www.cnblogs.com/hongdada/p/7989068.html 很方便很好用。

编译环境为mingw64,用mingw64编译,编译命令mingw32-make ,为了方便找,编译时安装目录我都指定为/usr/local。有些库会相互依赖,比如编译libpng时需要有zlib,编译libxslt时需要有libxml2。本文给出的下载链接都是目前最新的版本。

libxml2编译: ftp://xmlsoft.org/libxml2/libxml2-sources-2.9.9.tar.gz

 ./configure --prefix=/usr/local/
 mingw32-make
 mingw32-make install

libxslt编译: ftp://xmlsoft.org/libxml2/libxslt-1.1.33.tar.gz

./configure --prefix=/usr/local/
mingw32-make
mingw32-make install

libwebp编译: http://downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz

./configure --prefix=/usr/local/
mingw32-make
mingw32-make install

zilb编译: https://sourceforge.net/projects/libpng/files/zlib/1.2.11/zlib-1.2.11.tar.gz

mkdir build && cd build/
cmake ../ -G 'MinGW Makefiles'  -DCMAKE_INSTALL_PREFIX=/usr/local
mingw32-make
mingw32-make install

libpng: https://sourceforge.net/projects/libpng/files/libpng16/1.6.36/libpng-1.6.36.tar.gz
#需要指定zlib的.a文件和头文件的位置。如果你的zlib位置和我不一样则指定自己的位置。

mkdir build && cd build/
cmake -DZLIB_LIBRARY:FILEPATH=/usr/local/lib/libzlibstatic.a -DZLIB_INCLUDE_DIR:PATH=/usr/local/include -DCMAKE_INSTALL_PREFIX=/usr/local -G 'MinGW Makefiles' ../ 
mingw32-make
mingw32-make install

libjpeg编译: http://www.ijg.org/files/jpegsr9c.zip
#如果不指定安装位置应该会自动创建man文件,我没试过。因为安装时需要有这个路径

./configure --prefix=/usr/local/
编辑 jconfig.h 文件,增加定义:     #define HAVE_PROTOTYPES 1
mingw32-make
如果这一步报错路径错误导致没有这个文件,那么创建以下两个文件夹,没有报错则直接install:
mkdir /usr/local/man/
mkdir /usr/local/man/man1
mingw32-make install

libiconv编译: https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz

./configure --host=x86_64-w64-mingw32 --disable-shared --prefix=/usr/local
mingw32-make
mingw32-make install

freetype编译: https://sourceforge.net/projects/freetype/files/freetype2/2.9.1/freetype-2.9.1.tar.gz

./configure --prefix=/usr/local/
make
make install

openssl编译: https://www.openssl.org/source/old/1.1.1/openssl-1.1.1.tar.gz

./config --prefix=/usr/local
mingw32-make
mingw32-make install

猜你喜欢

转载自blog.csdn.net/weixin_43296326/article/details/88353942