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/cgo: gcc did not produce error at completed:1 #41261

Closed
Burton-kun opened this issue Sep 7, 2020 · 5 comments
Closed

cmd/cgo: gcc did not produce error at completed:1 #41261

Burton-kun opened this issue Sep 7, 2020 · 5 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Milestone

Comments

@Burton-kun
Copy link

Burton-kun commented Sep 7, 2020

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

$ go version
go version go1.15.1 windows/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GOOS=windows
GOARCH=amd64

What did you do?

I try to compile a golang project in which I'm using "github.com/mattn/go-sqlite3" library

What did you expect to see?

A complete compile.

What did you see instead?

# github.com/mattn/go-sqlite3
gcc did not produce error at completed:1
on input:

#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;

#define GO_CGO_GOSTRING_TYPEDEF
typedef struct { const 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);

__attribute__ ((unused))
static size_t _GoStringLen(_GoString_ s) { return (size_t)s.n; }

__attribute__ ((unused))
static const char *_GoStringPtr(_GoString_ s) { return s.p; }
#line 8 "C:\\Users\\sanfe\\Desktop\\cms\\vendor\\github.com\\mattn\\go-sqlite3\\backup.go"

#ifndef USE_LIBSQLITE3
#include <sqlite3-binding.h>
#else
#include <sqlite3.h>
#endif
#include <stdlib.h>

#line 1 "cgo-generated-wrapper"
#line 1 "not-declared"
void __cgo_f_1_1(void) { __typeof__(CString) *__cgo_undefined__1; }
#line 1 "not-type"
void __cgo_f_1_2(void) { CString *__cgo_undefined__2; }
#line 1 "not-int-const"
void __cgo_f_1_3(void) { enum { __cgo_undefined__3 = (CString)*1 }; }
#line 1 "not-num-const"
void __cgo_f_1_4(void) { static const double __cgo_undefined__4 = (CString); }
#line 1 "not-str-lit"
void __cgo_f_1_5(void) { static const char __cgo_undefined__5[] = (CString); }
#line 2 "not-declared"
void __cgo_f_2_1(void) { __typeof__(free) *__cgo_undefined__1; }
#line 2 "not-type"
void __cgo_f_2_2(void) { free *__cgo_undefined__2; }
#line 2 "not-int-const"
void __cgo_f_2_3(void) { enum { __cgo_undefined__3 = (free)*1 }; }
#line 2 "not-num-const"
void __cgo_f_2_4(void) { static const double __cgo_undefined__4 = (free); }
#line 2 "not-str-lit"
void __cgo_f_2_5(void) { static const char __cgo_undefined__5[] = (free); }
#line 3 "not-declared"
void __cgo_f_3_1(void) { __typeof__(int) *__cgo_undefined__1; }
#line 3 "not-type"
void __cgo_f_3_2(void) { int *__cgo_undefined__2; }
#line 3 "not-int-const"
void __cgo_f_3_3(void) { enum { __cgo_undefined__3 = (int)*1 }; }
#line 3 "not-num-const"
void __cgo_f_3_4(void) { static const double __cgo_undefined__4 = (int); }
#line 3 "not-str-lit"
void __cgo_f_3_5(void) { static const char __cgo_undefined__5[] = (int); }
#line 4 "not-declared"
void __cgo_f_4_1(void) { __typeof__(sqlite3_backup) *__cgo_undefined__1; }
#line 4 "not-type"
void __cgo_f_4_2(void) { sqlite3_backup *__cgo_undefined__2; }
#line 4 "not-int-const"
void __cgo_f_4_3(void) { enum { __cgo_undefined__3 = (sqlite3_backup)*1 }; }
#line 4 "not-num-const"
void __cgo_f_4_4(void) { static const double __cgo_undefined__4 = (sqlite3_backup); }
#line 4 "not-str-lit"
void __cgo_f_4_5(void) { static const char __cgo_undefined__5[] = (sqlite3_backup); }
#line 5 "not-declared"
void __cgo_f_5_1(void) { __typeof__(sqlite3_backup_finish) *__cgo_undefined__1; }
#line 5 "not-type"
void __cgo_f_5_2(void) { sqlite3_backup_finish *__cgo_undefined__2; }
#line 5 "not-int-const"
void __cgo_f_5_3(void) { enum { __cgo_undefined__3 = (sqlite3_backup_finish)*1 }; }
#line 5 "not-num-const"
void __cgo_f_5_4(void) { static const double __cgo_undefined__4 = (sqlite3_backup_finish); }
#line 5 "not-str-lit"
void __cgo_f_5_5(void) { static const char __cgo_undefined__5[] = (sqlite3_backup_finish); }
#line 6 "not-declared"
void __cgo_f_6_1(void) { __typeof__(sqlite3_backup_init) *__cgo_undefined__1; }
#line 6 "not-type"
void __cgo_f_6_2(void) { sqlite3_backup_init *__cgo_undefined__2; }
#line 6 "not-int-const"
void __cgo_f_6_3(void) { enum { __cgo_undefined__3 = (sqlite3_backup_init)*1 }; }
#line 6 "not-num-const"
void __cgo_f_6_4(void) { static const double __cgo_undefined__4 = (sqlite3_backup_init); }
#line 6 "not-str-lit"
void __cgo_f_6_5(void) { static const char __cgo_undefined__5[] = (sqlite3_backup_init); }
#line 7 "not-declared"
void __cgo_f_7_1(void) { __typeof__(sqlite3_backup_pagecount) *__cgo_undefined__1; }
#line 7 "not-type"
void __cgo_f_7_2(void) { sqlite3_backup_pagecount *__cgo_undefined__2; }
#line 7 "not-int-const"
void __cgo_f_7_3(void) { enum { __cgo_undefined__3 = (sqlite3_backup_pagecount)*1 }; }
#line 7 "not-num-const"
void __cgo_f_7_4(void) { static const double __cgo_undefined__4 = (sqlite3_backup_pagecount); }
#line 7 "not-str-lit"
void __cgo_f_7_5(void) { static const char __cgo_undefined__5[] = (sqlite3_backup_pagecount); }
#line 8 "not-declared"
void __cgo_f_8_1(void) { __typeof__(sqlite3_backup_remaining) *__cgo_undefined__1; }
#line 8 "not-type"
void __cgo_f_8_2(void) { sqlite3_backup_remaining *__cgo_undefined__2; }
#line 8 "not-int-const"
void __cgo_f_8_3(void) { enum { __cgo_undefined__3 = (sqlite3_backup_remaining)*1 }; }
#line 8 "not-num-const"
void __cgo_f_8_4(void) { static const double __cgo_undefined__4 = (sqlite3_backup_remaining); }
#line 8 "not-str-lit"
void __cgo_f_8_5(void) { static const char __cgo_undefined__5[] = (sqlite3_backup_remaining); }
#line 9 "not-declared"
void __cgo_f_9_1(void) { __typeof__(sqlite3_backup_step) *__cgo_undefined__1; }
#line 9 "not-type"
void __cgo_f_9_2(void) { sqlite3_backup_step *__cgo_undefined__2; }
#line 9 "not-int-const"
void __cgo_f_9_3(void) { enum { __cgo_undefined__3 = (sqlite3_backup_step)*1 }; }
#line 9 "not-num-const"
void __cgo_f_9_4(void) { static const double __cgo_undefined__4 = (sqlite3_backup_step); }
#line 9 "not-str-lit"
void __cgo_f_9_5(void) { static const char __cgo_undefined__5[] = (sqlite3_backup_step); }
#line 1 "completed"
int __cgo__1 = __cgo__2;

full error output:
gcc: unrecognized option `-std=gnu99'
cc1.exe: Invalid option `64'
cc1.exe: warning: `-gdwarf-2' not supported by this configuration of GCC
cc1.exe: Invalid option `-Wno-deprecated-declarations'
cc1.exe: Invalid option `-fno-stack-protector'
not-type: In function `__cgo_f_1_2':
not-type:1: `__cgo_undefined__2' undeclared (first use in this function)
not-type:1: (Each undeclared identifier is reported only once
not-type:1: for each function it appears in.)
not-int-const: In function `__cgo_f_1_3':
not-int-const:1: invalid operands to binary *
not-int-const:1: enumerator value for `__cgo_undefined__3' not integer constant
not-num-const: In function `__cgo_f_1_4':
not-num-const:1: incompatible types in initialization
not-num-const:1: initializer element is not constant
not-str-lit: In function `__cgo_f_1_5':
not-str-lit:1: invalid initializer
not-type: In function `__cgo_f_2_2':
not-type:2: `__cgo_undefined__2' undeclared (first use in this function)
not-int-const: In function `__cgo_f_2_3':
not-int-const:2: invalid operands to binary *
not-int-const:2: enumerator value for `__cgo_undefined__3' not integer constant
not-num-const: In function `__cgo_f_2_4':
not-num-const:2: incompatible types in initialization
not-num-const:2: initializer element is not constant
not-str-lit: In function `__cgo_f_2_5':
not-str-lit:2: invalid initializer
not-int-const: In function `__cgo_f_3_3':
not-int-const:3: invalid type argument of `unary *'
not-int-const:3: enumerator value for `__cgo_undefined__3' not integer constant
not-num-const: In function `__cgo_f_3_4':
not-num-const:3: parse error before `;'
not-int-const: In function `__cgo_f_4_3':
not-int-const:4: invalid type argument of `unary *'
not-int-const:4: enumerator value for `__cgo_undefined__3' not integer constant
not-num-const: In function `__cgo_f_4_4':
not-num-const:4: parse error before `;'
not-type: In function `__cgo_f_5_2':
not-type:5: `__cgo_undefined__2' undeclared (first use in this function)
not-int-const: In function `__cgo_f_5_3':
not-int-const:5: invalid operands to binary *
not-int-const:5: enumerator value for `__cgo_undefined__3' not integer constant
not-num-const: In function `__cgo_f_5_4':
not-num-const:5: incompatible types in initialization
not-num-const:5: initializer element is not constant
not-str-lit: In function `__cgo_f_5_5':
not-str-lit:5: invalid initializer
not-type: In function `__cgo_f_6_2':
not-type:6: `__cgo_undefined__2' undeclared (first use in this function)
not-int-const: In function `__cgo_f_6_3':
not-int-const:6: invalid operands to binary *
not-int-const:6: enumerator value for `__cgo_undefined__3' not integer constant
not-num-const: In function `__cgo_f_6_4':
not-num-const:6: incompatible types in initialization
not-num-const:6: initializer element is not constant
not-str-lit: In function `__cgo_f_6_5':
not-str-lit:6: invalid initializer
not-type: In function `__cgo_f_7_2':
not-type:7: `__cgo_undefined__2' undeclared (first use in this function)
not-int-const: In function `__cgo_f_7_3':
not-int-const:7: invalid operands to binary *
not-int-const:7: enumerator value for `__cgo_undefined__3' not integer constant
not-num-const: In function `__cgo_f_7_4':
not-num-const:7: incompatible types in initialization
not-num-const:7: initializer element is not constant
not-str-lit: In function `__cgo_f_7_5':
not-str-lit:7: invalid initializer
not-type: In function `__cgo_f_8_2':
not-type:8: `__cgo_undefined__2' undeclared (first use in this function)
not-int-const: In function `__cgo_f_8_3':
not-int-const:8: invalid operands to binary *
not-int-const:8: enumerator value for `__cgo_undefined__3' not integer constant
not-num-const: In function `__cgo_f_8_4':
not-num-const:8: incompatible types in initialization
not-num-const:8: initializer element is not constant
not-str-lit: In function `__cgo_f_8_5':
not-str-lit:8: invalid initializer
not-type: In function `__cgo_f_9_2':
not-type:9: `__cgo_undefined__2' undeclared (first use in this function)
not-int-const: In function `__cgo_f_9_3':
not-int-const:9: invalid operands to binary *
not-int-const:9: enumerator value for `__cgo_undefined__3' not integer constant
not-num-const: In function `__cgo_f_9_4':
not-num-const:9: incompatible types in initialization
not-num-const:9: initializer element is not constant
not-str-lit: In function `__cgo_f_9_5':
not-str-lit:9: invalid initializer
completed: At top level:
completed:1: `__cgo__2' undeclared here (not in a function)
@ianlancetaylor
Copy link
Member

These are strange errors to see:

gcc: unrecognized option `-std=gnu99'
cc1.exe: Invalid option `64'
cc1.exe: warning: `-gdwarf-2' not supported by this configuration of GCC
cc1.exe: Invalid option `-Wno-deprecated-declarations'
cc1.exe: Invalid option `-fno-stack-protector'

What is the complete output of go env? For some reason you only listed a couple of lines above.

@ianlancetaylor ianlancetaylor changed the title Build and import issues with gcc cmd/cgo: gcc did not produce error at completed:1 Sep 7, 2020
@ianlancetaylor ianlancetaylor added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows labels Sep 7, 2020
@ianlancetaylor ianlancetaylor added this to the Go1.16 milestone Sep 7, 2020
@Burton-kun
Copy link
Author

Burton-kun commented Sep 7, 2020

These are strange errors to see:

gcc: unrecognized option `-std=gnu99'
cc1.exe: Invalid option `64'
cc1.exe: warning: `-gdwarf-2' not supported by this configuration of GCC
cc1.exe: Invalid option `-Wno-deprecated-declarations'
cc1.exe: Invalid option `-fno-stack-protector'

What is the complete output of go env? For some reason you only listed a couple of lines above.

The complete output:

go env Output
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\user\AppData\Local\go-build
set GOENV=C:\Users\user\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\user\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\user\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -fmessage-length=0 -fdebug-prefix-map=C:\Users\user\AppData\Local\Temp\go-build466706590=/tmp/go-build -gno-record-gcc-switches

@ianlancetaylor
Copy link
Member

Thanks. What is the output of gcc -v?

@Burton-kun
Copy link
Author

Here you go:

$ gcc -v
Reading specs from C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\..\lib\gcc-lib\i586-cygwin32\egcs-2.91.57\specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)

@ianlancetaylor
Copy link
Member

GCC version egcs-2.91.57 was released in 1998, more than 20 years ago. It would be nice if Go worked with such an old release, but it's not very surprising that it doesn't. You need to update your C compiler.

I'm going to close this issue since we aren't going to go to any extra work to support such an old C compiler. Sorry.

@golang golang locked and limited conversation to collaborators Sep 7, 2021
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

3 participants