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

fail to build on windows with a few compiler #1012

Closed
NewUserHa opened this issue Feb 3, 2022 · 6 comments
Closed

fail to build on windows with a few compiler #1012

NewUserHa opened this issue Feb 3, 2022 · 6 comments

Comments

@NewUserHa
Copy link

  1. compiler from https://winlibs.com/ failed:
> go run .
# 
C:\Program Files\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\user\AppData\Local\Temp\go-link-2621619269\000016.o: in function `_cgo_preinit_init':
c:\go\src\runtime\cgo/gcc_libinit_windows.c:30: undefined reference to `__imp___iob_func'
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\user\AppData\Local\Temp\go-link-2621619269\000016.o: in function `x_cgo_sys_thread_create':
c:\go\src\runtime\cgo/gcc_libinit_windows.c:60: undefined reference to `__imp___iob_func'
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\user\AppData\Local\Temp\go-link-2621619269\000016.o: in function `x_cgo_notify_runtime_init_done':
c:\go\src\runtime\cgo/gcc_libinit_windows.c:101: undefined reference to `__imp___iob_func'
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\user\AppData\Local\Temp\go-link-2621619269\000017.o: in function `x_cgo_thread_start':
c:\go\src\runtime\cgo/gcc_util.c:18: undefined reference to `__imp___iob_func'
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\user\AppData\Local\Temp\go-link-2621619269\000018.o: in function `_cgo_sys_thread_start':
c:\go\src\runtime\cgo/gcc_windows_amd64.c:31: undefined reference to `__imp___iob_func'
collect2.exe: error: ld returned 1 exit status
  1. compiler from https://jmeubank.github.io/tdm-gcc/ succeeded.
  2. havn't tested mingw-w64 and cygwin, unknown.

Is there possible for the first case a fix?

@rittneje
Copy link
Collaborator

rittneje commented Feb 3, 2022

What version of Go are you using?

@NewUserHa
Copy link
Author

go version go1.17.5 windows/amd64

@rittneje
Copy link
Collaborator

rittneje commented Feb 3, 2022

Based upon the error you are seeing, it seems like an issue with your C library. In particular I think this is a problem with however stderr is being defined in C. Seems similar to this StackOverflow post. https://stackoverflow.com/a/30894349

@NewUserHa
Copy link
Author

NewUserHa commented Feb 3, 2022

the first pre-build of GCC is more popular than the 2nd one, of course not as popular as MinGW-w64 or Cygwin.
But it looks like both 1st and 2nd are minified from MinGW-w64. Therefore there shouldn't be any error while building.

so is there possible a fix?

@rittneje
Copy link
Collaborator

rittneje commented Feb 3, 2022

As this seems to be a cgo issue, and not an issue with this particular library, I suggest posting on the Go issue tracker to see if anyone there can help diagnose your issue. (Unfortunately, this is beyond my area of expertise.) https://github.com/golang/go/issues

@NewUserHa
Copy link
Author

ok.

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

2 participants