Skip to content

cmd/go: -buildmode=plugin -linkshared -> build failure #18671

Closed
@navytux

Description

@navytux

Please answer these questions before submitting your issue. Thanks!

What did you do?

Hello up there. I'm trying to build plugin dynamically linked to other go packages and it fails. Details below:

  • we have fresh go checkout + src/all.bash run
  • then go install -buildmode=shared std was run
  • a sample test plugin source:

---- 8< ---- (myplugin.go)

package main

import (
        "fmt"
)

func PlugFunc() {
        fmt.Println("myplugin.PlugFunc")
}

func init() {
        fmt.Println("myplygin.init")
}
  • I'm trying to build it as go build -buildmode=plugin -linkshared myplugin.go

What did you expect to see?

Build succeeds; myplugin.so dynamically links to packages it imports.

What did you see instead?

# command-line-arguments
runtime.islibrary: missing Go type information for global symbol: size 1

(for the reference building without -linkshared succeeds)

Does this issue reproduce with the latest release (go1.7.4)?

No, there is no plugin support in go1.7 at all:

$ go17 build -buildmode=plugin myplugin.go 
buildmode=plugin not supported

Possibly related issues:

#17150

System details

go version devel +76f981c8d8 Sat Jan 14 17:11:31 2017 +0000 linux/amd64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/kirr/go"
GORACE=""
GOROOT="/home/kirr/src/tools/go/go"
GOTOOLDIR="/home/kirr/src/tools/go/go/pkg/tool/linux_amd64"
GCCGO="/usr/bin/gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build611710721=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
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"
GOROOT/bin/go version: go version devel +76f981c8d8 Sat Jan 14 17:11:31 2017 +0000 linux/amd64
GOROOT/bin/go tool compile -V: compile version devel +76f981c8d8 Sat Jan 14 17:11:31 2017 +0000 X:framepointer
uname -sr: Linux 4.8.0-2-amd64
Distributor ID:	Debian
Description:	Debian GNU/Linux testing (stretch)
Release:	testing
Codename:	stretch
/lib/x86_64-linux-gnu/libc.so.6: GNU C Library (Debian GLIBC 2.24-8) stable release version 2.24, by Roland McGrath et al.
gdb --version: GNU gdb (Debian 7.12-4) 7.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions