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

Program using cgo are killed at launch #19841

Closed
maxence-charriere opened this issue Apr 4, 2017 · 3 comments
Closed

Program using cgo are killed at launch #19841

maxence-charriere opened this issue Apr 4, 2017 · 3 comments

Comments

@maxence-charriere
Copy link

Please answer these questions before submitting your issue. Thanks!

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

go version go1.8 darwin/amd64

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/maxence/Dev/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.8/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.8/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/07/tj_2fpcd5lv00gj1shc_kgqw0000gn/T/go-build751688862=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

package main

import "C"
import "fmt"

func main() {
	fmt.Println("Hello maxoo")
}

What did you expect to see?

github.com/maxence-charriere/test
▶ ./test
Hello maxoo

What did you see instead?

github.com/maxence-charriere/test
▶ ./test
[1]    16391 killed     ./test
@ianlancetaylor
Copy link
Contributor

Dup of #19734?

@maxence-charriere
Copy link
Author

Look like the other topic is pretty random depending on the c library used.
Here I just use go build and there is just an import "C".
There is no use of any c functions.

I also tried using a simple printf, the result was the same.

This started to occur since I updated to go 1.8.

using go build -ldflags -s solve the problem but i doubt this should be the default behavior since it's not documented anywhere.

@maxence-charriere
Copy link
Author

just saw there was a go update.
I tried it and look like it's fixed.
👍 guys.

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

3 participants