-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: missing or invalid package binary for binary-only package with buildmode=plugin #27694
Comments
Thank you for filing this issue @twyvip and welcome to Go! Kindly paging @ianlancetaylor @rsc |
Binary-only packages are a completely separate mechanism from It's not obvious to me what's going in here, but given that binary-only packages are on the way out (#28152), I would suggest using plugins instead (https://golang.org/pkg/plugin/). I also note that most of the commands you list involve explicit |
@bcmills Hello, I saw that you closed my question, but I still can't find out how to solve my problem from your answer. Is golang not using Binary-only packages (.a file) in plugin? ? Or is there a problem with my use? How can I solve my problem? |
Sounds like your plugin will need to be changed to load a plugin of its own, then. (Better still, can you build the plugin's dependencies from source?) |
@bcmills I use the .a library in the plugin code. When I have the source code of the .a library, I can compile the plugin successfully. However, when I only have the .a library and have no source code, the compiler will give me an error, missing or invalid package binary for binary-only package say。My detailed steps are described above,Can you tell me what's wrong?thanks! |
If you do have the source code, you should build the plugin against the source code. If you do not have the source code, you will need to convert the package that was previously binary-only to be a plugin instead. |
@bcmills plugin is quite different thing from binary-only package. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.9.2 linux/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN="/test/go/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/test/adcloud_code/adroot/golang:/test/adcloud_code/tangwenyi/:/test/adframework/golang/trunk:/test/adkfw_application/trunk"
GORACE=""
GOROOT="/test/go"
GOTOOLDIR="/test/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build207457534=/tmp/go-build"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
What did you do?
package say
I try to build it to .a file
go build -i -o $GOPATH/pkg/linux_amd64/say.a
change /root/work/go/src/say/say.go to
go run main.go hello Bob that's right
go build -buildmode=plugin -o /root/work/go/src/say/work/v1/plugin.so /root/work/go/src/say/work/v1/v1.go
missing or invalid package binary for binary-only package say
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
What did you expect to see?
can build plugin
What did you see instead?
can't build plugin
missing or invalid package binary for binary-only package say
The text was updated successfully, but these errors were encountered: