Giter Site home page Giter Site logo

Comments (7)

Stebalien avatar Stebalien commented on September 12, 2024

Try again with the latest master and go-ipfs 0.4.20. I've added a "greeter" plugin so, if you've correctly installed this plugin, ipfs daemon should print "Hello!" on start and "Goodbye!" on exit.

from go-ipfs-example-plugin.

joeltg avatar joeltg commented on September 12, 2024

I also can't get this plugin to load - is there anything here that I'm doing clearly wrong? I'm using ipfs-update to install v0.4.20, but I also tried checking out the v0.4.20 tag in $GOPATH/src/github/ipfs/go-ipfs and running make install from there and that didn't load the plugin either (even though IPFS worked great)

$ ipfs version
ipfs version 0.4.20
$ which ipfs
/usr/local/bin/ipfs
$ git clone https://github.com/ipfs/go-ipfs-example-plugin.git
Cloning into 'go-ipfs-example-plugin'...
remote: Enumerating objects: 50, done.
remote: Total 50 (delta 0), reused 0 (delta 0), pack-reused 50
Unpacking objects: 100% (50/50), done.
$ cd go-ipfs-example-plugin/
$ make build
./set-target.sh v0.4.20
go build  -asmflags=all=-trimpath="" -gcflags=all=-trimpath="" -buildmode=plugin -o "example-plugin.so" "plugin.go"
chmod +x "example-plugin.so"
Built against v0.4.20
$ cp example-plugin.so ~/.ipfs/plugins/.
$ ipfs daemon --offline
Initializing daemon...
go-ipfs version: 0.4.20-
Repo version: 7
System version: amd64/darwin
Golang version: go1.12.4
Swarm not listening, running in offline mode.
API server listening on /ip4/127.0.0.1/tcp/5001
WebUI: http://127.0.0.1:5001/webui
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready

from go-ipfs-example-plugin.

Stebalien avatar Stebalien commented on September 12, 2024

Could you post the output of:

  • echo $IPFS_PATH
  • ls -al ~/.ipfs/plugins/

It doesn't look like go is even trying to load the plugin.

from go-ipfs-example-plugin.

joeltg avatar joeltg commented on September 12, 2024

IPFS_PATH isn't set - it's definitely opening the repo in ~/.ipfs/. I'm on MacOS 10.14.5 if that helps.

$ echo $IPFS_PATH

$ ls -al ~/.ipfs/plugins/
total 26624
drwxr-xr-x   3 joel  staff        96 Jul  1 21:32 .
drwxr-xr-x  13 joel  staff       416 Jul  2 09:51 ..
-rwxr-xr-x   1 joel  staff  13355392 Jul  1 21:36 example-plugin.so

Also I think the install tool has a different interface on Mac - I can make build fine but make install throws this error:

$ make install
./set-target.sh v0.4.20
go build  -asmflags=all=-trimpath="" -gcflags=all=-trimpath="" -buildmode=plugin -o "example-plugin.so" "plugin.go"
chmod +x "example-plugin.so"
Built against v0.4.20
install -Dm700 example-plugin.so "/Users/joel/.ipfs/plugins/example-plugin.so"
install: illegal option -- D
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 file2
       install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 ... fileN directory
       install -d [-v] [-g group] [-m mode] [-o owner] directory ...
make: *** [install] Error 64

from go-ipfs-example-plugin.

joeltg avatar joeltg commented on September 12, 2024

some logs of building go-ipfs from source:

$ cd ~/go/src/github.com/ipfs/go-ipfs
$ git checkout v0.4.20
Previous HEAD position was 8ca278f45 Merge pull request #6388 from ipfs/feat/release-0.4.21
HEAD is now at 8efc82534 Merge pull request #6223 from ipfs/feat/release-0.4.20
$ make install
go version go1.12 darwin/amd64
bin/check_go_version 1.12
go install -ldflags="-X "github.com/ipfs/go-ipfs".CurrentCommit=8efc82534" ./cmd/ipfs
go: downloading github.com/ipfs/go-ipfs-cmds v0.0.5
go: downloading github.com/ipfs/go-unixfs v0.0.4
go: downloading github.com/libp2p/go-libp2p-kad-dht v0.0.7
go: downloading github.com/prometheus/client_golang v0.9.2
go: downloading github.com/libp2p/go-libp2p-circuit v0.0.4
go: extracting github.com/libp2p/go-libp2p-circuit v0.0.4
go: downloading github.com/libp2p/go-libp2p-connmgr v0.0.1
go: extracting github.com/ipfs/go-ipfs-cmds v0.0.5
go: downloading github.com/miekg/dns v1.1.4
go: downloading github.com/ipfs/go-ipfs-cmdkit v0.0.1
go: extracting github.com/libp2p/go-libp2p-kad-dht v0.0.7
go: downloading golang.org/x/xerrors v0.0.0-20190212162355-a5947ffaace3
go: extracting github.com/ipfs/go-unixfs v0.0.4
go: downloading github.com/libp2p/go-libp2p-autonat v0.0.4
go: extracting github.com/prometheus/client_golang v0.9.2
go: downloading github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72
go: downloading github.com/ipfs/go-mfs v0.0.4
go: downloading github.com/Stebalien/go-bitfield v0.0.0-20180330043415-076a62f9ce6e
go: downloading github.com/prometheus/common v0.0.0-20181126121408-4724e9255275
go: downloading github.com/ipfs/go-cidutil v0.0.1
go: extracting github.com/libp2p/go-libp2p-connmgr v0.0.1
go: downloading github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
go: extracting github.com/ipfs/go-ipfs-cmdkit v0.0.1
go: downloading github.com/libp2p/go-libp2p-pubsub v0.0.1
go: extracting github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72
go: extracting github.com/Stebalien/go-bitfield v0.0.0-20180330043415-076a62f9ce6e
go: extracting github.com/libp2p/go-libp2p-autonat v0.0.4
go: downloading github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a
go: extracting github.com/ipfs/go-mfs v0.0.4
go: extracting github.com/ipfs/go-cidutil v0.0.1
go: downloading github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910
go: downloading github.com/libp2p/go-ws-transport v0.0.2
go: downloading github.com/libp2p/go-libp2p-discovery v0.0.1
go: extracting github.com/prometheus/common v0.0.0-20181126121408-4724e9255275
go: extracting github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
go: extracting github.com/libp2p/go-libp2p-pubsub v0.0.1
go: extracting github.com/libp2p/go-ws-transport v0.0.2
go: extracting github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910
go: extracting github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a
go: extracting github.com/libp2p/go-libp2p-discovery v0.0.1
go: extracting github.com/miekg/dns v1.1.4
go: extracting golang.org/x/xerrors v0.0.0-20190212162355-a5947ffaace3
$ which ipfs
/Users/joel/go/bin/ipfs
$ cd ~
$ git clone https://github.com/ipfs/go-ipfs-example-plugin.git
Cloning into 'go-ipfs-example-plugin'...
remote: Enumerating objects: 50, done.
remote: Total 50 (delta 0), reused 0 (delta 0), pack-reused 50
Unpacking objects: 100% (50/50), done.
$ cd go-ipfs-example-plugin/
$ make build
./set-target.sh v0.4.20
go build  -asmflags=all=-trimpath="" -gcflags=all=-trimpath="" -buildmode=plugin -o "example-plugin.so" "plugin.go"
chmod +x "example-plugin.so"
Built against v0.4.20
$ cp example-plugin.so ~/.ipfs/plugins/.
$ export IPFS_PATH=/Users/joel/.ipfs
$ ls $IPFS_PATH/plugins
example-plugin.so
$ ls -al $IPFS_PATH/plugins
total 26624
drwxr-xr-x   3 joel  staff        96 Jul  1 21:32 .
drwxr-xr-x  13 joel  staff       416 Jul  2 12:23 ..
-rwxr-xr-x   1 joel  staff  13355392 Jul  2 12:29 example-plugin.so
$ ipfs daemon
Initializing daemon...
go-ipfs version: 0.4.20-8efc82534
Repo version: 7
System version: amd64/darwin
Golang version: go1.12
Swarm listening on /ip4/100.68.50.41/tcp/4001
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip6/::1/tcp/4001
Swarm listening on /p2p-circuit
Swarm announcing /ip4/100.68.50.41/tcp/4001
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip6/::1/tcp/4001
API server listening on /ip4/127.0.0.1/tcp/5001
WebUI: http://127.0.0.1:5001/webui
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready
^C
Received interrupt signal, shutting down...
(Hit ctrl-c again to force-shutdown the daemon.)

Maybe there's discrepancy between the plugin being built against v0.4.20 but the go-ipfs version being 0.4.20-8efc82534? I really don't know what to make of this.

from go-ipfs-example-plugin.

Stebalien avatar Stebalien commented on September 12, 2024

Ah, MacOS is the issue. You'll have to use the latest go-ipfs master (see ipfs/kubo#6439)

If you re-build go-ipfs, you'll need to run set-version.sh /path/to/my-go-ipfs/source. So, to build against master:

  1. Clone go-ipfs (ideally into your gopath).
  2. Run ./set-version.sh $GOPATH/src/github.com/ipfs/go-ipfs
  3. Run make install (I've fixed the macos install bug as well).

from go-ipfs-example-plugin.

joeltg avatar joeltg commented on September 12, 2024

That works! Thanks so much 🎉

from go-ipfs-example-plugin.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.