You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ go build bug.go
$ CGO_CFLAGS="-O0" go build bug.go
$ CGO_CFLAGS="-Os" go build bug.go
What did you expect to see?
Three successful builds
What did you see instead?
Two successful builds, the third build fails with
# command-line-arguments
./bug.go:24:8: error: enumerator value for '__cgo_enum__0' is not an integer constant
./bug.go:27:8: error: enumerator value for '__cgo_enum__2' is not an integer constant
./bug.go:30:2: error: initializer element is not constant
./bug.go:30:2: error: (near initialization for '__cgodebug_data[0]')
./bug.go:32:2: error: initializer element is not constant
./bug.go:32:2: error: (near initialization for '__cgodebug_data[2]')
Additional information
gcc version 4.9.3 (GCC)
A successful build and a failing build with -x:
$ go build -x bug.go
WORK=/tmp/go-build161870404
mkdir -p $WORK/command-line-arguments/_obj/
mkdir -p $WORK/
cd /tmp
CGO_LDFLAGS="-g" "-O2" /usr/lib/go/pkg/tool/linux_amd64/cgo -objdir ./go-build161870404/command-line-arguments/_obj/ -importpath command-line-arguments -- -I ./go-build161870404/command-line-arguments/_obj/ bug.go
gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -I ./go-build161870404/command-line-arguments/_obj/ -g -O2 -o ./go-build161870404/command-line-arguments/_obj/_cgo_main.o -c ./go-build161870404/command-line-arguments/_obj/_cgo_main.c
gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -I ./go-build161870404/command-line-arguments/_obj/ -g -O2 -o ./go-build161870404/command-line-arguments/_obj/_cgo_export.o -c ./go-build161870404/command-line-arguments/_obj/_cgo_export.c
gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -I ./go-build161870404/command-line-arguments/_obj/ -g -O2 -o ./go-build161870404/command-line-arguments/_obj/bug.cgo2.o -c ./go-build161870404/command-line-arguments/_obj/bug.cgo2.c
gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -o ./go-build161870404/command-line-arguments/_obj/_cgo_.o ./go-build161870404/command-line-arguments/_obj/_cgo_main.o ./go-build161870404/command-line-arguments/_obj/_cgo_export.o ./go-build161870404/command-line-arguments/_obj/bug.cgo2.o -g -O2
/usr/lib/go/pkg/tool/linux_amd64/cgo -objdir ./go-build161870404/command-line-arguments/_obj/ -dynpackage udp -dynimport ./go-build161870404/command-line-arguments/_obj/_cgo_.o -dynout ./go-build161870404/command-line-arguments/_obj/_cgo_import.go
cd $WORK
gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -no-pie -c trivial.c
cd /tmp
gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -o ./go-build161870404/command-line-arguments/_obj/_all.o ./go-build161870404/command-line-arguments/_obj/_cgo_export.o ./go-build161870404/command-line-arguments/_obj/bug.cgo2.o -g -O2 -Wl,-r -nostdlib -Wl,--build-id=none
/usr/lib/go/pkg/tool/linux_amd64/compile -o ./go-build161870404/command-line-arguments.a -trimpath ./go-build161870404 -p command-line-arguments -buildid ccf8c09685ebb4ea37cf7276dea17de98672bb26 -D _/tmp -I ./go-build161870404 -pack ./go-build161870404/command-line-arguments/_obj/_cgo_gotypes.go ./go-build161870404/command-line-arguments/_obj/bug.cgo1.go ./go-build161870404/command-line-arguments/_obj/_cgo_import.go
pack r ./go-build161870404/command-line-arguments.a ./go-build161870404/command-line-arguments/_obj/_all.o # internal
$ CGO_CFLAGS="-Os" go build -x bug.go
WORK=/tmp/go-build888932299
mkdir -p $WORK/command-line-arguments/_obj/
mkdir -p $WORK/
cd /tmp
CGO_LDFLAGS="-g" "-O2" /usr/lib/go/pkg/tool/linux_amd64/cgo -objdir ./go-build888932299/command-line-arguments/_obj/ -importpath command-line-arguments -- -I ./go-build888932299/command-line-arguments/_obj/ -Os bug.go
# command-line-arguments
./bug.go:24:8: error: enumerator value for '__cgo_enum__0' is not an integer constant
./bug.go:27:8: error: enumerator value for '__cgo_enum__2' is not an integer constant
./bug.go:30:2: error: initializer element is not constant
./bug.go:30:2: error: (near initialization for '__cgodebug_data[0]')
./bug.go:32:2: error: initializer element is not constant
./bug.go:32:2: error: (near initialization for '__cgodebug_data[2]')
The text was updated successfully, but these errors were encountered:
With optimizations enabled, seccomp fails to compile with errors like:
error: enumerator value for '__cgo_enum__0' is not an integer constant
This is due to golang/go#14669.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.6 linux/amd64
What operating system and processor architecture are you using (
go env
)?GOHOSTARCH="amd64"
GOHOSTOS="linux"
What did you do?
(Use play.golang.org to provide a runnable example, if possible.)
bug.go: http://play.golang.org/p/buelTjtxyA
What did you expect to see?
Three successful builds
What did you see instead?
Two successful builds, the third build fails with
Additional information
gcc version 4.9.3 (GCC)
A successful build and a failing build with
-x
:The text was updated successfully, but these errors were encountered: