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

Go 1.12 breaks cgo #28821

Closed
bobrik opened this issue Nov 15, 2018 · 1 comment
Closed

Go 1.12 breaks cgo #28821

bobrik opened this issue Nov 15, 2018 · 1 comment

Comments

@bobrik
Copy link

bobrik commented Nov 15, 2018

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

$ ./bin/go version
go version devel +90df37769d Thu Nov 1 21:54:54 2018 +0000 linux/amd64

Does this issue reproduce with the latest release?

Not with go1.11.2, but with tip. I bisected to this commit:

$ git bisect bad
90df37769d6441ce550443fa7e0c008d38e53455 is the first bad commit
commit 90df37769d6441ce550443fa7e0c008d38e53455
Author: Ian Lance Taylor <iant@golang.org>
Date:   Wed Oct 17 08:04:01 2018 -0700

    cmd/cgo: rewrite pointer checking to use more function literals

    Fixes #14210
    Fixes #25941

    Change-Id: Idde2d032290da3edb742b5b4f6ffeb625f05b494
    Reviewed-on: https://go-review.googlesource.com/c/142884
    Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>

:040000 040000 be516fb26c8edf35775da611547f78bb0f621953 fe68ed3319823f8a2cc4791ad540be1760ecedbe M	misc
:040000 040000 070fb7b2495736ee045b1b2dc4eec63f5e91254b 5f5253fd04bb6fef472424b3784032e8f6e968e6 M	src

Related to: #14210, #25941.

cc @ianlancetaylor

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

$ ./bin/go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ivan/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GOPROXY=""
GORACE=""
GOROOT="/home/ivan/go"
GOTMPDIR=""
GOTOOLDIR="/home/ivan/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build395867230=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Run a Travic CI job that builds a CGO package:

What did you expect to see?

Successfull compilation like on go1.11.2:

https://travis-ci.org/cloudflare/ebpf_exporter/jobs/455709944

What did you see instead?

vendor/github.com/iovisor/gobpf/bcc/perf.go:191: cannot use _cgo5 (type int) as type _Ctype_int in argument to _C2func_bpf_open_perf_buffer

Code is here:

	reader, err := C.bpf_open_perf_buffer(
		(C.perf_reader_raw_cb)(unsafe.Pointer(C.callback_to_go)),
		nil,
		unsafe.Pointer(uintptr(callbackDataIndex)),
		-1, cpuC, BPF_PERF_READER_PAGE_CNT)
@odeke-em
Copy link
Member

Thank you for reporting this issue @bobrik and welcome to the Go project!

This looks like an exact duplicate of #28772 so I'll close it and please report your findings also on that issue. I'll also page our cgo expert @ianlancetaylor

@golang golang locked and limited conversation to collaborators Nov 15, 2019
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

3 participants