odbc icon indicating copy to clipboard operation
odbc copied to clipboard

Cross-platform build for Linux failed when building in Windows

Open ppinghu opened this issue 7 months ago • 3 comments

When I tried to do cross-platform build on Windows for Linux, I encountered the following errors: ......\go\pkg\mod\github.com\alexbrainman\[email protected]\api\api.go:17:9: undefined: SQLSMALLINT ......\go\pkg\mod\github.com\alexbrainman\[email protected]\api\api.go:18:9: undefined: SQLUSMALLINT

ppinghu avatar Sep 05 '25 18:09 ppinghu

@ppinghu

If you want more help here, you need to tell me what command you run and provide complete output.

I assume that you know that this package uses cgo to building Linux version. So you will need to install all required C tools and libraries.

Alex

alexbrainman avatar Sep 12 '25 16:09 alexbrainman

I simply use GOOS=Linux GOARCH=amd64 go build.

However I think I have figured the problem is that Windows does not have the proper ODBC driver for Linux. So I have to go to VM to build for Linux. That was successful.

Next I tried to build for MacOS from Linux and it did not work either. I thought both Linux and MacOS uses cgo and unix ODBC driver so it should work.

apinghu avatar Sep 12 '25 16:09 apinghu

I simply use GOOS=Linux GOARCH=amd64 go build.

This is not a valid Windows build command. But if it works for you, it is fine with me.

However I think I have figured the problem is that Windows ...

Good.

Alex

alexbrainman avatar Sep 17 '25 12:09 alexbrainman