Giter VIP home page Giter VIP logo

Comments (3)

marcboeker avatar marcboeker commented on July 17, 2024

Thanks for bringing this up. Does this strange behavior also occur with other go-duckdb based code or only with the examples/simple.go program?

make test also executes properly?

Can you try to attach to the executed binary with dlv as described here?

from go-duckdb.

chenbobby avatar chenbobby commented on July 17, 2024

Does this strange behavior also occur with other go-duckdb based code or only with the examples/simple.go program?

This occurs with other go-duckdb based code as well. As a simple case, the following code snippet will have the same buggy behavior:

package main

import (
	"database/sql"
	"fmt"

	_ "github.com/marcboeker/go-duckdb"
)

func main() {
	fmt.Println("Start")
	_, err := sql.Open("duckdb", "")
	if err != nil {
		panic(err)
	}
	fmt.Println("End")
}

make test also executes properly?

Yes, make test executes properly and all tests are passing.


Can you try to attach to the executed binary with dlv?

Thanks for the suggestion. I haven't used dlv before.

I tried to dlv attach <pid> to a running process, but dlv just hangs without any output.

I also tried to dlv exec <my_binary> and I get the following output:

Warning: no debug info found, some functionality will be missing such as stack traces and variable evaluation.
could not launch process: could not read debug info (decoding dwarf section info at offset 0x0: too short) and could not read go symbol table (could not find rodata struct member)

from go-duckdb.

chenbobby avatar chenbobby commented on July 17, 2024

✅ I found a workaround. go build -ldflags="-s -w" will produce a binary that I can execute.

Explanation

When I compared the output of go build -x . and go run -x ., the only significant difference was that go run included the linker flags -s -w. When I explicitly added -ldflags="-s -w" to my go build command, I was able to successfully execute the output binary.

Apparently, those linker flags will:

-s    disable symbol table
-w    disable DWARF generation

However, I'm not sure why this solved my problem though. 😅

In any case, feel free to close this issue.

from go-duckdb.

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.