Created
July 11, 2013 13:47
-
-
Save baoilleach/5975580 to your computer and use it in GitHub Desktop.
Compile zlib statically with mingw
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> set PATH=C:\MinGW\bin;%PATH% | |
C:\Tools\zlib\zlib-1.2.8> C:\MinGW\bin\mingw32-make.exe -fwin32/Makefile.gcc | |
gcc -O3 -Wall -c -o adler32.o adler32.c | |
gcc -O3 -Wall -c -o compress.o compress.c | |
gcc -O3 -Wall -c -o crc32.o crc32.c | |
gcc -O3 -Wall -c -o deflate.o deflate.c | |
gcc -O3 -Wall -c -o gzclose.o gzclose.c | |
gcc -O3 -Wall -c -o gzlib.o gzlib.c | |
gcc -O3 -Wall -c -o gzread.o gzread.c | |
gcc -O3 -Wall -c -o gzwrite.o gzwrite.c | |
gcc -O3 -Wall -c -o infback.o infback.c | |
gcc -O3 -Wall -c -o inffast.o inffast.c | |
gcc -O3 -Wall -c -o inflate.o inflate.c | |
gcc -O3 -Wall -c -o inftrees.o inftrees.c | |
gcc -O3 -Wall -c -o trees.o trees.c | |
gcc -O3 -Wall -c -o uncompr.o uncompr.c | |
gcc -O3 -Wall -c -o zutil.o zutil.c | |
ar rcs libz.a adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o | |
gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o | |
windres --define GCC_WINDRES -o zlibrc.o win32/zlib1.rc | |
gcc -shared -Wl,--out-implib,libz.dll.a \ | |
-o zlib1.dll win32/zlib.def adler32.o compress.o crc32.o deflate.o gzclose.o gzl | |
ib.o gzread.o gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr | |
.o zutil.o zlibrc.o | |
strip zlib1.dll | |
gcc -O3 -Wall -I. -c -o example.o test/example.c | |
gcc -o example.exe example.o libz.a | |
strip example.exe | |
gcc -O3 -Wall -I. -c -o minigzip.o test/minigzip.c | |
gcc -o minigzip.exe minigzip.o libz.a | |
strip minigzip.exe | |
gcc -o example_d.exe example.o libz.dll.a | |
strip example_d.exe | |
gcc -o minigzip_d.exe minigzip.o libz.dll.a | |
strip minigzip_d.exe | |
To compile statically against this using CMake, use: | |
-DZLIB_LIBRARY=C:\Tools\zlib\zlib-1.2.8\libz.a -DZLIB_INCLUDE_DIR=. |
thanks, two!
putting ./ after -f worked for me.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!