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/compile: could not build shared library linked with shared std #28553

Open
funny-falcon opened this Issue Nov 2, 2018 · 1 comment

Comments

Projects
None yet
3 participants
@funny-falcon
Contributor

funny-falcon commented Nov 2, 2018

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

$ go version
go version go1.11.1 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

Ubuntu 18.04, go 1.11.1 installed with godep

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/yura/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/yura/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="/usr/bin/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-build025854543=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I'm trying to build simplest library in shared mode linked against shared std.

$ sudo rm /usr/local/go/pkg/linux_amd64_dynlink/ -rf
$ sudo rm ~/.cache/go-build/ -rf
$ sudo go install -buildmode=shared std
$ mkdir ~/go/src/mylibrary
$ cat > ~/go/src/mylibrary/lib.go
package mylibrary
import "fmt"
func HelloWorld() {
fmt.Println("Hello World")
}
$ go install -buildmode=shared -linkshared mylibrary
go install runtime/internal/atomic: open /usr/local/go/pkg/linux_amd64_dynlink/runtime/internal/atomic.a: permission denied
go install internal/cpu: open /usr/local/go/pkg/linux_amd64_dynlink/internal/cpu.a: permission denied
go install sync/atomic: open /usr/local/go/pkg/linux_amd64_dynlink/sync/atomic.a: permission denied
go install vendor/golang_org/x/crypto/curve25519: open /usr/local/go/pkg/linux_amd64_dynlink/vendor/golang_org/x/crypto/curve25519.a: permission denied
go install runtime/cgo: open /usr/local/go/pkg/linux_amd64_dynlink/runtime/cgo.a: permission denied
$ sudo go install -buildmode=shared -linkshared sync
$ go install -buildmode=shared -linkshared mylibrary

What did you expect to see?

Compiled shared my library.

What did you see instead?

It never finishes compilation of mylibrary, and eats slowly whole memory of my computer.

@funny-falcon funny-falcon changed the title from cmd/link: error with -buildmode=shared: "cannot implicitly include runtime/cgo in a shared library" to Could not build shared library linked with shared std Nov 2, 2018

@dmitshur dmitshur changed the title from Could not build shared library linked with shared std to cmd/compile: could not build shared library linked with shared std Nov 4, 2018

@dmitshur dmitshur added this to the Go1.12 milestone Nov 4, 2018

@odeke-em

This comment has been minimized.

Member

odeke-em commented Dec 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment