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

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

Open
navytux opened this issue Jan 15, 2017 · 7 comments
Open

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

navytux opened this issue Jan 15, 2017 · 7 comments

Comments

@navytux
Copy link
Contributor

@navytux navytux commented Jan 15, 2017

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
@crawshaw

This comment has been minimized.

Copy link
Contributor

@crawshaw crawshaw commented Jan 16, 2017

This is a feature I couldn't find time for in 1.8, but I would like to see in 1.9. (After darwin support.)

I'm not sure if this warrants a better error message for 1.8. Thoughts, @bradfitz, @ianlancetaylor?

@navytux

This comment has been minimized.

Copy link
Contributor Author

@navytux navytux commented Jan 17, 2017

@crawshaw thanks for feedback.

@ssadler

This comment has been minimized.

Copy link

@ssadler ssadler commented Jun 22, 2018

Also ran into this issue, with go 1.10.2 and 1.10.3; downgrading to 1.9.7 it works.

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Apr 8, 2019

Hi. We are currently running into this problem. It's quite hard to find out what's the current status of this issue. Was it resolved in 1.9 (doesn't look like) ? Is it definitely dropped ?

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Apr 8, 2019

I don't expect -buildmode=plugin -linkshared` to work today. Somebody will have to investigate the problems and figure out whether they can be fixed. I don't know of anybody planning to do that.

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Apr 9, 2019

@ianlancetaylor thanks for the feedback

@n454149301

This comment has been minimized.

Copy link

@n454149301 n454149301 commented Dec 25, 2019

Thank you. After reading it, I tried it.
It's true that in the "old style", using the export gopath = ` xxx 'style, I can get the expected results.

But when I use the go. Mod style, there are all kinds of panic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants
You can’t perform that action at this time.