Git Product home page Git Product logo

Comments (10)

jeromegn avatar jeromegn commented on July 18, 2024 1

That does fix it.

from go-dqlite.

stgraber avatar stgraber commented on July 18, 2024

Try passing -tags libsqlite3? I don't know if there's some magic in this Go application to use the share library, but if not, without that tag, you may end up using an incorrect libsqlite3.

from go-dqlite.

freeekanayaka avatar freeekanayaka commented on July 18, 2024

What @stgraber says.

Quoting https://github.com/canonical/go-dqlite/#demo :

"
or build the dqlite C library and its dependencies from source, as described here, and then run:

go install -tags libsqlite3 ./cmd/dqlite-demo

"

from go-dqlite.

jeromegn avatar jeromegn commented on July 18, 2024

That's interesting. I don't know how that works :)

$ go install -tags libsqlite3 ./cmd/dqlite-demo

$ dqlite-demo -a 127.0.0.1:5005 -db 127.0.0.1:5006
Error: failed to set bind address

^^ it got rid of the segfault, but now I believe I'm getting the same issue I have in my rust project, related to: canonical/dqlite#218

from go-dqlite.

freeekanayaka avatar freeekanayaka commented on July 18, 2024

Would it be possible for you to clone the C dqlite repository, build it from source and try the C code snippet I pasted in canonical/dqlite#218 ?

If that does work, then it might be something odd in the arch package. If that does not work I'll send you a patch to debug the issue.

from go-dqlite.

jeromegn avatar jeromegn commented on July 18, 2024

I was currently replying to the other issue :) The code you pasted in canonical/dqlite#218 works fine on my machine. Which is very puzzling.

I've compiled the library locally before to try it out (added the debug flag to try and figure out why this would be happening too), but it showed the same behavior. (I had completely uninstalled the arch package to make sure it wasn't being used)

I'll try again

from go-dqlite.

jeromegn avatar jeromegn commented on July 18, 2024

I just did again.

Now I get slightly different behaviour:

$ go run -tags libsqlite3 ./cmd/dqlite-demo/dqlite-demo.go -a 127.0.0.1:5005 -db 127.0.0.1:5006
# github.com/canonical/go-dqlite/internal/bindings
/usr/bin/ld: /usr/local/lib/libdqlite.so: undefined reference to `sqlite3_wal_replication_frames'
/usr/bin/ld: /usr/local/lib/libdqlite.so: undefined reference to `sqlite3_wal_replication_enabled'
/usr/bin/ld: /usr/local/lib/libdqlite.so: undefined reference to `sqlite3_wal_replication_leader'
/usr/bin/ld: /usr/local/lib/libdqlite.so: undefined reference to `sqlite3_wal_replication_undo'
/usr/bin/ld: /usr/local/lib/libdqlite.so: undefined reference to `sqlite3_wal_replication_unregister'
/usr/bin/ld: /usr/local/lib/libdqlite.so: undefined reference to `sqlite3_wal_replication_follower'
/usr/bin/ld: /usr/local/lib/libdqlite.so: undefined reference to `sqlite3_wal_replication_register'
collect2: error: ld returned 1 exit status

so I set some env vars:

$ LD_LIBRARY_PATH=/usr/lib/sqlite-replication/:/usr/local/lib/ CGO_LDFLAGS=-L/usr/lib/sqlite-replication/ go run -tags libsqlite3 ./cmd/dqlite-demo/dqlite-demo.go -a 127.0.0.1:5005 -db 127.0.0.1:5006
Error: failed to set bind address

(dqlite compiled from source and using make install installed the lib in /usr/local/lib by default. The arch package I installed before put it in /usr/lib, so I have to specific that env var to get to the new package)

Edit: The code you provided in canonical/dqlite#218 still works!

from go-dqlite.

freeekanayaka avatar freeekanayaka commented on July 18, 2024

If that code works, it means there's something odd in the arch package. Maybe it's actually not v1.4.1?

Instead of go run try to use go build, then launch the compiled binary using the env variables you pasted. I'm not totally sure go run passes those envs across.

If that still does not work, try to locate the libdqlite.so.0.0.1 file shipped in your arch package and replace it with the one you built by hand (you find it under the ./libs directory of your git checkout).

from go-dqlite.

jeromegn avatar jeromegn commented on July 18, 2024

The code in canonical/dqlite#218 works with both the arch package and the lib compiled from source. So this doesn't look like my install is wrong.

Since there are no segfaults and no undefined symbols errors, I'm assuming it's using the correct libraries. If it's not using the right sqlite3 lib, I usually get things like /usr/bin/ld: /usr/local/lib/libdqlite.so: undefined reference to 'sqlite3_wal_replication_frames'. If it can't find dqlite, I get dqlite-demo: error while loading shared libraries: libdqlite.so.0: cannot open shared object file: No such file or directory

As far as I can tell both the pre-compiled lib from the arch package and my own compiled-from-source lib have the same behavior: the code from canonical/dqlite#218 works perfectly, the go-dqlite demo "failed to set bind address" and my own rust implementation also fails to set the bind address.

The initial segfault I reported in this issue was fixed by adding -tags libsqlite3 to either go run, go build or go install.

This is very mysterious.

from go-dqlite.

freeekanayaka avatar freeekanayaka commented on July 18, 2024

As far as I can tell both the pre-compiled lib from the arch package and my own compiled-from-source lib have the same behavior: the code from canonical/dqlite#218 works perfectly, the go-dqlite demo "failed to set bind address" and my own rust implementation also fails to set the bind address.

Please can you try with:

dqlite-demo -a 127.0.0.1:5005 --db 127.0.0.1:5006

note the --db (double dash) instead of -db (single dash). I can reproduce your problem with the single dash, so it might be an argument parsing issue.

from go-dqlite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.