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/go: cannot build go binary on Windows #21169

Closed
nedn opened this issue Jul 25, 2017 · 2 comments
Closed

cmd/go: cannot build go binary on Windows #21169

nedn opened this issue Jul 25, 2017 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows

Comments

@nedn
Copy link

nedn commented Jul 25, 2017

Please answer these questions before submitting your issue. Thanks!

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

go1.8.3 windows/amd64

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

set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\admin\projects\chromium\src\third_party\catapult\web_page_replay_go;C:\Users\admin\go
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -gno-record-gcc-switches
set CXX=g++
set CGO_ENABLED=1
set PKG_CONFIG=pkg-config
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2

What did you do?

Install https://mingw-w64.org/doku.php
git clone https://github.com/catapult-project/catapult (in this case I already have this folder in C:\Users\admin\projects\chromium\src\third_party)
cd web_page_replay_go
Follows the instructions in https://github.com/catapult-project/catapult/blob/master/web_page_replay_go/README to fetch required dependencies.

Run go build src\wpr.go to build wpr-go binary.

What did you expect to see?

Be able to build wpr.exe binary.

What did you see instead?

PS C:\Users\admin\projects\chromium\src\third_party\catapult\web_page_replay_go> go build .\src\wpr.go
# command-line-arguments
C:\Go\pkg\tool\windows_amd64\link.exe: running g++ failed: exit status 1
C:\Users\admin\AppData\Local\Temp\go-link-156760755\go.o: file not recognized: File format not recognized
collect2: ld returned 1 exit status
@ALTree ALTree changed the title Cannot build go binary on Windows cmd/go: cannot build go binary on Windows Jul 25, 2017
@ALTree ALTree added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows labels Jul 25, 2017
@sajattack
Copy link

sajattack commented Jul 26, 2017

I was not able to reproduce this bug.

C:\Users\Paul>go version
go version go1.8.3 windows/amd64

C:\Users\Paul>go env
set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\Paul\go
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
set PKG_CONFIG=pkg-config
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2

C:\Users\Paul>git clone https://github.com/catapult-project/catapult
Cloning into 'catapult'...
remote: Counting objects: 127745, done.
rRemote: Total 127745 (delta 0), reused 0 (delta 0), pack-reused 127745eceiving
Receiving objects: 100% (127745/127745), 264.99 MiB | 3.92 MiB/s, done.

Resolving deltas: 100% (96661/96661), done.
Checking connectivity... done
Checking out files: 100% (8903/8903), done.

C:\Users\Paul>go get github.com/codegangsta/cli

C:\Users\Paul\go\catapult\web_page_replay_go>go build src/wpr.go

C:\Users\Paul\go\catapult\web_page_replay_go>ls
deterministic.js  OWNERS  README  src  wpr.exe  wpr_cert.pem  wpr_key.pem

C:\Users\Paul\go\catapult\web_page_replay_go>wpr.exe
NAME:
   wpr.exe - Web Page Replay

USAGE:

   wpr.exe [installroot|removeroot] [options]
   wpr.exe [record|replay] [options] archive_file

   Before: Install a test root CA.
     $ GOPATH=$PWD go run src/wpr.go installroot

   To record web pages:
     1. Start this program in record mode.
        $ GOPATH=$PWD go run src/wpr.go record archive.json
     2. Load the web pages you want to record in a web browser. It i
to
        clear browser caches before this so that all subresources ar
        from the network.
     3. Kill the process to stop recording.

   To replay web pages:
     1. Start this program in replay mode with a previously recorded
        $ GOPATH=$PWD go run src/wpr.go replay archive.json
     2. Load recorded pages in a web browser. A 404 will be served f
 or
        resources not in the recorded archive.

   After: Remove the test root CA.
     $ GOPATH=$PWD go run src/wpr.go removeroot

COMMANDS:
     record       Record web pages to an archive
     replay       Replay a previously-recorded web page archive
     installroot  Install a test root CA
     removeroot   Remove a test root CA
     convert      Convert a legacy format to the new format
     help, h      Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h  show help

C:\Users\Paul\go\catapult\web_page_replay_go>

@nedn
Copy link
Author

nedn commented Jul 26, 2017

My colleague cannot reproduce this either. so probably my windows instance has some problem.

We currently find a way to work around this by remove go libs that are not purely go. So this is not a blocker for us anymore. Thanks for taking a look anyway!

@nedn nedn closed this as completed Jul 26, 2017
@golang golang locked and limited conversation to collaborators Jul 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Projects
None yet
Development

No branches or pull requests

4 participants