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

gccgo: implement plugin package #36403

Open
zhsj opened this issue Jan 6, 2020 · 8 comments
Open

gccgo: implement plugin package #36403

zhsj opened this issue Jan 6, 2020 · 8 comments
Labels
FeatureRequest NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@zhsj
Copy link
Contributor

zhsj commented Jan 6, 2020

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

$ go version
go version go1.12.2 gccgo (Debian 9.2.1-21) 9.2.1 20191130 linux/amd64

Does this issue reproduce with the latest release?

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/zhsj/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/zhsj/go"
GOPROXY="https://proxy.golang.org"
GORACE=""
GOROOT="/usr"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/gcc/x86_64-linux-gnu/9"
GCCGO="/usr/bin/x86_64-linux-gnu-gccgo-9"
CC="x86_64-linux-gnu-gcc-9"
CXX="x86_64-linux-gnu-g++-9"
CGO_ENABLED="1"
GOMOD="/home/zhsj/go/src/github.com/containerd/containerd/go.mod"
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-build814416476=/tmp/go-build -gno-record-gcc-switches -funwind-tables"

What did you do?

build containerd with gccgo

go-9 build -tags "no_btrfs no_cri" -v ./cmd/containerd
plugin/plugin_go18.go:24:2: cannot find package "plugin" in any of:
        /home/zhsj/go/src/github.com/containerd/containerd/vendor/plugin (vendor tree)
        /usr/src/plugin (from $GOROOT)
        /home/zhsj/go/src/plugin (from $GOPATH)

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 see plugin in https://github.com/golang/gofrontend/tree/master/libgo/go/plugin

Is https://github.com/golang/gofrontend/blob/master/libgo/libgo-packages.txt responsible for it? I didn't see plugin in it too.

What did you expect to see?

What did you see instead?

@gopherbot gopherbot added this to the Gccgo milestone Jan 6, 2020
@ianlancetaylor
Copy link
Contributor

Yes: gccgo does not currently implement the plugin package. Sorry.

zhsj added a commit to zhsj/containerd that referenced this issue Jan 7, 2020
+ archive: don't convert syscall.Timespec to unix.Timespec
  archive/tar_unix.go:179:76: error: invalid type conversion (cannot use type syscall.Timespec as type unix.Timespec)
    179 |  timespec := []unix.Timespec{unix.Timespec(fs.StatAtime(st)), unix.Timespec(fs.StatMtime(st))}
+ gccgo has no plugin support
  golang/go#36403
+ update github.com/containerd/continuity
  to include same fix for Timespec

Signed-off-by: Shengjing Zhu <zhsj@debian.org>
@toothrot toothrot added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 7, 2020
@ALTree ALTree added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jan 8, 2020
@ALTree ALTree changed the title gccgo: no plugin package gccgo: implement plugin package Jan 8, 2020
tussennet pushed a commit to tussennet/containerd that referenced this issue Sep 11, 2020
+ archive: don't convert syscall.Timespec to unix.Timespec
  archive/tar_unix.go:179:76: error: invalid type conversion (cannot use type syscall.Timespec as type unix.Timespec)
    179 |  timespec := []unix.Timespec{unix.Timespec(fs.StatAtime(st)), unix.Timespec(fs.StatMtime(st))}
+ gccgo has no plugin support
  golang/go#36403
+ update github.com/containerd/continuity
  to include same fix for Timespec

Signed-off-by: Shengjing Zhu <zhsj@debian.org>
@advancedwebdeveloper
Copy link

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

@YKG
Copy link

YKG commented Dec 18, 2020

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.

@ianlancetaylor
Copy link
Contributor

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

@xiaq
Copy link

xiaq commented Jun 19, 2021

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.

@ianlancetaylor
Copy link
Contributor

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

@cherrymui
Copy link
Member

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.

@xiaq
Copy link

xiaq commented Jun 23, 2021

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.

dmcgowan pushed a commit to containerd/plugin that referenced this issue Oct 24, 2023
+ archive: don't convert syscall.Timespec to unix.Timespec
  archive/tar_unix.go:179:76: error: invalid type conversion (cannot use type syscall.Timespec as type unix.Timespec)
    179 |  timespec := []unix.Timespec{unix.Timespec(fs.StatAtime(st)), unix.Timespec(fs.StatMtime(st))}
+ gccgo has no plugin support
  golang/go#36403
+ update github.com/containerd/continuity
  to include same fix for Timespec

Signed-off-by: Shengjing Zhu <zhsj@debian.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

9 participants