Subject: | Compilation patch for 5.8.0/cygwin-multi-64int |
I needed the attached patch on cygwin perl 5.8.0/cygwin-multi-64int
to compile SQLite correctly.
Ensure off_t to be defined correctly on cygwin, similar to MSVC.
/usr/include/cygwin/types.h:39: conflicting types for `off_t'
Compilation without this patch:
gcc -c -I/usr/lib/perl5/site_perl/5.8.0/cygwin-multi-64int/auto/DBI -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -DUSEIM
PORTLIB -O6 -DNDEBUG=1 -DSQLITE_PTR_SZ=4 -DVERSION=\"0.25\" -DXS_VERSION=\"0.25\" "-I/usr/lib/perl5/5.8.0/cygwin-mult
i-64int/CORE" os.c
In file included from /usr/include/sys/types.h:363,
from /usr/include/stdio.h:46,
from vdbe.h:22,
from sqliteInt.h:19,
from os.c:18:
/usr/include/cygwin/types.h:39: conflicting types for `off_t'
os.h:123: previous declaration of `off_t'
os.c:813: conflicting types for `sqliteOsSeek'
os.h:159: previous declaration of `sqliteOsSeek'
os.c: In function `sqliteOsSeek':
os.c:821: warning: right shift count >= width of type
os.c: At top level:
os.c:892: conflicting types for `sqliteOsTruncate'
os.h:161: previous declaration of `sqliteOsTruncate'
os.c: In function `sqliteOsTruncate':
os.c:899: warning: right shift count >= width of type
os.c: At top level:
os.c:921: conflicting types for `sqliteOsFileSize'
os.h:162: previous declaration of `sqliteOsFileSize'
os.c: In function `sqliteOsFileSize':
os.c:935: warning: left shift count >= width of type
make: *** [os.o] Error 1
And the contents of
/usr/include/cygwin/types.h:
#ifndef __off_t_defined
#define __off_t_defined
typedef long __off32_t;
typedef long long __off64_t;
#ifdef __CYGWIN_USE_BIG_TYPES__
typedef __off64_t off_t;
#else
typedef __off32_t off_t;
#endif
#endif /*__off_t_defined*/
--- DBD-SQLite-0.25/os.h.orig 2003-02-17 08:40:52.000000000 +0100
+++ DBD-SQLite-0.25/os.h 2003-07-25 14:40:09.000000000 +0200
@@ -109,6 +109,9 @@
#endif
#if OS_WIN
+# ifdef __CYGWIN__
+# define __CYGWIN_USE_BIG_TYPES__
+# endif
#include <windows.h>
#include <winbase.h>
typedef struct OsFile OsFile;
@@ -119,8 +122,10 @@
# if defined(_MSC_VER) || defined(__BORLANDC__)
typedef __int64 off_t;
# else
+# ifndef _CYGWIN_TYPES_H
typedef long long off_t;
# endif
+# endif
# define SQLITE_TEMPNAME_SIZE (MAX_PATH+50)
# define SQLITE_MIN_SLEEP_MS 1
#endif