tursodatabase / tursodatabase/libsql

Go API: Compile/Link error on Linux with Embedded Replication library

Open
#1,639 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
17.2k
Forks
531
Avg merge
1h 12m
Merged PRs (30d)
1

Description

Using the quickstart code example at https://docs.turso.tech/sdk/go/quickstart#local-embedded-replicas

Environment:

  • go version go1.22.2 linux/amd64
  • OS: Oracle Linux Server release 7.9 (similar to RedHat EL 7.9)
  • Kernel 3.10.0-1160.119.1.0.1.el7.x86_64
  • GCC: gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44.0.3)
  • github.com/tursodatabase/go-libsql v0.0.0-20240725130945-f44f2b84c8c8

Compiling the code with go build results in:

go: downloading github.com/tursodatabase/go-libsql v0.0.0-20240725130945-f44f2b84c8c8
go: downloading github.com/tursodatabase/libsql-client-go v0.0.0-20240723183952-b944339d7e70
go: downloading nhooyr.io/websocket v1.8.10
go: downloading github.com/antlr4-go/antlr/v4 v4.13.0
go: downloading golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8
go: downloading github.com/libsql/sqlite-antlr4-parser v0.0.0-20240327125255-dbf53b6cbf06
# turso
/emit/lang/go1.22.2/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/home/t823517/go/pkg/mod/github.com/tursodatabase/go-libsql@v0.0.0-20240725130945-f44f2b84c8c8/lib/linux_amd64/libsql_experimental.a(sqlite3mc.c.o): In function `unixDlError':
sqlite3mc.c:(.text+0x3d2a8): undefined reference to `dlerror'
/home/t823517/go/pkg/mod/github.com/tursodatabase/go-libsql@v0.0.0-20240725130945-f44f2b84c8c8/lib/linux_amd64/libsql_experimental.a(sqlite3mc.c.o): In function `unixDlClose':
sqlite3mc.c:(.text+0xef94): undefined reference to `dlclose'
/home/t823517/go/pkg/mod/github.com/tursodatabase/go-libsql@v0.0.0-20240725130945-f44f2b84c8c8/lib/linux_amd64/libsql_experimental.a(sqlite3mc.c.o): In function `unixDlSym':
sqlite3mc.c:(.text+0xefa7): undefined reference to `dlsym'
/home/t823517/go/pkg/mod/github.com/tursodatabase/go-libsql@v0.0.0-20240725130945-f44f2b84c8c8/lib/linux_amd64/libsql_experimental.a(sqlite3mc.c.o): In function `unixDlOpen':
sqlite3mc.c:(.text+0xefb9): undefined reference to `dlopen'
/home/t823517/go/pkg/mod/github.com/tursodatabase/go-libsql@v0.0.0-20240725130945-f44f2b84c8c8/lib/linux_amd64/libsql_experimental.a(sqlite3mc.c.o):(.data.rel+0xb0): undefined reference to `fcntl64'
/home/t823517/go/pkg/mod/github.com/tursodatabase/go-libsql@v0.0.0-20240725130945-f44f2b84c8c8/lib/linux_amd64/libsql_experimental.a(std-90f6ddbf82de36ec.std.409886f6357001f0-cgu.0.rcgu.o): In function `std::sys::unix::weak::fetch::hd6aa2385a244f117':
/rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys/unix/weak.rs:138: undefined reference to `dlsym'
collect2: error: ld returned 1 exit status

Using github.com/tursodatabase/libsql-client-go/libsql with "Remote Only" works fine.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Go quickstart for local embedded replicas and reproduce the failure with go build on the reported Linux environment. Inspect the go-libsql package and its bundled lib/linux_amd64/libsql_experimental.a, focusing on the linker errors; done means the embedded-replica example builds successfully on the reported platform while remote-only usage remains working.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, go, rust
Domain
build-system, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.