简体   繁体   中英

Any Ideas how to solve this cygwin Go build error

I am building a go program for windows with cygwin. 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

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.

Remember to remove the cygwin gcc compiler from your PATH

I hope it'll help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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