Skip to content
This repository has been archived by the owner. It is now read-only.

error running osx.sh #13

Closed
kidinamoto01 opened this issue Nov 3, 2017 · 12 comments
Closed

error running osx.sh #13

kidinamoto01 opened this issue Nov 3, 2017 · 12 comments

Comments

@kidinamoto01
Copy link

kidinamoto01 commented Nov 3, 2017

Hey, there

I am new to IPLD and I ran into these errors
plugin/loader/preload.sh > plugin/loader/preload.go go fmt plugin/loader/preload.go >/dev/null go build -i -ldflags="-X "github.com/ipfs/go-ipfs/repo/config".CurrentCommit=115998d2" -o "cmd/ipfs/ipfs" "github.com/ipfs/go-ipfs/cmd/ipfs" github.com/ipfs/go-ipld-eth/plugin ../go-ipld-eth/plugin/eth.go:22: cannot use (*EthereumPlugin)(nil) (type *EthereumPlugin) as type plugin.PluginIPLD in assignment: *EthereumPlugin does not implement plugin.PluginIPLD (wrong type for RegisterBlockDecoders method) have RegisterBlockDecoders("github.com/ipfs/go-ipld-format".BlockDecoder) error want RegisterBlockDecoders("gx/ipfs/QmPN7cwmpcc4DWXb4KTB9dNAJgjuPY69h3npsMfhRrQL9c/go-ipld-format".BlockDecoder) error ../go-ipld-eth/plugin/eth.go:47: cannot use EthBlockRawInputParser (type func(io.Reader, uint64, int) ([]"github.com/ipfs/go-ipld-format".Node, error)) as type coredag.DagParser in argument to iec.AddParser ../go-ipld-eth/plugin/eth.go:48: cannot use EthBlockJSONInputParser (type func(io.Reader, uint64, int) ([]"github.com/ipfs/go-ipld-format".Node, error)) as type coredag.DagParser in argument to iec.AddParser ../go-ipld-eth/plugin/eth.go:49: cannot use EthStateTrieRawInputParser (type func(io.Reader, uint64, int) ([]"github.com/ipfs/go-ipld-format".Node, error)) as type coredag.DagParser in argument to iec.AddParser ../go-ipld-eth/plugin/eth.go:50: cannot use EthStorageTrieRawInputParser (type func(io.Reader, uint64, int) ([]"github.com/ipfs/go-ipld-format".Node, error)) as type coredag.DagParser in argument to iec.AddParser make: *** [cmd/ipfs/ipfs] Error 2
Thanks in advance and wish you a nice day ^^

@Stebalien
Copy link
Member

Stebalien commented Nov 7, 2017

Note: This happened on macos when running the osx.sh script.

@Stebalien
Copy link
Member

Stebalien commented Nov 7, 2017

Probably needs to run gx-go rw.

According to the README:

Make sure to rewrite the gx dependencies in the directory above first, then Either run make or go build -buildmode=plugin -o=ethereum.so.

However, it should probably be a bit more explicit (most people don't know what "rewrite the gx dependencies means".

@ghost
Copy link

ghost commented Nov 7, 2017

@Stebalien the plugin cannot be built using make in OSX/darwin. And the osx.sh script makes sure to rewrite the dependencies (and unwrite them after ipfs daemon stopped running.

@kidinamoto01 Hello. Can you please tell me from which directory are you calling the osx.sh script and which command are you using?

@ghost
Copy link

ghost commented Nov 7, 2017

Now, if we want to be really sure that the gx rw are happening, we can run the first three commands manually and check what's going on.

That is, run

echo "ipldeth github.com/ipfs/go-ipld-eth/plugin 0" >> $GOPATH/src/github.com/ipfs/go-ipfs/plugin/loader/preload_list
sed -i '' 's/package main/package plugin/' $GOPATH/src/github.com/ipfs/go-ipld-eth/plugin/eth.go
gx-go rw

And then git diff, should show us that the dependencies have been changed

[ hj: go-ipld-eth ]$ git diff
diff --git a/common.go b/common.go
index f31a4d6..2d7ef20 100644
--- a/common.go
+++ b/common.go
@@ -3,8 +3,8 @@ package ipldeth
 import (
        "bytes"

-       cid "github.com/ipfs/go-cid"
-       mh "github.com/multiformats/go-multihash"
+       cid "gx/ipfs/QmNp85zy9RLrQ5oQD4hPyS39ezrrXpcaa7R4Y9kxdWQLLQ/go-cid"
+       mh "gx/ipfs/QmU9a9NV9RdPNwZQDYd5uKsm6N6LJLSvLbywDDYFbaaC6P/go-multihash"

.....

And we need to check our go-ipfs package

[ hj: go-ipld-eth ]$ cd $GOPATH/src/github.com/ipfs/go-ipfs

[ hj: go-ipfs ]$ git diff
diff --git a/plugin/loader/preload_list b/plugin/loader/preload_list
index 8c62c673..ddfeb36d 100644
--- a/plugin/loader/preload_list
+++ b/plugin/loader/preload_list
@@ -4,3 +4,4 @@
 # name             go-path                  number of the sub-plugin

 #ipldgit github.com/ipfs/go-ipfs/plugin/plugins/git 0
+ipldeth github.com/ipfs/go-ipld-eth/plugin 0

In all cases, I should move the priority on This Issue to prevent the rewriting of things. Let me know @kidinamoto01 of your output please. Wish you a good day.

@ghost ghost self-assigned this Nov 7, 2017
@kidinamoto01
Copy link
Author

kidinamoto01 commented Nov 7, 2017

hello @hermanjunge I am calling osx.sh from go-ipld-eth source root.
my ipfs version is
ipfs version 0.4.12-rc1

@ghost
Copy link

ghost commented Nov 7, 2017

Please @kidinamoto01 can you run gx-go rw in the go-ipld-eth source root and show me the result of the command git diff ?

@kidinamoto01
Copy link
Author

kidinamoto01 commented Nov 7, 2017

call git diff get the following:

`
diff --git a/common.go b/common.go
index f31a4d6..2d7ef20 100644
--- a/common.go
+++ b/common.go
@@ -3,8 +3,8 @@ package ipldeth
import (
"bytes"

  •   cid "github.com/ipfs/go-cid"
    
  •   mh "github.com/multiformats/go-multihash"
    
  •   cid "gx/ipfs/QmNp85zy9RLrQ5oQD4hPyS39ezrrXpcaa7R4Y9kxdWQLLQ/go-cid"
    
  •   mh "gx/ipfs/QmU9a9NV9RdPNwZQDYd5uKsm6N6LJLSvLbywDDYFbaaC6P/go-multihash"
    
      common "github.com/ethereum/go-ethereum/common"
      "github.com/ethereum/go-ethereum/ethdb"
    

diff --git a/eth_account_snapshot.go b/eth_account_snapshot.go
index e6faa67..427a2cc 100644
--- a/eth_account_snapshot.go
+++ b/eth_account_snapshot.go
@@ -5,8 +5,8 @@ import (
"fmt"
"math/big"

  •   cid "github.com/ipfs/go-cid"
    
  •   node "github.com/ipfs/go-ipld-format"
    
  •   cid "gx/ipfs/QmNp85zy9RLrQ5oQD4hPyS39ezrrXpcaa7R4Y9kxdWQLLQ/go-cid"
    
  •   node "gx/ipfs/QmPN7cwmpcc4DWXb4KTB9dNAJgjuPY69h3npsMfhRrQL9c/go-ipld-format"
    

)

// EthAccountSnapshot (eth-account-snapshot codec 0x97)
diff --git a/eth_block.go b/eth_block.go
index 5944409..8540289 100644
--- a/eth_block.go
+++ b/eth_block.go
@@ -7,8 +7,8 @@ import (
"io"
"io/ioutil"

  •   cid "github.com/ipfs/go-cid"
    
  •   node "github.com/ipfs/go-ipld-format"
    
  •   cid "gx/ipfs/QmNp85zy9RLrQ5oQD4hPyS39ezrrXpcaa7R4Y9kxdWQLLQ/go-cid"
    
  •   node "gx/ipfs/QmPN7cwmpcc4DWXb4KTB9dNAJgjuPY69h3npsMfhRrQL9c/go-ipld-format"
    
      "github.com/ethereum/go-ethereum/common"
      types "github.com/ethereum/go-ethereum/core/types"
    

diff --git a/eth_block_test.go b/eth_block_test.go
index 609bb89..621d12e 100644
--- a/eth_block_test.go
+++ b/eth_block_test.go
@@ -9,8 +9,8 @@ import (
"strconv"
"testing"

  •   block "github.com/ipfs/go-block-format"
    
  •   node "github.com/ipfs/go-ipld-format"
    
  •   node "gx/ipfs/QmPN7cwmpcc4DWXb4KTB9dNAJgjuPY69h3npsMfhRrQL9c/go-ipld-format"
    
  •   block "gx/ipfs/QmSn9Td7xgxm9EV7iEjTckpUWmWApggzPxu7eFGWkkpwin/go-block-format"
    
      "github.com/ethereum/go-ethereum/core/types"
    

)
diff --git a/eth_state_trie.go b/eth_state_trie.go
index 435291f..0ea8981 100644
--- a/eth_state_trie.go
+++ b/eth_state_trie.go
@@ -5,8 +5,8 @@ import (
"io"
"io/ioutil"

  •   cid "github.com/ipfs/go-cid"
    
  •   node "github.com/ipfs/go-ipld-format"
    
  •   cid "gx/ipfs/QmNp85zy9RLrQ5oQD4hPyS39ezrrXpcaa7R4Y9kxdWQLLQ/go-cid"
    
  •   node "gx/ipfs/QmPN7cwmpcc4DWXb4KTB9dNAJgjuPY69h3npsMfhRrQL9c/go-ipld-format"
    
      "github.com/ethereum/go-ethereum/rlp"
    

)
diff --git a/eth_state_trie_test.go b/eth_state_trie_test.go
index ed03405..c8de136 100644
--- a/eth_state_trie_test.go
+++ b/eth_state_trie_test.go
@@ -5,8 +5,8 @@ import (
"os"
"testing"

  •   cid "github.com/ipfs/go-cid"
    
  •   node "github.com/ipfs/go-ipld-format"
    
  •   cid "gx/ipfs/QmNp85zy9RLrQ5oQD4hPyS39ezrrXpcaa7R4Y9kxdWQLLQ/go-cid"
    
  •   node "gx/ipfs/QmPN7cwmpcc4DWXb4KTB9dNAJgjuPY69h3npsMfhRrQL9c/go-ipld-format"
    

)

/*
diff --git a/eth_storage_trie.go b/eth_storage_trie.go
index b99b828..b4c26fe 100644
--- a/eth_storage_trie.go
+++ b/eth_storage_trie.go
@@ -5,8 +5,8 @@ import (
"io"
"io/ioutil"

  •   cid "github.com/ipfs/go-cid"
    
  •   node "github.com/ipfs/go-ipld-format"
    
  •   cid "gx/ipfs/QmNp85zy9RLrQ5oQD4hPyS39ezrrXpcaa7R4Y9kxdWQLLQ/go-cid"
    
  •   node "gx/ipfs/QmPN7cwmpcc4DWXb4KTB9dNAJgjuPY69h3npsMfhRrQL9c/go-ipld-format"
    

)

// EthStorageTrie (eth-storage-trie, codec 0x98), represents
diff --git a/eth_storage_trie_test.go b/eth_storage_trie_test.go
index b9152fe..6496133 100644
--- a/eth_storage_trie_test.go
+++ b/eth_storage_trie_test.go
@@ -5,7 +5,7 @@ import (
"os"
"testing"

  •   cid "github.com/ipfs/go-cid"
    
  •   cid "gx/ipfs/QmNp85zy9RLrQ5oQD4hPyS39ezrrXpcaa7R4Y9kxdWQLLQ/go-cid"
    

)

/*
diff --git a/eth_tx.go b/eth_tx.go
index a832e62..751234b 100644
--- a/eth_tx.go
+++ b/eth_tx.go
@@ -5,8 +5,8 @@ import (
"encoding/json"
"fmt"

  •   cid "github.com/ipfs/go-cid"
    
  •   node "github.com/ipfs/go-ipld-format"
    
  •   cid "gx/ipfs/QmNp85zy9RLrQ5oQD4hPyS39ezrrXpcaa7R4Y9kxdWQLLQ/go-cid"
    
  •   node "gx/ipfs/QmPN7cwmpcc4DWXb4KTB9dNAJgjuPY69h3npsMfhRrQL9c/go-ipld-format"
    
      hexutil "github.com/ethereum/go-ethereum/common/hexutil"
      types "github.com/ethereum/go-ethereum/core/types"
    

diff --git a/eth_tx_test.go b/eth_tx_test.go
index 08ae14e..93da4b0 100644
--- a/eth_tx_test.go
+++ b/eth_tx_test.go
@@ -6,7 +6,7 @@ import (
"os"
"testing"

  •   block "github.com/ipfs/go-block-format"
    
  •   block "gx/ipfs/QmSn9Td7xgxm9EV7iEjTckpUWmWApggzPxu7eFGWkkpwin/go-block-format"
    

)

/*
diff --git a/eth_tx_trie.go b/eth_tx_trie.go
index f4b59d0..72a9f60 100644
--- a/eth_tx_trie.go
+++ b/eth_tx_trie.go
@@ -3,8 +3,8 @@ package ipldeth
import (
"fmt"

  •   cid "github.com/ipfs/go-cid"
    
  •   node "github.com/ipfs/go-ipld-format"
    
  •   cid "gx/ipfs/QmNp85zy9RLrQ5oQD4hPyS39ezrrXpcaa7R4Y9kxdWQLLQ/go-cid"
    
  •   node "gx/ipfs/QmPN7cwmpcc4DWXb4KTB9dNAJgjuPY69h3npsMfhRrQL9c/go-ipld-format"
    
      "github.com/ethereum/go-ethereum/core/types"
      "github.com/ethereum/go-ethereum/rlp"
    

diff --git a/eth_tx_trie_test.go b/eth_tx_trie_test.go
index 44f5456..e70a6d9 100644
--- a/eth_tx_trie_test.go
+++ b/eth_tx_trie_test.go
@@ -7,9 +7,9 @@ import (
"os"
"testing"

  •   block "github.com/ipfs/go-block-format"
    
  •   cid "github.com/ipfs/go-cid"
    
  •   node "github.com/ipfs/go-ipld-format"
    
  •   cid "gx/ipfs/QmNp85zy9RLrQ5oQD4hPyS39ezrrXpcaa7R4Y9kxdWQLLQ/go-cid"
    
  •   node "gx/ipfs/QmPN7cwmpcc4DWXb4KTB9dNAJgjuPY69h3npsMfhRrQL9c/go-ipld-format"
    
  •   block "gx/ipfs/QmSn9Td7xgxm9EV7iEjTckpUWmWApggzPxu7eFGWkkpwin/go-block-format"
    

)

/*
diff --git a/plugin/eth.go b/plugin/eth.go
index e3c79ea..73a3b58 100644
--- a/plugin/eth.go
+++ b/plugin/eth.go
@@ -3,11 +3,11 @@ package plugin
import (
"io"

  •   block "github.com/ipfs/go-block-format"
      "github.com/ipfs/go-ipfs/core/coredag"
      plugin "github.com/ipfs/go-ipfs/plugin"
      eth "github.com/ipfs/go-ipld-eth"
    
  •   node "github.com/ipfs/go-ipld-format"
    
  •   node "gx/ipfs/QmPN7cwmpcc4DWXb4KTB9dNAJgjuPY69h3npsMfhRrQL9c/go-ipld-format"
    
  •   block "gx/ipfs/QmSn9Td7xgxm9EV7iEjTckpUWmWApggzPxu7eFGWkkpwin/go-block-format"
    

)

// Plugins declare what and how many of these will be defined.
diff --git a/trie_node.go b/trie_node.go
index 7f9ec87..d6ae772 100644
--- a/trie_node.go
+++ b/trie_node.go
@@ -4,8 +4,8 @@ import (
"encoding/json"
"fmt"

  •   cid "github.com/ipfs/go-cid"
    
  •   node "github.com/ipfs/go-ipld-format"
    
  •   cid "gx/ipfs/QmNp85zy9RLrQ5oQD4hPyS39ezrrXpcaa7R4Y9kxdWQLLQ/go-cid"
    
  •   node "gx/ipfs/QmPN7cwmpcc4DWXb4KTB9dNAJgjuPY69h3npsMfhRrQL9c/go-ipld-format"
    
      "github.com/ethereum/go-ethereum/rlp"
    

)`

@ghost
Copy link

ghost commented Nov 7, 2017

Mmm, this is weird, is the very output I get.

Last request @kidinamoto01, please can you give me the output of the following commands?

echo "ipldeth github.com/ipfs/go-ipld-eth/plugin 0" >> $GOPATH/src/github.com/ipfs/go-ipfs/plugin/loader/preload_list
sed -i '' 's/package main/package plugin/' $GOPATH/src/github.com/ipfs/go-ipld-eth/plugin/eth.go
gx-go rw

git diff plugin/eth.go
cd $GOPATH/src/github.com/ipfs/go-ipfs && git diff

I am, as a reference, getting the following

 hj: go-ipld-eth ]$ git diff plugin/eth.go
diff --git a/plugin/eth.go b/plugin/eth.go
index eac7f06..73a3b58 100644
--- a/plugin/eth.go
+++ b/plugin/eth.go
@@ -1,13 +1,13 @@
-package main
+package plugin

 import (
        "io"

-       block "github.com/ipfs/go-block-format"
        "github.com/ipfs/go-ipfs/core/coredag"
        plugin "github.com/ipfs/go-ipfs/plugin"
        eth "github.com/ipfs/go-ipld-eth"
-       node "github.com/ipfs/go-ipld-format"
+       node "gx/ipfs/QmPN7cwmpcc4DWXb4KTB9dNAJgjuPY69h3npsMfhRrQL9c/go-ipld-format"
+       block "gx/ipfs/QmSn9Td7xgxm9EV7iEjTckpUWmWApggzPxu7eFGWkkpwin/go-block-format"
 )

 // Plugins declare what and how many of these will be defined.
[ hj: go-ipld-eth ]$ cd $GOPATH/src/github.com/ipfs/go-ipfs && git diff
diff --git a/plugin/loader/preload_list b/plugin/loader/preload_list
index 8c62c673..ddfeb36d 100644
--- a/plugin/loader/preload_list
+++ b/plugin/loader/preload_list
@@ -4,3 +4,4 @@
 # name             go-path                  number of the sub-plugin

 #ipldgit github.com/ipfs/go-ipfs/plugin/plugins/git 0
+ipldeth github.com/ipfs/go-ipld-eth/plugin 0

@kidinamoto01
Copy link
Author

kidinamoto01 commented Nov 8, 2017

@hermanjunge
Here's what I got

cd $GOPATH/src/github.com/ipfs/go-ipfs && git diff
diff --git a/plugin/loader/preload.go b/plugin/loader/preload.go
index cc0d8651..a030574d 100644
--- a/plugin/loader/preload.go
+++ b/plugin/loader/preload.go
@@ -2,10 +2,18 @@ package loader

 import (
        "github.com/ipfs/go-ipfs/plugin"
+       pluginipldeth "github.com/ipfs/go-ipld-eth/plugin"
 )

 // DO NOT EDIT THIS FILE
 // This file is being generated as part of plugin build process
 // To change it, modify the plugin/loader/preload.sh

-var preloadPlugins = []plugin.Plugin{}
+var preloadPlugins = []plugin.Plugin{
+       pluginipldeth.Plugins[0],
+       pluginipldeth.Plugins[0],
+       pluginipldeth.Plugins[0],
+       pluginipldeth.Plugins[0],
+       pluginipldeth.Plugins[0],
+       pluginipldeth.Plugins[0],
+}
diff --git a/plugin/loader/preload_list b/plugin/loader/preload_list
index 8c62c673..f9b2f127 100644
--- a/plugin/loader/preload_list
+++ b/plugin/loader/preload_list
@@ -4,3 +4,11 @@
 # name             go-path                  number of the sub-plugin

 #ipldgit github.com/ipfs/go-ipfs/plugin/plugins/git 0
+ipldeth github.com/ipfs/go-ipld-eth/plugin 0
+ipldeth github.com/ipfs/go-ipld-eth/plugin 0
+ipldeth github.com/ipfs/go-ipld-eth/plugin 0
+ipldeth github.com/ipfs/go-ipld-eth/plugin 0
+ipldeth github.com/ipfs/go-ipld-eth/plugin 0
+ipldeth github.com/ipfs/go-ipld-eth/plugin 0
+ipldeth github.com/ipfs/go-ipld-eth/plugin 0
+ipldeth github.com/ipfs/go-ipld-eth/plugin 0

@kidinamoto01
Copy link
Author

kidinamoto01 commented Nov 8, 2017

Hello again @hermanjunge
I switched to Ubuntu VM , and it seems the packages are installed correctly.
Here's what I've done

 go get -u github.com/whyrusleeping/gx
 go get -u github.com/whyrusleeping/gx-go

gx-go rw
gx install --global

go build -buildmode=plugin -o=ethereum.so
mv ethereum.so ~/.ipfs/plugins/
chmod +x ~/.ipfs/plugins/ethereum.so

cat ./test_data/eth-block-body-json-997522 | ipfs dag put --input-enc json --format eth-block

This is what i got

Error: no parser for format "eth-block" using input type "json"

@ghost
Copy link

ghost commented Nov 8, 2017

Everything seems fine here. Have you tried to restart the ipfs daemon?

@kidinamoto01
Copy link
Author

kidinamoto01 commented Nov 10, 2017

yes, I forgot to restart IPFS:
I seems I need to update the Go version
Error: loading plugin /home/suyu/ipfs/data/plugins/ethereum.so: plugin.Open: /home/ipfs//plugins/ethereum.so: invalid ELF header

readelf -h ethereum.so

File: ethereum.so(__.PKGDEF )
readelf: Error: Not an ELF file - it has the wrong magic bytes at the start

File: ethereum.so(go.o )
readelf: Error: Not an ELF file - it has the wrong magic bytes at the start

@ghost ghost closed this as completed Nov 24, 2017
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants