mirror of
https://github.com/benbjohnson/litestream.git
synced 2026-01-25 05:06:30 +00:00
fix(vfs): resolve make vfs build failures (#874)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
32
.github/workflows/commit.yml
vendored
32
.github/workflows/commit.yml
vendored
@@ -27,6 +27,38 @@ jobs:
|
||||
|
||||
- uses: pre-commit/action@v3.0.0
|
||||
|
||||
vfs-build-test:
|
||||
name: VFS Build Test (macOS)
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: "go.mod"
|
||||
|
||||
- name: Build VFS shared library
|
||||
run: make vfs
|
||||
|
||||
- name: Verify shared library created
|
||||
run: file dist/litestream-vfs.so
|
||||
|
||||
vfs-build-test-linux:
|
||||
name: VFS Build Test (Linux)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: "go.mod"
|
||||
|
||||
- name: Build VFS Linux AMD64
|
||||
run: make vfs-linux-amd64
|
||||
|
||||
- name: Verify shared library created
|
||||
run: file dist/litestream-vfs-linux-amd64.so
|
||||
|
||||
build-windows:
|
||||
name: Build Windows
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
10
Makefile
10
Makefile
@@ -16,7 +16,7 @@ vfs:
|
||||
mkdir -p dist
|
||||
go build -tags vfs,SQLITE3VFS_LOADABLE_EXT -o dist/litestream-vfs.a -buildmode=c-archive ./cmd/litestream-vfs
|
||||
mv dist/litestream-vfs.h src/litestream-vfs.h
|
||||
gcc -framework CoreFoundation -framework Security -lresolv -g -fPIC -shared -o dist/litestream-vfs.so src/litestream-vfs.c dist/litestream-vfs.a
|
||||
gcc -DSQLITE3VFS_LOADABLE_EXT -framework CoreFoundation -framework Security -lresolv -g -fPIC -shared -o dist/litestream-vfs.so src/litestream-vfs.c dist/litestream-vfs.a
|
||||
|
||||
.PHONY: vfs-linux-amd64
|
||||
vfs-linux-amd64:
|
||||
@@ -24,7 +24,7 @@ vfs-linux-amd64:
|
||||
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 \
|
||||
go build -tags $(VFS_BUILD_TAGS) -o dist/litestream-vfs-linux-amd64.a -buildmode=c-archive $(VFS_SRC)
|
||||
cp dist/litestream-vfs-linux-amd64.h src/litestream-vfs.h
|
||||
gcc -g -fPIC -shared -o dist/litestream-vfs-linux-amd64.so \
|
||||
gcc -DSQLITE3VFS_LOADABLE_EXT -g -fPIC -shared -o dist/litestream-vfs-linux-amd64.so \
|
||||
$(VFS_C_SRC) dist/litestream-vfs-linux-amd64.a $(LINUX_LDFLAGS)
|
||||
|
||||
.PHONY: vfs-linux-arm64
|
||||
@@ -33,7 +33,7 @@ vfs-linux-arm64:
|
||||
CGO_ENABLED=1 GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc \
|
||||
go build -tags $(VFS_BUILD_TAGS) -o dist/litestream-vfs-linux-arm64.a -buildmode=c-archive $(VFS_SRC)
|
||||
cp dist/litestream-vfs-linux-arm64.h src/litestream-vfs.h
|
||||
aarch64-linux-gnu-gcc -g -fPIC -shared -o dist/litestream-vfs-linux-arm64.so \
|
||||
aarch64-linux-gnu-gcc -DSQLITE3VFS_LOADABLE_EXT -g -fPIC -shared -o dist/litestream-vfs-linux-arm64.so \
|
||||
$(VFS_C_SRC) dist/litestream-vfs-linux-arm64.a $(LINUX_LDFLAGS)
|
||||
|
||||
.PHONY: vfs-darwin-amd64
|
||||
@@ -42,7 +42,7 @@ vfs-darwin-amd64:
|
||||
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 \
|
||||
go build -tags $(VFS_BUILD_TAGS) -o dist/litestream-vfs-darwin-amd64.a -buildmode=c-archive $(VFS_SRC)
|
||||
cp dist/litestream-vfs-darwin-amd64.h src/litestream-vfs.h
|
||||
clang -arch x86_64 -g -fPIC -shared -o dist/litestream-vfs-darwin-amd64.dylib \
|
||||
clang -DSQLITE3VFS_LOADABLE_EXT -arch x86_64 -g -fPIC -shared -o dist/litestream-vfs-darwin-amd64.dylib \
|
||||
$(VFS_C_SRC) dist/litestream-vfs-darwin-amd64.a $(DARWIN_LDFLAGS)
|
||||
|
||||
.PHONY: vfs-darwin-arm64
|
||||
@@ -51,7 +51,7 @@ vfs-darwin-arm64:
|
||||
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 \
|
||||
go build -tags $(VFS_BUILD_TAGS) -o dist/litestream-vfs-darwin-arm64.a -buildmode=c-archive $(VFS_SRC)
|
||||
cp dist/litestream-vfs-darwin-arm64.h src/litestream-vfs.h
|
||||
clang -arch arm64 -g -fPIC -shared -o dist/litestream-vfs-darwin-arm64.dylib \
|
||||
clang -DSQLITE3VFS_LOADABLE_EXT -arch arm64 -g -fPIC -shared -o dist/litestream-vfs-darwin-arm64.dylib \
|
||||
$(VFS_C_SRC) dist/litestream-vfs-darwin-arm64.a $(DARWIN_LDFLAGS)
|
||||
|
||||
vfs-test:
|
||||
|
||||
@@ -6,9 +6,8 @@ package main
|
||||
// import C is necessary export to the c-archive .a file
|
||||
|
||||
/*
|
||||
#include <stdint.h>
|
||||
typedef int64_t sqlite3_int64;
|
||||
typedef uint64_t sqlite3_uint64;
|
||||
typedef long long int sqlite3_int64;
|
||||
typedef unsigned long long int sqlite3_uint64;
|
||||
*/
|
||||
import "C"
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ extern const sqlite3_api_routines *sqlite3_api;
|
||||
/* Go function declarations */
|
||||
extern char* GoLitestreamRegisterConnection(void* db, sqlite3_uint64 file_id);
|
||||
extern char* GoLitestreamUnregisterConnection(void* db);
|
||||
extern char* GoLitestreamSetTime(void* db, const char* timestamp);
|
||||
extern char* GoLitestreamSetTime(void* db, char* timestamp);
|
||||
extern char* GoLitestreamResetTime(void* db);
|
||||
extern char* GoLitestreamTime(void* db, char** out);
|
||||
extern char* GoLitestreamTxid(void* db, char** out);
|
||||
@@ -106,7 +106,7 @@ static void litestream_set_time_impl(sqlite3_context* ctx, int argc, sqlite3_val
|
||||
}
|
||||
|
||||
sqlite3* db = sqlite3_context_db_handle(ctx);
|
||||
char* err = GoLitestreamSetTime(db, (const char*)ts);
|
||||
char* err = GoLitestreamSetTime(db, (char*)ts);
|
||||
if (err != 0) {
|
||||
sqlite3_result_error(ctx, err, -1);
|
||||
free(err);
|
||||
|
||||
Reference in New Issue
Block a user