go-gl/example

c:\go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1

hoffor opened this issue · 1 comments

not even sure where this issue lies. go 1.19. windows 10 64-bit using winlibs-x86_64-posix-seh-gcc-12.1.0-llvm-14.0.6-mingw-w64ucrt-10.0.0-r3 from winlibs.com

confirmed 64-bit gcc.exe, c11.exe & go.exe. go and gcc are defined in path and i've confirmed this and am running these commands in a new cmd window with an up to date path. mingw and go paths have no spaces and aren't long

tried deleting appdata\local\go-build, tried using a brand new module, set GO111MODULE=on (suggested online), reinstalling go 1.19, trying 1.14, nothin

after downloading all packages:

C:\Users\Hoffry\go\pkg\mod\github.com\go-gl\example@v0.0.0-20220216040751-d71b0d9f823d\gl41core-cube>go install -v github.com/go-gl/example/gl41core-cube
golang.org/x/image/math/f32
github.com/go-gl/mathgl/mgl32
github.com/go-gl/glfw/v3.3/glfw
github.com/go-gl/gl/v4.1-core/gl
github.com/go-gl/example/gl41core-cube
# github.com/go-gl/example/gl41core-cube
c:\go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
c:/portableapps/cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\Hoffry\AppData\Local\Temp\go-link-1216772332\000026.o: in function `_cgo_preinit_init':
\\_\_\runtime\cgo/gcc_libinit_windows.c:40: undefined reference to `__imp___iob_func'
c:/portableapps/cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\Hoffry\AppData\Local\Temp\go-link-1216772332\000026.o: in function `x_cgo_notify_runtime_init_done':
\\_\_\runtime\cgo/gcc_libinit_windows.c:105: undefined reference to `__imp___iob_func'
c:/portableapps/cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\Hoffry\AppData\Local\Temp\go-link-1216772332\000026.o: in function `_cgo_beginthread':
\\_\_\runtime\cgo/gcc_libinit_windows.c:149: undefined reference to `__imp___iob_func'
c:/portableapps/cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\Hoffry\AppData\Local\Temp\go-link-1216772332\000027.o: in function `x_cgo_thread_start':
\\_\_\runtime\cgo/gcc_util.c:18: undefined reference to `__imp___iob_func'
collect2.exe: error: ld returned 1 exit status

same result for go get -u github.com/go-gl/example/gl41core-cube && cd <path with cube.go> && go build cube.go

issue is solved, instead of the mingw64 build from winlibs.com i used x86_64-12.1.0-release-win32-seh-rt_v10-rev3.7z from https://github.com/niXman/mingw-builds-binaries/releases linked to by https://www.mingw-w64.org/downloads/#mingw-builds

also noting as a new user of go that each package has its own mod file so i'm probably best to stay in my main mod dir and not cd into the package directory before building, i think :p