Closed tssajo closed 9 years ago
Hi, I don't support Windows builds in general. However, you may be able to get around this by editing src/win32cfg.h. Try changing this line
/* #undef HAVE_INTTYPES_H */
to
#define HAVE_INTTYPES_H 1
and do something similar to the HAVE_STDINT_H line.
@kohler I managed to compile gifsicle under Windows 7 with MS Visual Studio 2010. I can submit a patch, in case you want to include Windows compilation support. I had to modify a few lines in about 4-6 files.
I'm happy to look at a patch!
On Mon, Aug 10, 2015 at 11:13 AM, Zoltan notifications@github.com wrote:
@kohler https://github.com/kohler I managed to compile gifsicle under Windows 7 with MS Visual Studio 2010. I can submit a patch, in case you want to include Windows compilation support. I had to modify a few lines in about 4-6 files.
— Reply to this email directly or view it on GitHub https://github.com/kohler/gifsicle/issues/41#issuecomment-129487293.
@kohler Sorry about the delay! I got busy with something else and then I forgot about this... :(
Here is how I patched gifsicle to compile on Windows:
diff -urN d:include/lcdf/inttypes.h ./include/lcdf/inttypes.h
--- d:include/lcdf/inttypes.h 2015-07-07 19:58:53.000000000 +0200
+++ ./include/lcdf/inttypes.h 2015-07-10 12:44:16.912077500 +0200
@@ -22,9 +22,9 @@
#ifndef HAVE_UINTPTR_T
# if SIZEOF_VOID_P == SIZEOF_UNSIGNED_LONG
-typedef unsigned long uintptr_t;
+/*typedef unsigned long uintptr_t;*/
# elif SIZEOF_VOID_P == SIZEOF_UNSIGNED_INT
-typedef unsigned int uintptr_t;
+/*typedef unsigned int uintptr_t;*/
# endif
#endif
diff -urN d:src/clp.c ./src/clp.c
--- d:src/clp.c 2015-07-07 19:58:53.000000000 +0200
+++ ./src/clp.c 2015-07-10 12:40:17.064359000 +0200
@@ -41,7 +41,7 @@
# include <inttypes.h>
#endif
#if !defined(HAVE_UINTPTR_T) && defined(HAVE_CONFIG_H)
-typedef unsigned long uintptr_t;
+/*typedef unsigned long uintptr_t;*/
#endif
#ifdef __cplusplus
diff -urN d:src/gifsicle.c ./src/gifsicle.c
--- d:src/gifsicle.c 2015-07-07 19:58:53.000000000 +0200
+++ ./src/gifsicle.c 2015-07-10 12:46:27.902569800 +0200
@@ -1336,7 +1336,7 @@
you've used the wrong Makefile. You should've used Makefile.w32 for
32-bit Windows and Makefile.w64 for 64-bit Windows. */
static_assert(sizeof(unsigned int) == SIZEOF_UNSIGNED_INT, "unsigned int has the wrong size.");
- static_assert(sizeof(unsigned long) == SIZEOF_UNSIGNED_LONG, "unsigned long has the wrong size.");
+/* static_assert(sizeof(unsigned long) == SIZEOF_UNSIGNED_LONG, "unsigned long has the wrong size.");*/
static_assert(sizeof(void*) == SIZEOF_VOID_P, "void* has the wrong size.");
clp = Clp_NewParser(argc, (const char * const *)argv, sizeof(options) / sizeof(options[0]), options);
diff -urN d:src/Makefile.w32 ./src/Makefile.w32
--- d:src/Makefile.w32 2015-07-07 19:58:53.000000000 +0200
+++ ./src/Makefile.w32 2015-07-10 12:42:48.071996200 +0200
@@ -24,7 +24,8 @@
# probably need to change it if you're using a different compiler. You can
# define it to the empty string, in which case Gifsicle will compile fine,
# but you won't be able to use wildcards in file name arguments.
-SETARGV_OBJ = $(MSDevDir)\lib\setargv.obj
+#SETARGV_OBJ = $(MSDevDir)\lib\setargv.obj
+SETARGV_OBJ = "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64\setargv.obj"
CC = cl
CFLAGS = -I.. -I..\include -DHAVE_CONFIG_H -D_CONSOLE /W3 /O2
As you can see, I mostly just commented out some lines. I know, these changes can probably be made much more elegantly! But I didn't have the time to figure out how, I needed it compiled fast. :)
After the above modifications I could compile gifsicle on my Windows 7 SP1 x64 PC with MS Visual Studio 2010 SP1.
I wrote a batch file to do the actual building of the program, here is how that looks:
compile-gifsicle.bat :
C:
CD "\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64"
CALL "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\vcvars64.bat"
CD \sourcecodes\gifsicle\src
nmake -f Makefile.w32
I hope this is helpful to some people who want to compile gifsicle on Windows.
Thanks for the update.
Hi,
I have MS Visual Studio 10.0 SP1 installed on my Windows 7 SP1 PC. Visual Studio is working fine, I can compile other C programs with it successfully (e.g.
mozjpeg
,pngwolf-zopfli
, etc.)When I try to compile
gifsicle
with the following command:nmake -f Makefile.w32
I get this error:
There seems to be a re-declaration of
uintptr_t
...Can you help and tell me how to fix it?
Thanks!