Open zhsj opened 4 years ago
Yes: gccgo does not currently implement the plugin package. Sorry.
Yes: gccgo does not currently implement the plugin package. Sorry.
@thanm , @ianlancetaylor , @cherrymui :
~/faasd$ make all CGO_ENABLED=0 GOOS=linux go build -o bin/faasd ../go/src/github.com/openfaas/faasd/vendor/github.com/containerd/containerd/plugin/plugin_go18.go:24:2: cannot find package "plugin" in any of: /home/oceanfish81/go/src/github.com/openfaas/faasd/vendor/plugin (vendor tree) /usr/local/src/plugin (from $GOROOT) /home/oceanfish81/go/src/plugin (from $GOPATH) make: *** [Makefile:12: local] Error 1
I was trying to build faasd :
$ go env && go version GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/oceanfish81/.cache/go-build" GOENV="/home/oceanfish81/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/oceanfish81/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/oceanfish81/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/tools" GCCGO="/usr/local/bin/llvm-goc" AR="ar" CC="/usr/bin/clang" CXX="/usr/bin/clang++" 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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build934338008=/tmp/go-build -gno-record-gcc-switches -funwind-tables" go version go1.15rc2 gollvm LLVM 12.0.0git linux/amd64
Hi @ianlancetaylor , I got the same issue with go1.15.6, were there too much work to implement the plugin package in gccgo? If it's not, could you please give me some guildlines so thant I can implement one?
I'm trying to use coz
with go, it seems like only gccgo compiled works fine, not gc. But since plugin package support is not implemented in gccgo, I can't work on those projects that use plugin.
@YKG I think it would be a lot of work to implement the plugin package in gccgo. I haven't thought about it in detail.
Would it make sense to copy the stub implementation to gccgo?
Currently the plugin
package does not exist at all with gccgo, so code that imports plugin
won't build on gccgo at all. This can be fixed by gating such code with a //+build !gccgo
, but it'd be nicer to not have to do that.
@xiaq For something that will never work, isn't it slightly better to fail at compile time than at run time? When would it be useful to be able to import "plugin" even though it won't work? Yes, you won't need to use a build tag, but instead your program won't run. That doesn't seem like an improvement.
I think there may be program that imports the plugin package but only use it in some code path, and plugin.Open is called only when plugins are actually used at run time. The program can still function (to some extent) if it compiles, just cannot use plugins.
When would it be useful to be able to import "plugin" even though it won't work? Yes, you won't need to use a build tag, but instead your program won't run. That doesn't seem like an improvement.
I think you're thinking about the case where a program has a hard dependency on plugin
.
My use case is that I have a program with a soft dependency on plugin
. Without plugins, it will still work, just won't support plugins.
On gc
, the plugin
package always exists, but if the program was built with CGo disabled, or runs on an unsupported platform, any call will fail. So my code already needs to deal with the fact that despite it being buildable, the plugin
package might not actually be available at runtime. But now it also needs to deal with the fact that it might not exist at all - which for my code is dealing with the same failure scenario twice. Having a stub plugin
package means that this failure scenario is consistent between gc
and gccgo
.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
build containerd with gccgo
I'm not sure if it's distribution issue or upstream issue. I didn't see
plugin
in/usr/lib/x86_64-linux-gnu/go/9/x86_64-linux-gnu/
. But I seeplugin
in https://github.com/golang/gofrontend/tree/master/libgo/go/pluginIs
https://github.com/golang/gofrontend/blob/master/libgo/libgo-packages.txt
responsible for it? I didn't seeplugin
in it too.What did you expect to see?
What did you see instead?