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

Error when building in windows #357

Closed
coder-wangfugui opened this issue Aug 23, 2021 · 5 comments
Closed

Error when building in windows #357

coder-wangfugui opened this issue Aug 23, 2021 · 5 comments
Labels
Milestone

Comments

@coder-wangfugui
Copy link

When I try to build , I get the below error:

PS D:\Code_GO\ceshigongju> go build .\test.go

command-line-arguments

C:\Program Files\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
D:/Program Files/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lz
collect2.exe: error: ld returned 1 exit status

I use TDM-GCC-64.

@vcaesar
Copy link
Member

vcaesar commented Aug 23, 2021

Closed because of duplicates, #100. All code tests and C dependencies use MinGw-64, TDM-GCC has not been tested.
But you can compile lpng and lzib yourself, and you can download https://sourceforge.net/projects/mingw-w64/files/ x86_64-posix.

@vcaesar vcaesar closed this as completed Aug 23, 2021
@vcaesar vcaesar added this to the v0.100.0 milestone Aug 23, 2021
@coder-wangfugui
Copy link
Author

Closed because of duplicates, #100. All code tests and C dependencies use MinGw-64, TDM-GCC has not been tested.
But you can compile lpng and lzib yourself, and you can download https://sourceforge.net/projects/mingw-w64/files/ x86_64-posix.

I complie lzib,meet an error.Then I change to MinGw-64, I meet the same error again. The errer
C:\Program Files\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1 C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function default_logger':
D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../hook/windows/../logger_c.h:39: undefined reference to __getreent' D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../hook/windows/../logger_c.h:32: undefined reference to __getreent'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function loggerProc': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/pub.h:97: undefined reference to __getreent'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function eb_port_retain': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:426: undefined reference to __assert_func'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function eb_port_signal': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:439: undefined reference to __assert_func'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function eb_port_wait': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:453: undefined reference to __assert_func'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function port_list_signal_first': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:648: undefined reference to __assert_func'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function eb_chan_retain': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:777: undefined reference to __assert_func'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function eb_assert_print': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:146: undefined reference to __getreent'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function eb_port_create': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:390: undefined reference to sched_yield'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function eb_port_free': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:358: undefined reference to sched_yield'
D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:349: undefined reference to sched_yield' C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function eb_port_release':
D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:432: undefined reference to __assert_func' C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function cleanup_ops':
D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:866: undefined reference to sched_yield' C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function port_list_signal_first':
D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:651: undefined reference to sched_yield' D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:651: undefined reference to sched_yield'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function send_unbuf': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:1089: undefined reference to sched_yield'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function recv_unbuf': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:1210: undefined reference to sched_yield'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o:D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:1180: more undefined references to sched_yield' follow C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function try_op':
D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:1249: undefined reference to __assert_func' C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function eb_assert_print':
D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:146: undefined reference to __getreent' D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:146: undefined reference to __getreent'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function eb_chan_release': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:783: undefined reference to __assert_func'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function eb_chan_close': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:796: undefined reference to sched_yield'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function port_list_signal_first': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:651: undefined reference to sched_yield'
D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:651: undefined reference to sched_yield' C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function eb_chan_close':
D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:791: undefined reference to __assert_func' C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function eb_chan_buf_cap':
D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:830: undefined reference to __assert_func' C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function eb_chan_buf_len':
D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:843: undefined reference to sched_yield' D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:835: undefined reference to __assert_func'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function eb_chan_select_list': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:1333: undefined reference to sched_yield'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function port_list_signal_first': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:651: undefined reference to sched_yield'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function port_list_rm': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:620: undefined reference to sched_yield'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function eb_chan_select_list': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:1394: undefined reference to sched_yield'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function port_list_add': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:597: undefined reference to sched_yield'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function port_list_rm': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:617: undefined reference to __assert_func'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function eb_chan_select_list': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:1299: undefined reference to __assert_func'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function port_list_rm': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:616: undefined reference to __assert_func'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function eb_assert_print': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:146: undefined reference to __getreent'
C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function port_list_add': D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:592: undefined reference to __assert_func'
D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:591: undefined reference to __assert_func' C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function dispatch_proc':
D:\ProgramData\Golang\src\github.com\robotn\gohook/event/dispatch_proc.h:66: undefined reference to __getreent' C:\Users\wfugui\AppData\Local\Temp\go-link-226374895\000004.o: In function eb_assert_print':
D:\ProgramData\Golang\src\github.com\robotn\gohook/event/../chan/eb_chan.h:146: undefined reference to __getreent' collect2.exe: error: ld returned 1 exit status

@vcaesar
Copy link
Member

vcaesar commented Aug 24, 2021

Are you set the gcc environment variables? Or try go run -a main.go?

@coder-wangfugui
Copy link
Author

Are you set the gcc environment variables? Or try go run -a main.go?

Thank you very much. The error is lacking of '-a'. Thanks again

@GetcharZp
Copy link

x86_64-posix-sjlj 这个版本是可以的.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants