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: incompatible with i386:x86-64 output #12448

Closed
mattn opened this issue Sep 2, 2015 · 6 comments
Closed

cmd/link: incompatible with i386:x86-64 output #12448

mattn opened this issue Sep 2, 2015 · 6 comments

Comments

@mattn
Copy link
Member

mattn commented Sep 2, 2015

build app with linking go-sqlite3.

c:\go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/bin/ld.exe: i386 architecture of input file `C:\Users\mattn\AppData\Local\Temp\go-link-872546559/000000.o' is incompatible with i386:x86-64 output
collect2.exe: error: ld returned 1 exit status

I'm on windows7 x86_64. Using head of master branch.

@ianlancetaylor ianlancetaylor changed the title cgo: incompatible with i386:x86-64 output cmd/cgo: incompatible with i386:x86-64 output Sep 2, 2015
@ianlancetaylor ianlancetaylor changed the title cmd/cgo: incompatible with i386:x86-64 output cmd/link: incompatible with i386:x86-64 output Sep 2, 2015
@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Sep 2, 2015
@ianlancetaylor
Copy link
Contributor

What is GOARCH set to?

@ianlancetaylor
Copy link
Contributor

E.g., go env GOARCH

@minux
Copy link
Member

minux commented Sep 2, 2015 via email

@mattn
Copy link
Member Author

mattn commented Sep 2, 2015

@ianlancetaylor

set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=c:/dev/go
set GORACE=
set GOROOT=c:\go
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GO15VENDOREXPERIMENT=
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1

@minux
no. just building x86_64 app. if not link to go-sqlite3, it doesn't occur.

C:\Users\mattn>gcc --version
gcc (x86_64-posix-sjlj, built by strawberryperl.com project) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@ianlancetaylor
Copy link
Contributor

@mattn You are somehow linking against a version of go-sqlite built using GOARCH=386, which fails because you are using GOARCH=amd64. This normally shouldn't happen, as the different GOARCH value should store the package in a different location. Can you run go clean go-sqlite3 and then show us the output of go install -x go-sqlite3. Perhaps that will suggest something.

@mattn
Copy link
Member Author

mattn commented Sep 3, 2015

Ah, I figure out. I put syso file in the directory. It contains windows resource objects.
Sorry.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants