Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

go build fails in transaction.go with undefined: conn #275

Closed
srirampetavue opened this issue Sep 11, 2024 · 14 comments
Closed

go build fails in transaction.go with undefined: conn #275

srirampetavue opened this issue Sep 11, 2024 · 14 comments

Comments

@srirampetavue
Copy link

I have a project where we're using DuckDB using this driver. When I try to build, I get the following error

# github.com/marcboeker/go-duckdb
../../../go/pkg/mod/github.com/marcboeker/go-duckdb@v1.7.1/transaction.go:6:5: undefined: conn

I noticed that this error only occurs when building from Ubuntu but works fine when building from Mac.

Building for linux
Screenshot 2024-09-11 at 6 38 27 PM

Building for mac
Screenshot 2024-09-11 at 6 41 42 PM

@TengLun
Copy link

TengLun commented Sep 12, 2024

Are you building with CGO_ENABLED=1? go-duckdb uses CGO, if you do not have CGO_ENABLED=1, this error will get returned, although I'm not certain if there are other causes.

@srirampetavue
Copy link
Author

I wasn't using CGO_ENABLED=1. I just tried it and got this error
Screenshot 2024-09-12 at 10 24 59 AM

Just for information, this wasn't happening last week when we deployed this in dev. It started happening yesterday only as far as I know. I see that there was a release, but that's v.1.8.0. Is there a chance this change messed something up in the previous versions?

@TengLun
Copy link

TengLun commented Sep 12, 2024

It might be that your GCC is building to a newer standard for C. Newer standards for C don't allow implicit function declarations; however in general GCC builds according to older standards that allow implicit function calls with just a warning. Is it possible that your GCC is building to a newer standard (like C99 or C11)? If so, it'll likely error out, rather than just giving you a warning and building anyways.

Try setting GCC to build to an older standard like C90, -std=c90, which will turn the error into the warning and build anyway. Its worth a try, at least.

@apocelipes
Copy link
Contributor

Looks like you may need a cross-compiler to build linux binary executable files on MacOS.

Alternatively, you can choose to compile a Linux executable in a docker container (in this case a ubuntu image is recommended because you want the binary file to run on Ubuntu systems), and then you can copy the compiled file to the Linux environment.

@srirampetavue
Copy link
Author

This is not only in MacOS. I tried building in a ubuntu 24.04 VM and I got the same issue. But a week ago, in a similar configured VM, I didn't get that issue. Only difference between both VMs are the regions. Everything else is identical

@shigedangao
Copy link

Bumping on this issue. Along with @jay-mtl since the release of duckdb 1.8.0. We are also encountering an issue with the debugger with the following error message

2024-09-16T17:33:47+02:00 error layer=dap recovered panic: Encountered an unexpected DWARF CFA opcode: 0x2e
goroutine 34 [running]:
runtime/debug.Stack()
	/home/jc-kaiko/sdk/go1.23.1/src/runtime/debug/stack.go:26 +0x5e
runtime/debug.Stack()
	/home/jc-kaiko/sdk/go1.23.1/src/runtime/debug/stack.go:26 +0x5e
github.com/go-delve/delve/service/dap.(*Session).recoverPanic(0xc0000d4f00, {0xc89e20, 0xc002e2a030})
	/home/jc-kaiko/go/pkg/mod/github.com/go-delve/delve@v1.23.0/service/dap/server.go:579 +0x58
panic({0xa84b20?, 0xc0020eb3f0?})
	/home/jc-kaiko/sdk/go1.23.1/src/runtime/panic.go:785 +0x132

Downgrading to 1.7.1 seems to fix the issue. However, is there any significant changes that has been made with this latest release ?

@vincenttat22
Copy link

Run this will solve the problem. I had this issue before

sudo apt-get update && sudo apt-get install build-essential

@srirampetavue
Copy link
Author

Thanks a lot @vincenttat22 . You're a life saver.

@vincenttat22
Copy link

@srirampetavue my pleasure, I'm glad it helped.

@taniabogatsch
Copy link
Collaborator

I'll close this issue as resolved by the above fix.

@libe
Copy link

libe commented Oct 16, 2024

Run this will solve the problem. I had this issue before

sudo apt-get update && sudo apt-get install build-essential

Hello I am getting the same error on Windows

E:\duckgo>go build
# github.com/marcboeker/go-duckdb
C:\Users\l6i\go\pkg\mod\github.com\marcboeker\go-duckdb@v1.8.2\transaction.go:6:5: undefined: conn

Do you know if there's a solution for this?

@vincenttatuptio
Copy link

Unfortunately, I couldn't get it working on Windows either. I reckon you either run your Go App on Linux or WSL2 on Windows.

@taniabogatsch
Copy link
Collaborator

Did you try following the build steps in the Makefile for our Windows build? Maybe also comparing the GitHub Windows runner configuration can help?

@libe
Copy link

libe commented Oct 17, 2024

Run this will solve the problem. I had this issue before

sudo apt-get update && sudo apt-get install build-essential

Hello I am getting the same error on Windows

E:\duckgo>go build
# github.com/marcboeker/go-duckdb
C:\Users\l6i\go\pkg\mod\github.com\marcboeker\go-duckdb@v1.8.2\transaction.go:6:5: undefined: conn

Do you know if there's a solution for this?

I managed to get it working by installing first gcc:

  • download gcc with https://www.msys2.org/
  • add the path of your MinGW-w64 bin folder
  • set CGO_ENABLED=1
  • go build

@taniabogatsch taniabogatsch changed the title go build fails on Ubuntu but works on MacOS go build fails in transaction.go with undefined: conn Nov 18, 2024
Repository owner locked and limited conversation to collaborators Nov 18, 2024
@taniabogatsch taniabogatsch converted this issue into discussion #313 Nov 18, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants