tursodatabase / libsql

libSQL is a fork of SQLite that is both Open Source, and Open Contributions.
https://turso.tech/libsql
MIT License
11.97k stars 302 forks source link

Error related to `libsql_experimental.a` when used with golang sqlite3 driver #1029

Open sjunepark opened 9 months ago

sjunepark commented 9 months ago

Hi,

I'm using golang and am using go-libsql.

When I import sqlite3 and libsql, both drivers, the error below occurs.

import (
    _ "github.com/libsql/go-libsql"
    _ "github.com/mattn/go-sqlite3"
)
/usr/local/go/pkg/tool/darwin_arm64/link: running clang failed: exit status 1
duplicate symbol '_sqlite3_vsnprintf' in:
    /private/var/folders/16/lvgrynkd1n93dqjg140gs5wm0000gn/T/go-link-3924145887/000013.o
    /Users/sejunpark/go/pkg/mod/github.com/libsql/go-libsql@v0.0.0-20240210093909-f14a170a8487/lib/darwin_arm64/libsql_experimental.a[102](sqlite3.o)
duplicate symbol '_sqlite3_column_count' in:
    /private/var/folders/16/lvgrynkd1n93dqjg140gs5wm0000gn/T/go-link-3924145887/000013.o
    /Users/sejunpark/go/pkg/mod/github.com/libsql/go-libsql@v0.0.0-20240210093909-f14a170a8487/lib/darwin_arm64/libsql_experimental.a[102](sqlite3.o)
duplicate symbol '_sqlite3_vfs_find' in:
    /private/var/folders/16/lvgrynkd1n93dqjg140gs5wm0000gn/T/go-link-3924145887/000013.o
    /Users/sejunpark/go/pkg/mod/github.com/libsql/go-libsql@v0.0.0-20240210093909-f14a170a8487/lib/darwin_arm64/libsql_experimental.a[102](sqlite3.o)

(omitted)

ld: 266 duplicate symbols
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I thought this was an error related to bindings/c/Makefile

@haaawk Can you help check this out if possible? Thanks again.

haaawk commented 9 months ago

Thanks for reporting this issue @sjunepark. Do you have any suggestions on how to change the Makefile to fix the issue?

sjunepark commented 9 months ago

@haaawk Wish I could help but I have no idea on what's going on😔

ainsleyclark commented 2 months ago

Plus one on this, I've tried working on multiple golang migration libraries and they all have link issues.

buildtheui commented 1 month ago

It's happening the same thing to me, any idea on how to solve this ?