Go can't find GCC with go1.11.1 on Windows


#1

See the PR here https://github.com/sourcegraph/go-langserver/pull/329 and example failing build https://travis-ci.org/sourcegraph/go-langserver/jobs/440629993

The key line here is

$ go test -timeout 5m -race ./...
#runtime/cgo
exec: "gcc": executable file not found in %PATH%

Do I need to adjust the PATH? Is there a known recipe for getting gcc onto the system (via choco I guess)? cgo is not uncommon, I’d suspect this would be a required dependency for building go.

Additionally I had issues with line endings. See the previous commits in the PR. The checkout is converting line endings to CRLF even though the gitattributes on the converted files have unset text. A resorted to using sed to fix the line endings.


Files in checkout have EOL changed from LF to CRLF
#2

Try running choco install -y mingw before go test


#3

Thanks for the tip @ameer1234567890

@keegancsmith if adding mingw does work, let me know and I will add it to the standard image.

Regarding :

Additionally I had issues with line endings. See the previous commits in the PR. The checkout is converting line endings to CRLF even though the gitattributes on the converted files have unset text. A resorted to using sed to fix the line endings.

Could you open another topic so we can track this?


#4

@josh I think mingw should be added since gcc can be considered necessary even on Windows.


#5

I got it to work by installing mingw and adding it to the PATH. For reference I added

before_install:
  # Go1.11 requires GCC to run go test
  - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then choco install -y mingw; export PATH=/c/tools/mingw64/bin:"$PATH"; fi

You can view my updated PR for a passing windows travis build.

Note: We currently have appveyor integrated, and it only takes 2min6s to run our CI. However, windows and travis took 8minutes. I am guessing a large part of that is needing to install mingw, so it being part of the base image would be great.

I filed Files in checkout have EOL changed from LF to CRLF about the line endings.


#6

I would also love to have gcc as part of the base Windows image. I was installing mingw through chocolatey as you’ve mentioned above, but that stopped working once I added secret environment variables due to Choco install hangs forever.

Thanks for adding Windows support, hope this can be resolved soon!


#7

Hi @keegancsmith

I added mingw to our recently updated images, cant you let me know if things are running a bit faster for you?

Thanks for the feedback @benburwell, we are working on a better long term solution and hope to have more news on this soon.


#8

Thanks! I disabled installing mingw and ran a build. It worked! I think we can regard this issue as solved!

As a side note: It is still much slower, especially for go1.11 https://travis-ci.org/sourcegraph/go-langserver/builds/442515109

I realise this is still in preview and it may also be specific to our tests running on windows/etc (this project has some heavy integration testing which exercises IDE/build tooling). We do run this in appveyor as well if you want to compare, but they don’t seem to report run times. https://ci.appveyor.com/project/sourcegraph/go-langserver/builds/19569137 But if memory serves it doesn’t take 7min on appveyor (which is also go1.11, but not go1.11.1)

I think the fact that go1.11 requires GCC on the path and not go1.10 is probably pointing to an important difference in something that changed in Go. My best guess is we run our tests with the “-race” flag which I know requires recompiling. Maybe something changed in go which required recompiling GOROOT or the recompiling became more heavy (and required CGO).


#9

#10

Thanks for the update!


#11

I checked the Appveyor build you linked to and it does run a lot quicker, just over 1 min.

-race could be the reason, but I’m not entirely sure sorry.