Skip to content
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

Unable to build on Windows #137

Open
CaptainKraft opened this issue Aug 15, 2022 · 0 comments
Open

Unable to build on Windows #137

CaptainKraft opened this issue Aug 15, 2022 · 0 comments

Comments

@CaptainKraft
Copy link

CaptainKraft commented Aug 15, 2022

When trying to build via the Windows command prompt, I get these errors:

# crawshaw.io/sqlite
In file included from _cgo_export.c:4:
cgo-gcc-export-header-prolog:49:34: error: redeclaration of 'go_sqlite_auth_tramp' cannot add 'dllexport' attribute
auth.go:5:13: note: previous declaration is here
cgo-gcc-export-header-prolog:50:35: warning: redeclaration of 'func_tramp' should not add 'dllexport' attribute [-Wdll-attribute-on-redeclaration]
func.go:22:14: note: previous declaration is here
cgo-gcc-export-header-prolog:51:35: warning: redeclaration of 'step_tramp' should not add 'dllexport' attribute [-Wdll-attribute-on-redeclaration]
func.go:23:14: note: previous declaration is here
cgo-gcc-export-header-prolog:52:35: warning: redeclaration of 'final_tramp' should not add 'dllexport' attribute [-Wdll-attribute-on-redeclaration]
func.go:24:14: note: previous declaration is here
cgo-gcc-export-header-prolog:54:34: warning: redeclaration of 'go_strm_w_tramp' should not add 'dllexport' attribute [-Wdll-attribute-on-redeclaration]
session.go:22:13: note: previous declaration is here
cgo-gcc-export-header-prolog:55:34: warning: redeclaration of 'go_strm_r_tramp' should not add 'dllexport' attribute [-Wdll-attribute-on-redeclaration]
session.go:23:13: note: previous declaration is here
cgo-gcc-export-header-prolog:58:35: error: redeclaration of 'log_fn' cannot add 'dllexport' attribute
sqlite.go:55:14: note: previous declaration is here

After installing cygwin and the appropriate libraries, I get this error when trying to build:

C:\Program Files\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lwinpthread: No such file or directory
collect2: error: ld returned 1 exit status

This is at the bottom of the README: By default it requires some pthreads DLL on Windows. To avoid it, supply CGOLDFLAGS="-static" when building your application.

But, setting CGOLDFLAGS to "-static" does nothing. However, in cygwin, if I export CGO_LDFLAGS to "-static", then I get a new error:

# runtime/cgo
gcc_libinit_windows.c: In function ‘_cgo_beginthread’:
gcc_libinit_windows.c:136:27: error: implicit declaration of function ‘_beginthread’; did you mean ‘_cgo_beginthread’? [-Werror=implicit-function-declaration]
  136 |                 thandle = _beginthread(func, 0, arg);
      |                           ^~~~~~~~~~~~
      |                           _cgo_beginthread
cc1: all warnings being treated as errors
@CaptainKraft CaptainKraft changed the title Unable to build on Windows via cmd.exe Unable to build on Windows Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant