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

Unable to load plugin #63

Closed
ianopolous opened this issue Feb 16, 2020 · 9 comments
Closed

Unable to load plugin #63

ianopolous opened this issue Feb 16, 2020 · 9 comments
Labels
kind/support A question or request for support

Comments

@ianopolous
Copy link
Member

I've built this plugin and used it with ipfs v0.4.23 and it works fine. However, When I rebuild ipfs v0.4.23 with the 2 line diff from ipfs/go-ipfs-pinner#2 I get the following error:

Error: error loading plugins: loading plugin /tmp/peergos9005038333179153292/.ipfs/plugins/go-ds-s3.so: plugin.Open("/tmp/peergos9005038333179153292/.ipfs/plugins/go-ds-s3"): plugin was built with a different version of package github.com/jbenet/goprocess

@Stebalien Any idea what could be happening here? That goprocess repo hasn't changed in almost a year.

@ianopolous
Copy link
Member Author

I also haven't been able to get this to build against master of go-ipfs:

make IPFS_VERSION=/home/ian/go/src/github.com/ipfs/go-ipfs

./set-target.sh /home/ian/go/src/github.com/ipfs/go-ipfs
go: cannot find main module, but found Gopkg.lock in /home/ian/go-ds-s3
to create a module there, run:
go mod init
Makefile:20: recipe for target 'go.mod' failed
make: *** [go.mod] Error 1

@Stebalien
Copy link
Member

@Stebalien Any idea what could be happening here? That goprocess repo hasn't changed in almost a year.

I'm not sure but go is weird about plugins. Setting IPFS_VERSION=/path/to/build should fix it. Alternatively, make sure nothing has changed in any go.mod files.

Alternatively, you can build your plugin into go-ipfs by following the directions here https://github.com/ipfs/go-ipfs/blob/master/docs/plugins.md#preloaded-plugins.

I also haven't been able to get this to build against master of go-ipfs:

Assuming your current working directory is go-ds-s3, did you delete the go.mod file?

@Stebalien Stebalien added the kind/support A question or request for support label Feb 21, 2020
@ianopolous
Copy link
Member Author

@Stebalien Thanks for your help. I've tried again starting from scratch in both repos.

First, in go-ipfs I checked out release/v0.4.23 and applied the 2 line patch for the global pin lock
That builds fine.

Then in go-ds-s3 I checked out release/v0.4.23 and ran

make IPFS_VERSION=/home/ian/go/src/github.com/ipfs/go-ipfs

That builds fine now (I think you're right - I must have deleted go.mod), but then when I try to load it in the ipfs built in step 1 I get the following from ipfs init:

Error: error loading plugins: loading plugin /tmp/peergos-s3-test/.ipfs/plugins/go-ds-s3.so: plugin.Open("/tmp/peergos-s3-test/.ipfs/plugins/go-ds-s3"): plugin was built with a different version of package github.com/jbenet/goprocess

This is a huge problem for us because we can't upgrade ipfs, so to avoid a global deadlock we have to disable gc entirely.

@ianopolous
Copy link
Member Author

Is it possible to strip down the amazon s3 lib such that it could be included in ipfs by default? I'm not sure if the go compiler does that, but based on the size of the .so I'd guess not. I was able to reduce the Java amazon S3 library down to 2.8mb, which would be 6% of the current ipfs binary size.

@ianopolous
Copy link
Member Author

ianopolous commented Feb 22, 2020

This looks very similar to what I'm seeing. I'm going to try some of their ideas: golang/go#27751

UPDATE: none of that works.

@ianopolous
Copy link
Member Author

I've even gone so far as to try forking go-ipfs, renaming the module, adding the patch, pushing a new version tag to my repo, and then trying linking the s3 plugin to that. (in case the error was some issue with using a local go-ipfs version rather than a remote)

Sadly that results are the same goprocess error when ipfs tries to load the module.

@Stebalien
Copy link
Member

Yeah, I'm seeing that error. GAH!

@Stebalien
Copy link
Member

TL;DR: Checkout the feat/peergos-0.4.23-patched in go-ipfs and build that. That will compile the s3 datastore into go-ipfs at the same time.


Ok, I found the issue.

  • In dist.ipfs.io, we strip the gopath from paths on build.
  • We do the same in go-ds-s3.
  • We do the same in go-ipfs master.
  • We don't do this in go-ipfs v0.4.23 (never backported the patch).
GOFLAGS += -asmflags=all=-trimpath="$(GOPATH)" -gcflags=all=-trimpath="$(GOPATH)"

Adding this to the 0.4.23 makefile fixes the problem. But really, just use the branch.

@ianopolous
Copy link
Member Author

Ah, thank you so much! You're a lifesaver! That fixes it. I've patched the go-ipfs makefile with that and everything works now.

We've built our ipfs installer around optionally loading plugins, so didn't want to go down the "all in one" route.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support A question or request for support
Projects
None yet
Development

No branches or pull requests

2 participants