Skip to content

Commit a1c7510

Browse files
jgiannuzzimeiyang1123
authored andcommitted
Fix musl build (mattn#1164)
1 parent ad16eff commit a1c7510

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

sqlite3.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ package sqlite3
2222
#cgo CFLAGS: -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT
2323
#cgo CFLAGS: -Wno-deprecated-declarations
2424
#cgo darwin LDFLAGS: -framework Security
25-
#cgo linux,!android CFLAGS: -DHAVE_PREAD64=1 -DHAVE_PWRITE64=1
2625
#cgo openbsd CFLAGS: -I/usr/local/include
2726
#cgo openbsd LDFLAGS: -L/usr/local/lib
2827
#cgo amd64 CFLAGS: -maes -msse4.1
@@ -50,6 +49,18 @@ package sqlite3
5049
# define SQLITE_DETERMINISTIC 0
5150
#endif
5251
52+
#if defined(HAVE_PREAD64) && defined(HAVE_PWRITE64)
53+
# undef USE_PREAD
54+
# undef USE_PWRITE
55+
# define USE_PREAD64 1
56+
# define USE_PWRITE64 1
57+
#elif defined(HAVE_PREAD) && defined(HAVE_PWRITE)
58+
# undef USE_PREAD
59+
# undef USE_PWRITE
60+
# define USE_PREAD64 1
61+
# define USE_PWRITE64 1
62+
#endif
63+
5364
static int
5465
_sqlite3_open_v2(const char *filename, sqlite3 **ppDb, int flags, const char *zVfs) {
5566
#ifdef SQLITE_OPEN_URI

0 commit comments

Comments
 (0)