Is gcc needed when linking as well? [cgo] [windows]


I want to use go-sqlite3 package and I’m using a Windows 10 (64-bit) development environment. From the project docs:

go-sqlite3 is cgo package. If you want to build your app using go-sqlite3, you need gcc. However, if you install go-sqlite3 with go install, you don’t need gcc to build your app anymore.

So I installed MingW-w64 and did go install

Under GOPATH\pkg\windows_amd64\\mattn I can see go-sqlite3.a

When I tried to build my app that uses the go-sqlite3 package I now get the following error:
c:\go\pkg\tool\windows_amd64\link.exe: running gcc failed: exec: "gcc": executable file not found in %PATH%

please note that I explicitly removed gcc from %PATH%

My question is more to do with how the linking works than to argue the claim that gcc is not needed anymore after go install


I’d say those docs are wrong. If you use a package that uses cgo, you need gcc installed.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.