Skip to content

[cgo]go build: realgcc.exe: fatal error: no input files compilation terminated. #20172

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

Closed
codehz opened this issue Apr 29, 2017 · 1 comment
Closed

Comments

@codehz
Copy link

codehz commented Apr 29, 2017

Please answer these questions before submitting your issue. Thanks!

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

go version go1.8.1 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\CodeHz\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 -fdebug-prefix-map=C:\Users\CodeHz\AppData\Local\Temp\go-build152150871=/tmp/go-build -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" "-lopengl32" "-lopengl32"

What did you do?

go get github.com/go-gl/gl/v4.5-core/gl

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

What did you expect to see?

Install successful

What did you see instead?

# github.com/go-gl/gl/v4.5-core/gl
realgcc.exe: fatal error: no input files
compilation terminated.

ANY project contain cgo would not build.
For detect problem I exec below command in cmd

> cd C:\Users\CodeHz\go\src\github.com\go-gl\gl\v4.5-core\gl
> go build -work -x
WORK=C:\Users\CodeHz\AppData\Local\Temp\go-build075421998
mkdir -p $WORK\github.com\go-gl\gl\v4.5-core\gl\_obj\
mkdir -p $WORK\github.com\go-gl\gl\v4.5-core\
cd C:\Users\CodeHz\go\src\github.com\go-gl\gl\v4.5-core\gl
CGO_LDFLAGS="\"-g\"" "\"-O2\"" "\"-lopengl32\"" "\"-lopengl32\"" "-lopengl32" "-lopengl32" "C:\\Go\\pkg\\tool\\windows_amd64\\cgo.exe" -objdir "C:\\Users\\CodeHz\\AppData\\Local\\Temp\\go-build075421998\\github.com\\go-gl\\gl\\v4.5-core\\gl\\_obj\\" -importpath github.com/go-gl/gl/v4.5-core/gl -- -I "C:\\Users\\CodeHz\\AppData\\Local\\Temp\\go-build075421998\\github.com\\go-gl\\gl\\v4.5-core\\gl\\_obj\\" -g -O2 -DTAG_WINDOWS conversions.go debug.go package.go procaddr.go
# github.com/go-gl/gl/v4.5-core/gl
realgcc.exe: fatal error: no input files
compilation terminated.

And C:\Users\CodeHz\AppData\Local\Temp\go-build075421998\github.com\go-gl\gl\v4.5-core\_obj is empty.
But if I removed -I "C:\\Users\\CodeHz\\AppData\\Local\\Temp\\go-build075421998\\github.com\\go-gl\\gl\\v4.5-core\\gl\\_obj\\" in the last command,

> "C:\\Go\\pkg\\tool\\windows_amd64\\cgo.exe" -objdir "C:\\Users\\CodeHz\\AppData\\Local\\Temp\\go-build075421998\\github.com\\go-gl\\gl\\v4.5-core\\gl\\_obj\\" -importpath github.com/go-gl/gl/v4.5-core/gl -- -g -O2 -DTAG_WINDOWS conversions.go debug.go package.go procaddr.go

And it can build the obj file.
DEBUG:

>"C:\\Go\\pkg\\tool\\windows_amd64\\cgo.exe" -debug-gcc -objdir "C:\\Users\\CodeHz\\AppData\\Local\\Temp\\go-build075421998\\github.com\\go-gl\\gl\\v4.5-core\\gl\\_obj\\" -importpath github.com/go-gl/gl/v4.5-core/gl -- -I "C:\\Users\\CodeHz\\AppData\\Local\\Temp\\go-build075421998\\github.com\\go-gl\\gl\\v4.5-core\\gl\\_obj\\" -g -O2 -DTAG_WINDOWS conversions.go debug.go package.go procaddr.go
$ gcc -E -dM -xc -m64 -I C:\\Users\\CodeHz\\AppData\\Local\\Temp\\go-build075421998\\github.com\\go-gl\\gl\\v4.5-core\\gl\\_obj\ -g -O2 -DTAG_WINDOWS - <<EOF
#line 12 "C:\\Users\\CodeHz\\go\\src\\github.com\\go-gl\\gl\\v4.5-core\\gl\\conversions.go"
 #include <stdlib.h>

#line 1 "cgo-generated-wrapper"

#line 1 "cgo-builtin-prolog"
#include <stddef.h> /* for ptrdiff_t and size_t below */

/* Define intgo when compiling with GCC.  */
typedef ptrdiff_t intgo;

typedef struct { char *p; intgo n; } _GoString_;
typedef struct { char *p; intgo n; intgo c; } _GoBytes_;
_GoString_ GoString(char *p);
_GoString_ GoStringN(char *p, int l);
_GoBytes_ GoBytes(void *p, int n);
char *CString(_GoString_);
void *CBytes(_GoBytes_);
void *_CMalloc(size_t);
EOF
realgcc.exe: fatal error: no input files
compilation terminated.
realgcc.exe: fatal error: no input files
compilation terminated.
@codehz
Copy link
Author

codehz commented Apr 29, 2017

Fixed.

> where gcc
C:\Program Files\Haskell Platform\8.0.2\mingw\bin\gcc.exe  //<- gcc 5.2 and missing some feature
E:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev2\mingw64\bin\gcc.exe // <- gcc 6.3.0 and worked

I just adjust the order of PATH

@codehz codehz closed this as completed Apr 29, 2017
@golang golang locked and limited conversation to collaborators Apr 29, 2018
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

2 participants