Skip to content

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

Closed
@codehz

Description

@codehz

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions