-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macos go run
works but unable to execute the output of go build
#235
Comments
Thanks for bringing this up. Does this strange behavior also occur with other go-duckdb based code or only with the
Can you try to attach to the executed binary with dlv as described here? |
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")
}
Yes,
Thanks for the suggestion. I haven't used I tried to I also tried to
|
✅ I found a workaround. ExplanationWhen I compared the output of Apparently, those linker flags will:
However, I'm not sure why this solved my problem though. 😅 In any case, feel free to close this issue. |
You've saved me! |
I am trying to build the example
simple.go
as a single static binary, and then execute it. However, my terminal seems to just hang when I attempt to run the output Mach-O executable, and I am forced to close my terminal. I cannot even Ctrl-C out of the execution attempt.Strangely, running
go run .
in the examples directory will execute successfully. Also, running bothgo build .
andCGO_ENABLED=1 go build .
will execute and terminate with exit code 0. But, as described above, executing the output binary will cause my terminal to hang.Is there some additional work I need to do to build a CGo binary that I can run on macOS? Thanks in advance for the help, and let me know if I can provide any additional information.
CPU: Apple M1 Pro 2021
OS: macOS Ventura 13.3.1
Go Version: go1.22.2 darwin/arm64
Git Hash: 8eaf120
The text was updated successfully, but these errors were encountered: