我正在用cygwin为Windows构建一个go程序。我在任何地方都找不到解决这个问题的方法。任何帮助都会有用。
C:Gopkgtoolwindows_amd64link.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:cygwin64tmpgo-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:cygwin64tmpgo-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
编辑 1:有人使用 1.8 但另一个错误消息
C:Gopkgtoolwindows_amd64link.exe: running gcc failed: exit status 1
C:cygwin64tmpgo-link-485496143 00001.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:cygwin64tmpgo-link-485496143 00001.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:cygwin64tmpgo-link-485496143 00001.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:cygwin64tmpgo-link-485496143 00001.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:cygwin64tmpgo-link-485496143 00001.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-
我们不得不删除cygwin并安装这个编译器 http://tdm-gcc.tdragon.net/download,我们没有问题。
请记住从您的 PATH 中删除 cygwin gcc 编译器
我希望它能帮助你。