简体   繁体   English

任何想法如何解决此cygwin Go构建错误

[英]Any Ideas how to solve this cygwin Go build error

I am building a go program for windows with cygwin. 我正在用cygwin构建Windows的go程序。 I cannot find a solution to this problem any where. 我在任何地方都找不到解决此问题的方法。 any help would be useful. 任何帮助都是有用的。

C:\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
/usr/lib/w32api/libntdll.a(dmsqs01966.o):(.text+0x0): multiple definition of `pow'
/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../lib/libm.a(t-d000990.o):fake:(.text+0x0): first defined here
/usr/lib/w32api/libntdll.a(dmsqs01956.o):(.text+0x0): multiple definition of `log'
/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../lib/libm.a(t-d000824.o):fake:(.text+0x0): first defined here
/usr/lib/w32api/libntdll.a(dmsqs01934.o):(.text+0x0): multiple definition of `ceil'
/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../lib/libm.a(t-d000253.o):fake:(.text+0x0): first defined here
C:\cygwin64\tmp\go-link-845985599/000001.o: In function `x_cgo_sys_thread_create':
C:/workdir/go/src/runtime/cgo/gcc_libinit_windows.c:12: undefined reference to `__imp___iob_func'
C:/workdir/go/src/runtime/cgo/gcc_libinit_windows.c:12:(.text+0x6): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp___iob_func'
C:\cygwin64\tmp\go-link-845985599/000001.o: In function `x_cgo_thread_start':
C:/workdir/go/src/runtime/cgo/gcc_util.c:43: undefined reference to `__imp___iob_func'
C:/workdir/go/src/runtime/cgo/gcc_util.c:43:(.text+0xdc): relocation truncated 

EDIT 1: Someone sugested using 1.8 but another error msg 编辑1:有人建议使用1.8,但另一个错误消息

C:\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
C:\cygwin64\tmp\go-link-485496143\000001.o: In function `_cgo_preinit_init':
C:/workdir/go/src/runtime/cgo/gcc_libinit_windows.c:28: undefined reference to `__imp___iob_func'
C:/workdir/go/src/runtime/cgo/gcc_libinit_windows.c:28:(.text+0x6a): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp___iob_func'
C:\cygwin64\tmp\go-link-485496143\000001.o: In function `x_cgo_sys_thread_create':
C:/workdir/go/src/runtime/cgo/gcc_libinit_windows.c:56: undefined reference to `__imp__beginthread'
C:/workdir/go/src/runtime/cgo/gcc_libinit_windows.c:56:(.text+0x10c): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp__beginthread'
C:/workdir/go/src/runtime/cgo/gcc_libinit_windows.c:58: undefined reference to `__imp__errno'
C:/workdir/go/src/runtime/cgo/gcc_libinit_windows.c:58:(.text+0x11e): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp__errno'
C:/workdir/go/src/runtime/cgo/gcc_libinit_windows.c:58: undefined reference to `__imp___iob_func'
C:/workdir/go/src/runtime/cgo/gcc_libinit_windows.c:58:(.text+0x126): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp___iob_func'
C:\cygwin64\tmp\go-link-485496143\000001.o: In function `x_cgo_notify_runtime_init_done':
C:/workdir/go/src/runtime/cgo/gcc_libinit_windows.c:99: undefined reference to `__imp___iob_func'
C:/workdir/go/src/runtime/cgo/gcc_libinit_windows.c:99:(.text+0x255): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp___iob_func'
C:\cygwin64\tmp\go-link-485496143\000001.o: In function `x_cgo_thread_start':
C:/workdir/go/src/runtime/cgo/gcc_util.c:18: undefined reference to `__imp___iob_func'
C:/workdir/go/src/runtime/cgo/gcc_util.c:18:(.text+0x32c): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp___iob_func'
C:\cygwin64\tmp\go-link-485496143\000001.o: In function `_cgo_sys_thread_start':
C:/workdir/go/src/runtime/cgo/gcc_windows_amd64.c:32: undefined reference to `__imp__beginthread'
C:/workdir/go/src/runtime/cgo/gcc_windows_amd64.c:32:(.text+0x403): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp__beginthread'
C:/workdir/go/src/runtime/cgo/gcc_windows_amd64.c:34: undefined reference to `__imp__errno'
C:/workdir/go/src/runtime/cgo/gcc_windows_amd64.c:34:(.text+0x415): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp__errno'
C:/workdir/go/src/runtime/cgo/gcc_windows_amd64.c:34: undefined reference to `__imp___iob_func'
C:/workdir/go/src/runtime/cgo/gcc_windows_amd64.c:34:(.text+0x41d): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp___iob_func'
/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../lib/libmingwex.a(lib64_libmingwex_a-ftruncate.o):ftruncate.c:(.text+0x1): undefined reference to `_chsize'
/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../lib/libmingwex.a(lib64_libmingwex_a-ftruncate.o):ftruncate.c:(.text+0x1): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `_chsize'
/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../lib/libmingwex.a(lib64_libmingwex_a-_fstat.o):_fstat.c:(.text+0xf): undefined reference to `_fstat64'
/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../lib/libmingwex.a(lib64_libmingwex_a-_fstat.o):_fstat.c:(.text+0xf): additional relocation overflows omitted from the output
/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../lib/libmingwex.a(lib64_libmingwex_a-log.o):log.c:(.text+0x83): undefined reference to `_errno'
/usr/lib/gcc/x86_64-pc-

We had to remove cygwin and install this compiler http://tdm-gcc.tdragon.net/download , and we had no problems. 我们必须删除cygwin并安装此编译器http://tdm-gcc.tdragon.net/download ,并且没有问题。

Remember to remove the cygwin gcc compiler from your PATH 切记从您的PATH中删除cygwin gcc编译器

I hope it'll help you. 希望对您有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM