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

cmd/link: undefined reference to __imp___iob_func on windows with import C / x/sys/windows #57455

Closed
steowens opened this issue Dec 25, 2022 · 13 comments
Labels
FrozenDueToAge OS-Windows WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@steowens
Copy link

steowens commented Dec 25, 2022

What version of Go are you using (go version)?

$ go version
go version go1.19.4 windows/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GO111MODULE=                                                                                                                                 set GOARCH=amd64                                                                                                                                 set GOBIN=                                                                                                                                       set GOCACHE=C:\Users\steve\AppData\Local\go-build                                                                                                set GOENV=C:\Users\steve\AppData\Roaming\go\env                                                                                                  set GOEXE=.exe                                                                                                                                   set GOEXPERIMENT=                                                                                                                                set GOFLAGS=                                                                                                                                     set GOHOSTARCH=amd64                                                                                                                             set GOHOSTOS=windows                                                                                                                             set GOINSECURE=                                                                                                                                  set GOMODCACHE=C:\Users\steve\go\pkg\mod                                                                                                         set GONOPROXY=                                                                                                                                   set GONOSUMDB=                                                                                                                                   set GOOS=windows                                                                                                                                 set GOPATH=C:\Users\steve\go                                                                                                                     set GOPRIVATE=                                                                                                                                   set GOPROXY=https://proxy.golang.org,direct                                                                                                      set GOROOT=C:\Program Files\Go                                                                                                                   set GOSUMDB=sum.golang.org                                                                                                                       set GOTMPDIR=                                                                                                                                    set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64                                                                                         set GOVCS=                                                                                                                                       set GOVERSION=go1.19.4                                                                                                                           set GCCGO=gccgo                                                                                                                                  set GOAMD64=v1                                                                                                                                   set AR=ar                                                                                                                                        set CC=gcc                                                                                                                                       set CXX=g++                                                                                                                                      set CGO_ENABLED=1                                                                                                                                set GOMOD=C:\Users\steve\source\goWebView\go.mod                                                                                                 set GOWORK=                                                                                                                                      set CGO_CFLAGS=-g -O2                                                                                                                            set CGO_CPPFLAGS=                                                                                                                                set CGO_CXXFLAGS=-g -O2                                                                                                                          set CGO_FFLAGS=-g -O2                                                                                                                            set CGO_LDFLAGS=-g -O2                                                                                                                           set PKG_CONFIG=pkg-config                                                                                                                        set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\steve\AppData\Local\Temp\go-build3017409395=/tmp/go-build -gno-record-gcc-switches   

What did you do?

I tried to compile the program shown at the bottom of this issue using go build.

What did you expect to see?

I expected my program to compile or at least give me an error in my code.

What did you see instead?

C:\Users\steve\source\goWebView> go build
github.com/steowens/goWebview
C:\Program Files\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
c:/program files/winlibs-x86_64-posix-seh-gcc-12.2.0-llvm-14.0.6-mingw-w64ucrt-10.0.0-r2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\steve\AppData\Local\Temp\go-link-2288540720\000005.o: in function _cgo_preinit_init': \\_\_\runtime\cgo/gcc_libinit_windows.c:40: undefined reference to __imp___iob_func'
c:/program files/winlibs-x86_64-posix-seh-gcc-12.2.0-llvm-14.0.6-mingw-w64ucrt-10.0.0-r2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\steve\AppData\Local\Temp\go-link-2288540720\000005.o: in function x_cgo_notify_runtime_init_done': \\_\_\runtime\cgo/gcc_libinit_windows.c:105: undefined reference to __imp___iob_func'
c:/program files/winlibs-x86_64-posix-seh-gcc-12.2.0-llvm-14.0.6-mingw-w64ucrt-10.0.0-r2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\steve\AppData\Local\Temp\go-link-2288540720\000005.o: in function _cgo_beginthread': \\_\_\runtime\cgo/gcc_libinit_windows.c:149: undefined reference to __imp___iob_func'
c:/program files/winlibs-x86_64-posix-seh-gcc-12.2.0-llvm-14.0.6-mingw-w64ucrt-10.0.0-r2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\steve\AppData\Local\Temp\go-link-2288540720\000006.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

Attaching source code for program. I simply have no clue what this error is telling me and there doesn't seem to be any answers on the web as to how to get a clue.

Program: main.go

package main

import "C"
import (
	"log"
	"golang.org/x/sys/windows"
)

var hModule windows.Handle

func init() {
	err := windows.GetModuleHandleEx(0x01, nil, &hModule)
	if err != nil {
		panic(err)
	}

}

func main() {
	log.Println("Hello")
}

Here is the go.mod file

module github.com/steowens/goWebview

go 1.19

require golang.org/x/sys v0.3.0

Apparently commenting out the following line fixes the compilation issues;

import "C"

And I found this: https://stackoverflow.com/questions/30412951/unresolved-external-symbol-imp-fprintf-and-imp-iob-func-sdl2

So apparently something in the go package "golang.org/x/sys/windows" is incompatible with "C"

@robpike
Copy link
Contributor

robpike commented Dec 25, 2022

That stack overflow answer suggests a remedy. Did you try it?

@steowens
Copy link
Author

steowens commented Dec 25, 2022

I did try it but it created other problems. Things get flaky using golang.org/x/sys/windows in conjunction with "C". The stack overflow basically further down says that it's a matter of having libraries compiled with older compilers mixing with code compiled with up to date compilers. https://msdn.microsoft.com/en-us/library/bb531344.aspx#BK_CRT So basically stay away from packages which contain static linked code compiled by an older compiler. I just figured you might want this brought to the attention of the dev team to see if there is anything that needs to be looked at.

@robpike
Copy link
Contributor

robpike commented Dec 25, 2022

Maybe @alexbrainman has ideas. I don't know much about the Windows build.

@steowens
Copy link
Author

steowens commented Dec 25, 2022

This has happened to me on different projects so much as to render go almost unusable for Windows development at least. This project which does not even include "C" gets the same issue, here is the Golang dependency tree for the project. The problem is this is not a toy project and it kind of stinks having to verify each and every new dependency to see if it will render the project uncompilable with this issue. It's friction. It slows development and kind of erodes the value proposition that go enables you to get stuff done faster. I had to comment out every single thing in my application until I was able to chase it down to github.com/mattn/go-sqlite3. Once that dependency was gone I could compile again.

require (
	github.com/google/uuid v1.3.0
github.com/mattn/go-sqlite3 v1.14.16
	github.com/wailsapp/wails/v2 v2.2.0
	golang.org/x/crypto v0.4.0
)

require (
	github.com/leaanthony/go-ansi-parser v1.6.0 // indirect
	golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15 // indirect
)

require (
	github.com/bep/debounce v1.2.1 // indirect
	github.com/go-ole/go-ole v1.2.6 // indirect
	github.com/imdario/mergo v0.3.13 // indirect
	github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
	github.com/labstack/echo/v4 v4.9.1 // indirect
	github.com/labstack/gommon v0.4.0 // indirect
	github.com/leaanthony/gosod v1.0.3 // indirect
	github.com/leaanthony/slicer v1.6.0 // indirect
	github.com/mattn/go-colorable v0.1.13 // indirect
	github.com/mattn/go-isatty v0.0.16 // indirect
	github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
	github.com/pkg/errors v0.9.1 // indirect
	github.com/rivo/uniseg v0.2.0 // indirect
	github.com/samber/lo v1.37.0 // indirect
	github.com/tkrajina/go-reflector v0.5.6 // indirect
	github.com/valyala/bytebufferpool v1.0.0 // indirect
	github.com/valyala/fasttemplate v1.2.2 // indirect
	github.com/wailsapp/mimetype v1.4.1 // indirect
	golang.org/x/net v0.4.0 // indirect
	golang.org/x/sys v0.3.0 // indirect
	golang.org/x/text v0.5.0 // indirect
)

@mattn
Copy link
Member

mattn commented Dec 26, 2022

Related issue #51007

@seankhliao
Copy link
Member

go env output?
how did you install the go toolchain?
how did you install the gcc toolchain?
does it build if the whole thing is built from scratch (go build -a)?

@seankhliao seankhliao changed the title affected/package: cmd/link: undefined reference to __imp___iob_func on windows with import C / x/sys/windows Dec 26, 2022
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Dec 26, 2022
@seankhliao seankhliao added OS-Windows WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed compiler/runtime Issues related to the Go compiler and/or runtime. labels Dec 26, 2022
@steowens
Copy link
Author

steowens commented Dec 26, 2022

Here is a complete command line repo starting from building a new project and creating a minimal main.go file which reproduces the issue.

PS C:\Users\***\source> mkdir compileFail                                                                                                                                                                                                                                                                                                                                                                                                            
Directory: C:\Users\***\source                                                                                                                                                                                                                                                                                                                                                                                                               
Mode                 LastWriteTime         Length Name                                                                                           
----                     -------------             ------ ----                                                                                           
d-----        12/26/2022  11:03 AM                compileFail                                                                                                                                                                                                                                                                                                                                                                                      
PS C:\Users\***\source> cd .\compileFail\                                                                                                      
PS C:\Users\***\source\compileFail> go mod init compileFail                                                                                    
go: creating new go.mod: module compileFail                                                                                                      
PS C:\Users\***\source\compileFail> notepad main.go                                                                                            
PS C:\Users\***\source\compileFail> ls                                                                                                                                                                                                                                                                                                                                                                                                               
Directory: C:\Users\***\source\compileFail                                                                                                                                                                                                                                                                                                                                                                                                   
Mode                 LastWriteTime         Length Name                                                                                           
----                     -------------             ------    ----                                                                                           
-a----        12/26/2022  11:03 AM             28 go.mod                                                                                         
-a----        12/26/2022  11:05 AM             95 main.go                                                                                                                                                                                                                                                                                                                                                                                          
PS C:\Users\***\source\compileFail> go tidy                                                                                                    
go tidy: unknown command                                                                                                                         
Run 'go help' for usage.                                                                                                                         
PS C:\Users\***\source\compileFail> go mod tidy                                                                                                
go: finding module for package golang.org/x/sys/windows                                                                                          
go: found golang.org/x/sys/windows in golang.org/x/sys v0.3.0                                                                                    
PS C:\Users\***\source\compileFail> go build                                                                                                   
# compileFail                                                                                                                                    
C:\Program Files\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
 c:/program files/winlibs-x86_64-posix-seh-gcc-12.2.0-llvm-14.0.6-mingw-w64ucrt-10.0.0-r2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\***\AppData\Local\Temp\go-link-2614625705\000005.o: in function `_cgo_preinit_init':              \\_\_\runtime\cgo/gcc_libinit_windows.c:40: undefined reference to `__imp___iob_func'                                                            c:/program files/winlibs-x86_64-posix-seh-gcc-12.2.0-llvm-14.0.6-mingw-w64ucrt-10.0.0-r2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\***\AppData\Local\Temp\go-link-2614625705\000005.o: in function `x_cgo_notify_runtime_init_done': \\_\_\runtime\cgo/gcc_libinit_windows.c:105: undefined reference to `__imp___iob_func'                                                           c:/program files/winlibs-x86_64-posix-seh-gcc-12.2.0-llvm-14.0.6-mingw-w64ucrt-10.0.0-r2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\***\AppData\Local\Temp\go-link-2614625705\000005.o: in function `_cgo_beginthread':               \\_\_\runtime\cgo/gcc_libinit_windows.c:149: undefined reference to `__imp___iob_func'                                                           c:/program files/winlibs-x86_64-posix-seh-gcc-12.2.0-llvm-14.0.6-mingw-w64ucrt-10.0.0-r2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\***\AppData\Local\Temp\go-link-2614625705\000006.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              

@steowens
Copy link
Author

Here is the go.mod file and the main.go file that causes the above error:

main.go

package main

import "C"
import (
   _ "golang.org/x/sys/windows"
)

func main(){

}

go.mod

module compileFail

go 1.19

require golang.org/x/sys v0.3.0

@steowens
Copy link
Author

steowens commented Dec 26, 2022

go env

PS C:\Users\***\source\compileFail> go env                                                                                                     
set GO111MODULE=                                                                                                                                 
set GOARCH=amd64                                                                                                                                 
set GOBIN=                                                                                                                                       
set GOCACHE=C:\Users\***\AppData\Local\go-build                                                                                                
set GOENV=C:\Users\***\AppData\Roaming\go\env                                                                                                  
set GOEXE=.exe                                                                                                                                   
set GOEXPERIMENT=                                                                                                                                
set GOFLAGS=                                                                                                                                     
set GOHOSTARCH=amd64                                                                                                                             
set GOHOSTOS=windows                                                                                                                             
set GOINSECURE=                                                                                                                                  
set GOMODCACHE=C:\Users\***\go\pkg\mod                                                                                                         
set GONOPROXY=                                                                                                                                   
set GONOSUMDB=                                                                                                                                   
set GOOS=windows                                                                                                                                 
set GOPATH=C:\Users\***\go                                                                                                                     
set GOPRIVATE=                                                                                                                                   
set GOPROXY=https://proxy.golang.org,direct                                                                                                      
set GOROOT=C:\Program Files\Go                                                                                                                   
set GOSUMDB=sum.golang.org                                                                                                                       
set GOTMPDIR=                                                                                                                                    
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64                                                                                         
set GOVCS=                                                                                                                                       
set GOVERSION=go1.19.4                                                                                                                           
set GCCGO=gccgo                                                                                                                                  
set GOAMD64=v1                                                                                                                                   
set AR=ar                                                                                                                                        
set CC=gcc                                                                                                                                       
set CXX=g++                                                                                                                                      
set CGO_ENABLED=1                                                                                                                                
set GOMOD=C:\Users\***\source\compileFail\go.mod                                                                                               
set GOWORK=                                                                                                                                      
set CGO_CFLAGS=-g -O2                                                                                                                            
set CGO_CPPFLAGS=                                                                                                                                
set CGO_CXXFLAGS=-g -O2                                                                                                                          
set CGO_FFLAGS=-g -O2                                                                                                                            
set CGO_LDFLAGS=-g -O2                                                                                                                           
set PKG_CONFIG=pkg-config                                                                                                                        
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\***\AppData\Local\Temp\go-build109363636=/tmp/go-build -gno-record-gcc-switches                                                                                                               

@steowens
Copy link
Author

steowens commented Dec 26, 2022

As far as how I set things up I followed the directions from go on how to set up go, and I followed the directions from MINGW on how to set that up. I don't want to repeat that process. But if you wish to introspect the current state I would be happy to work with you on that. But in general people should not have to rebuild their entire environment every time they encounter such issues, there needs to be a more frictionless way to troubleshoot setups.
Otherwise, all I need to do as a for profit vendor of tool chains, is to throw sand in the works by publishing flawed setup directions on your open source tool chain, and leverage my corporate power to cause those links to bubble up to the top of the search results on Google, to create enough frustration among new users to steer them away from your project. Sure some will be stubborn enough to work through the frustration but critical mass is king when it comes to adoption. Critical mass has a gravitational coefficient that draws people into it's field. Who wants to work really hard to build something that nobody ends up using because friction prevented it from gaining critical mass? Where is the fun in that?
I know plenty of people with PhD's in topics no commercial company is interested in and they struggle to pay their bills doing jobs they hate because nobody is willing to pay them to do the things they love. Open source is the same way, being an expert in a stack nobody is using is like that. So adoption is important and friction kills adoption.

@seankhliao
Copy link
Member

We're not asking for your environment to be built from scratch, just the inputs for this particular program, using the invocation given above (go build -a), where:

	-a
		force rebuilding of packages that are already up-to-date.

@steowens
Copy link
Author

steowens commented Dec 26, 2022

Ah I misunderstood I built an entirely new project and thought that would be good enough. Turns out that doing what you asked
go build -a actually fixes the issue. I had to create another project anyhow to repro the error since I fixed my original project by removing references to the x/sys/windows stuff.

compileFail no longer fails to compile. I can tell you that this switch you have there really needs to bubble up to the top of search results when people encounter issues like this. Hopefully this trouble report will help that happen. Some people are good at following directions without knowing the WHY in the direction but others not so much for those of us in the latter category we really respond better to instructions when we understand the motivations behind them. I think it probably has something to do with the difference between neurotypical and neruoatypical people.

                                                                                                                                                                                                                                                                                              Mode                 LastWriteTime         Length Name                                                                                           

-a---- 12/26/2022 12:12 PM 3836812 compileFail.exe
-a---- 12/26/2022 11:06 AM 61 go.mod
-a---- 12/26/2022 11:06 AM 151 go.sum
-a---- 12/26/2022 11:06 AM 93 main.go

@seankhliao
Copy link
Member

In that case, it is related to #51007 and should get resolved in the next release as part of #47257

Closing as there's nothing else to do.

andyrzhao referenced this issue in googleapis/enterprise-certificate-proxy Sep 21, 2023
anjannath added a commit to anjannath/crc that referenced this issue Sep 26, 2023
recently windows runners in github CI was changed to pre-install
mingw 12.2.0 which broke building crc with the following error:

```
GOARCH=amd64 GOOS=windows go build -tags "containers_image_openpgp" -ldflags="-X github.com/crc-org/crc/v2/pkg/crc/version.crcVersion=2.26.0 -X github.com/crc-org/crc/v2/pkg/crc/version.ocpVersion=4.13.9 -X github.com/crc-org/crc/v2/pkg/crc/version.okdVersion=4.13.0-0.okd-2023-06-04-080300 -X github.com/crc-org/crc/v2/pkg/crc/version.podmanVersion=4.4.4 -X github.com/crc-org/crc/v2/pkg/crc/version.microshiftVersion=4.13.9 -X github.com/crc-org/crc/v2/pkg/crc/version.commitSha=46e313 " -o out/windows-amd64/crc.exe  ./cmd/crc
C:\hostedtoolcache\windows\go\1.19.13\x64\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\RUNNER~1\AppData\Local\Temp\go-link-867149281\000007.o: in function `_cgo_preinit_init':
\\_\_\runtime\cgo/gcc_libinit_windows.c:40: undefined reference to `__imp___iob_func'
C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\RUNNER~1\AppData\Local\Temp\go-link-867149281\000007.o: in function `x_cgo_notify_runtime_init_done':
\\_\_\runtime\cgo/gcc_libinit_windows.c:105: undefined reference to `__imp___iob_func'
C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\RUNNER~1\AppData\Local\Temp\go-link-867149281\000007.o: in function `_cgo_beginthread':
\\_\_\runtime\cgo/gcc_libinit_windows.c:149: undefined reference to `__imp___iob_func'
C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\RUNNER~1\AppData\Local\Temp\go-link-867149281\000008.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

mingw32-make: *** [Makefile:105: out/windows-amd64/crc.exe] Error 1
Error: Process completed with exit code 1.
```
this should be fixed in golang 1.20 as per the issue: golang/go#57455
anjannath added a commit to anjannath/crc that referenced this issue Sep 26, 2023
recently windows runners in github CI was changed to pre-install
mingw 12.2.0 which broke building crc with the following error:

```
GOARCH=amd64 GOOS=windows go build -tags "containers_image_openpgp" -ldflags="-X github.com/crc-org/crc/v2/pkg/crc/version.crcVersion=2.26.0 -X github.com/crc-org/crc/v2/pkg/crc/version.ocpVersion=4.13.9 -X github.com/crc-org/crc/v2/pkg/crc/version.okdVersion=4.13.0-0.okd-2023-06-04-080300 -X github.com/crc-org/crc/v2/pkg/crc/version.podmanVersion=4.4.4 -X github.com/crc-org/crc/v2/pkg/crc/version.microshiftVersion=4.13.9 -X github.com/crc-org/crc/v2/pkg/crc/version.commitSha=46e313 " -o out/windows-amd64/crc.exe  ./cmd/crc
C:\hostedtoolcache\windows\go\1.19.13\x64\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\RUNNER~1\AppData\Local\Temp\go-link-867149281\000007.o: in function `_cgo_preinit_init':
\\_\_\runtime\cgo/gcc_libinit_windows.c:40: undefined reference to `__imp___iob_func'
C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\RUNNER~1\AppData\Local\Temp\go-link-867149281\000007.o: in function `x_cgo_notify_runtime_init_done':
\\_\_\runtime\cgo/gcc_libinit_windows.c:105: undefined reference to `__imp___iob_func'
C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\RUNNER~1\AppData\Local\Temp\go-link-867149281\000007.o: in function `_cgo_beginthread':
\\_\_\runtime\cgo/gcc_libinit_windows.c:149: undefined reference to `__imp___iob_func'
C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\RUNNER~1\AppData\Local\Temp\go-link-867149281\000008.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

mingw32-make: *** [Makefile:105: out/windows-amd64/crc.exe] Error 1
Error: Process completed with exit code 1.
```
this should be fixed in golang 1.20 as per the issue: golang/go#57455
@golang golang locked and limited conversation to collaborators Dec 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge OS-Windows WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants