Skip to content

Commit 00b02e0

Browse files
leso-knmattn
authored andcommitted
Fix musl build (mattn#1164)
1 parent d9e2789 commit 00b02e0

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

sqlite3.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ package sqlite3
2121
#cgo CFLAGS: -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1
2222
#cgo CFLAGS: -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT
2323
#cgo CFLAGS: -Wno-deprecated-declarations
24-
#cgo linux,!android CFLAGS: -DHAVE_PREAD64=1 -DHAVE_PWRITE64=1
2524
#cgo openbsd CFLAGS: -I/usr/local/include
2625
#cgo openbsd LDFLAGS: -L/usr/local/lib
2726
#ifndef USE_LIBSQLITE3
@@ -48,6 +47,18 @@ package sqlite3
4847
# define SQLITE_DETERMINISTIC 0
4948
#endif
5049
50+
#if defined(HAVE_PREAD64) && defined(HAVE_PWRITE64)
51+
# undef USE_PREAD
52+
# undef USE_PWRITE
53+
# define USE_PREAD64 1
54+
# define USE_PWRITE64 1
55+
#elif defined(HAVE_PREAD) && defined(HAVE_PWRITE)
56+
# undef USE_PREAD
57+
# undef USE_PWRITE
58+
# define USE_PREAD64 1
59+
# define USE_PWRITE64 1
60+
#endif
61+
5162
static int
5263
_sqlite3_open_v2(const char *filename, sqlite3 **ppDb, int flags, const char *zVfs) {
5364
#ifdef SQLITE_OPEN_URI

0 commit comments

Comments
 (0)