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

OpenWRT install go-ethereum #3724

Closed
EasonWang01 opened this issue Feb 28, 2017 · 16 comments
Closed

OpenWRT install go-ethereum #3724

EasonWang01 opened this issue Feb 28, 2017 · 16 comments

Comments

@EasonWang01
Copy link

EasonWang01 commented Feb 28, 2017

I want to install go-ethereum on an mips cpu and openWRT,

how to install it ?thanks.

@karalabe
Copy link
Member

MIPS32 or MIPS64?

The simplest approach (probably painful) is to clone the go-ethereum codebase onto your device, install Go 1.8 on it and build it on device. Cross compiling is a bit more involved, since you need to set up your toolkits in your host machine to build to the guest machine.

The makfile contains a docker based cross compiler that in theory should be able to churn out a 64bit mips binary, but it's been a long time since I worked with cross compilation and I haven't ported it to mips32 yet.

@EasonWang01
Copy link
Author

EasonWang01 commented Mar 1, 2017

It's MIPS 24KEc 32-bit

RAM 128MB DDR2

If I done cross-compile and copy to target device,is it able run the ethereum node itself?Should I disable JIT or something for establish private network.

@karalabe
Copy link
Member

karalabe commented Mar 1, 2017

Hi,

I did a quick cross compilation of Geth 1.6.0 to mips32 and mips32le. Could you try these and see if they work? I don't have an OpenWRT system so I've really no clue.

If it works ok, we can integrate it into our makefile and build systems.

geth-1.6.0-mips32.zip

@EasonWang01
Copy link
Author

It says

root@test:~/geth# ./geth-linux-mips
./geth-linux-mips: line 1: syntax error: unexpected "("

@karalabe
Copy link
Member

karalabe commented Mar 1, 2017

Could you please try to little endian version too? (mipsle)

@EasonWang01
Copy link
Author

It says

root@test:/tmp/run/mountd/mmcblk0p1/geth-1.6.0-mips32# ./geth-linux-mipsle
-ash: ./geth-linux-mipsle: not found
root@test:/tmp/run/mountd/mmcblk0p1/geth-1.6.0-mips32# ./geth-linux-mips
./geth-linux-mips: line 1: syntax error: unexpected "("

@karalabe
Copy link
Member

karalabe commented Mar 1, 2017

Could you try again with these? I've forced static linking in my toolchain. This seems to work for me in my openwrt emulator for mips.

Btw, according to the logs above, your system is running in little endian mode, so you'll need mipsle.

geth-mips-static.zip

@EasonWang01
Copy link
Author

EasonWang01 commented Mar 1, 2017

I thought it works but after 3sec some logs appear.

root@test:/tmp/run/mountd/mmcblk0p1/geth-mips-static# ./geth-linux-mipsle
ERROR[03-01|14:55:29] WARNING: No etherbase set and no accounts found as default 
INFO [03-01|14:55:29] Allotted 128MB cache and 1024 file handles to /root/.ethereum/geth/chaindata 
INFO [03-01|14:55:29] closed db:/root/.ethereum/geth/chaindata 
INFO [03-01|14:55:29] instance:Geth/v1.6.0-unstable/linux/go1.8 
INFO [03-01|14:55:29] Allotted 128MB cache and 1024 file handles to /root/.ethereum/geth/chaindata 
INFO [03-01|14:55:29] Protocol Versions: [63 62], Network Id: 1 
SIGILL: illegal instruction
PC=0x64b8a4 m=7 sigcode=128

goroutine 1 [running]:
github.com/ethereum/go-ethereum/trie.(*fullNode).cache(0x5bbd3680, 0x8ac698, 0xc15538, 0x4341c4, 0x4672b0)
	/ext-go/1/src/github.com/ethereum/go-ethereum/trie/node.go:75 fp=0x5b92c910 sp=0x5b92c910
github.com/ethereum/go-ethereum/trie.(*hasher).hash(0x5b8750e0, 0x13e66e0, 0x5bbd3680, 0x46139ca0, 0x5a2c6010, 0x1, 0x34, 0x41130c, 0x457110e4, 0x34, ...)
	/ext-go/1/src/github.com/ethereum/go-ethereum/trie/hasher.go:56 +0x48 fp=0x5b92c9c0 sp=0x5b92c910
github.com/ethereum/go-ethereum/trie.(*Trie).hashRoot(0x59e8a8c0, 0x46139ca0, 0x5a2c6010, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/ext-go/1/src/github.com/ethereum/go-ethereum/trie/trie.go:509 +0xd8 fp=0x5b92ca08 sp=0x5b92c9c0
github.com/ethereum/go-ethereum/trie.(*Trie).CommitTo(0x59e8a8c0, 0x46139ca0, 0x5a2c6010, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/ext-go/1/src/github.com/ethereum/go-ethereum/trie/trie.go:494 +0x6c fp=0x5b92ca98 sp=0x5b92ca08
github.com/ethereum/go-ethereum/trie.(*SecureTrie).CommitTo(0x59e8a8c0, 0x46139ca0, 0x5a2c6010, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/ext-go/1/src/github.com/ethereum/go-ethereum/trie/secure_trie.go:182 +0xf0 fp=0x5b92cb64 sp=0x5b92ca98
github.com/ethereum/go-ethereum/core/state.(*StateDB).commit(0x5759a000, 0x46139ca0, 0x5a2c6010, 0x46139c00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/ext-go/1/src/github.com/ethereum/go-ethereum/core/state/statedb.go:655 +0x210 fp=0x5b92cc10 sp=0x5b92cb64
github.com/ethereum/go-ethereum/core/state.(*StateDB).CommitBatch(0x5759a000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/ext-go/1/src/github.com/ethereum/go-ethereum/core/state/statedb.go:614 +0xbc fp=0x5b92cc94 sp=0x5b92cc10
github.com/ethereum/go-ethereum/core.WriteGenesisBlock(0x13e9a40, 0x5754a060, 0x13e2f70, 0x57546100, 0x0, 0x0, 0x0)
	/ext-go/1/src/github.com/ethereum/go-ethereum/core/genesis.go:91 +0x548 fp=0x5b92d1fc sp=0x5b92cc94
github.com/ethereum/go-ethereum/core.WriteDefaultGenesisBlock(0x13e9a40, 0x5754a060, 0x0, 0x0, 0x0)
	/ext-go/1/src/github.com/ethereum/go-ethereum/core/genesis.go:204 +0xb8 fp=0x5b92d228 sp=0x5b92d1fc
github.com/ethereum/go-ethereum/eth.New(0x598e8150, 0x5787dd40, 0x5781b100, 0x598e815c, 0x57655d18)
	/ext-go/1/src/github.com/ethereum/go-ethereum/eth/backend.go:197 +0xd00 fp=0x5b92fb44 sp=0x5b92d228
github.com/ethereum/go-ethereum/cmd/utils.RegisterEthService.func2(0x598e8150, 0x598ea2c0, 0x57655d00, 0x598ea2e0, 0x0)
	/ext-go/1/src/github.com/ethereum/go-ethereum/cmd/utils/flags.go:784 +0x48 fp=0x5b92fb70 sp=0x5b92fb44
github.com/ethereum/go-ethereum/node.(*Node).Start(0x575e0c80, 0x0, 0x0)
	/ext-go/1/src/github.com/ethereum/go-ethereum/node/node.go:192 +0x628 fp=0x5b92fdb0 sp=0x5b92fb70
github.com/ethereum/go-ethereum/cmd/utils.StartNode(0x575e0c80)
	/ext-go/1/src/github.com/ethereum/go-ethereum/cmd/utils/cmd.go:62 +0x3c fp=0x5b92fdd0 sp=0x5b92fdb0
main.startNode(0x5759a500, 0x575e0c80)
	/ext-go/1/src/github.com/ethereum/go-ethereum/cmd/geth/main.go:247 +0x40 fp=0x5b92fe5c sp=0x5b92fdd0
main.geth(0x5759a500, 0xb2d05e00, 0x0)
	/ext-go/1/src/github.com/ethereum/go-ethereum/cmd/geth/main.go:190 +0x58 fp=0x5b92fe6c sp=0x5b92fe5c
github.com/ethereum/go-ethereum/vendor/gopkg.in/urfave/cli%2ev1.HandleAction(0xd78740, 0xf2be74, 0x5759a500, 0x5759a500, 0x5765dfac)
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/gopkg.in/urfave/cli.v1/app.go:485 +0x10c fp=0x5b92fe7c sp=0x5b92fe6c
github.com/ethereum/go-ethereum/vendor/gopkg.in/urfave/cli%2ev1.(*App).Run(0x57592ea0, 0x575400d0, 0x1, 0x1, 0x0, 0x0)
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/gopkg.in/urfave/cli.v1/app.go:259 +0x584 fp=0x5b92ff98 sp=0x5b92fe7c
main.main()
	/ext-go/1/src/github.com/ethereum/go-ethereum/cmd/geth/main.go:179 +0x64 fp=0x5b92ffc4 sp=0x5b92ff98
runtime.main()
	/usr/local/go/src/runtime/proc.go:185 +0x238 fp=0x5b92ffec sp=0x5b92ffc4
runtime.goexit()
	/usr/local/go/src/runtime/asm_mipsx.s:944 +0x4 fp=0x5b92ffec sp=0x5b92ffec

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
	/usr/local/go/src/runtime/asm_mipsx.s:944 +0x4

goroutine 6 [chan receive]:
github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify.(*nonrecursiveTree).dispatch(0x575c33c0, 0x575c3340)
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify/tree_nonrecursive.go:36 +0x58
created by github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify.newNonrecursiveTree
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify/tree_nonrecursive.go:29 +0x16c

goroutine 7 [chan receive]:
github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify.(*nonrecursiveTree).internal(0x575c33c0, 0x575c3380)
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify/tree_nonrecursive.go:81 +0x70
created by github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify.newNonrecursiveTree
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify/tree_nonrecursive.go:30 +0x198

goroutine 8 [syscall]:
os/signal.signal_recv(0x0)
	/usr/local/go/src/runtime/sigqueue.go:116 +0x100
os/signal.loop()
	/usr/local/go/src/os/signal/signal_unix.go:22 +0x34
created by os/signal.init.1
	/usr/local/go/src/os/signal/signal_unix.go:28 +0x50

goroutine 10 [select, locked to thread]:
runtime.gopark(0xf2c2f0, 0x0, 0xe6ed93, 0x6, 0x18, 0x2)
	/usr/local/go/src/runtime/proc.go:271 +0x128
runtime.selectgoImpl(0x57555fa0, 0x0, 0xc)
	/usr/local/go/src/runtime/select.go:423 +0x1208
runtime.selectgo(0x57555fa0)
	/usr/local/go/src/runtime/select.go:238 +0x18
runtime.ensureSigM.func1()
	/usr/local/go/src/runtime/signal_unix.go:434 +0x368
runtime.goexit()
	/usr/local/go/src/runtime/asm_mipsx.s:944 +0x4

goroutine 18 [syscall]:
syscall.Syscall6(0x109a, 0xe, 0x5754e7ac, 0x1, 0xffffffff, 0x0, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/syscall/asm_linux_mipsx.s:45 +0x10
syscall.EpollWait(0xe, 0x5754e7ac, 0x1, 0x1, 0xffffffff, 0x0, 0x0, 0x0)
	/usr/local/go/src/syscall/zsyscall_linux_mipsle.go:363 +0x6c
github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify.(*inotify).loop(0x575e4000, 0x578b6740)
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify/watcher_inotify.go:193 +0x88
created by github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify.(*inotify).lazyinit
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify/watcher_inotify.go:133 +0x16c

goroutine 12 [select]:
github.com/ethereum/go-ethereum/accounts/keystore.(*watcher).loop(0x57833ab0)
	/ext-go/1/src/github.com/ethereum/go-ethereum/accounts/keystore/watch.go:91 +0x5d8
created by github.com/ethereum/go-ethereum/accounts/keystore.(*watcher).start
	/ext-go/1/src/github.com/ethereum/go-ethereum/accounts/keystore/watch.go:52 +0x80

goroutine 13 [select]:
github.com/ethereum/go-ethereum/accounts/keystore.(*KeyStore).updater(0x5787db00)
	/ext-go/1/src/github.com/ethereum/go-ethereum/accounts/keystore/keystore.go:203 +0x188
created by github.com/ethereum/go-ethereum/accounts/keystore.(*KeyStore).Subscribe
	/ext-go/1/src/github.com/ethereum/go-ethereum/accounts/keystore/keystore.go:190 +0x13c

goroutine 14 [chan receive]:
github.com/ethereum/go-ethereum/accounts/usbwallet.(*LedgerHub).updater(0x5787db90)
	/ext-go/1/src/github.com/ethereum/go-ethereum/accounts/usbwallet/ledger_hub.go:179 +0x6c
created by github.com/ethereum/go-ethereum/accounts/usbwallet.(*LedgerHub).Subscribe
	/ext-go/1/src/github.com/ethereum/go-ethereum/accounts/usbwallet/ledger_hub.go:164 +0x13c

goroutine 15 [select]:
github.com/ethereum/go-ethereum/accounts.(*Manager).update(0x5781b100)
	/ext-go/1/src/github.com/ethereum/go-ethereum/accounts/manager.go:95 +0x35c
created by github.com/ethereum/go-ethereum/accounts.NewManager
	/ext-go/1/src/github.com/ethereum/go-ethereum/accounts/manager.go:68 +0x55c

goroutine 27 [select]:
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.(*DB).compactionError(0x575b7900)
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go:90 +0x550
created by github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.openDB
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/db.go:139 +0x504

goroutine 19 [chan receive]:
github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify.(*inotify).send(0x575e4000, 0x578b6740)
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify/watcher_inotify.go:253 +0x5c
created by github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify.(*inotify).lazyinit
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify/watcher_inotify.go:136 +0x1d0

goroutine 20 [chan receive]:
github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify.(*inotify).send(0x575e4000, 0x578b6740)
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify/watcher_inotify.go:253 +0x5c
created by github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify.(*inotify).lazyinit
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify/watcher_inotify.go:136 +0x1d0

goroutine 28 [select]:
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.(*DB).mpoolDrain(0x575b7900)
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/db_state.go:96 +0x244
created by github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.openDB
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/db.go:140 +0x528

goroutine 26 [select]:
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/util.(*BufferPool).drain(0x575d8a50)
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/util/buffer_pool.go:206 +0x258
created by github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/util.NewBufferPool
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/util/buffer_pool.go:237 +0x1c4

goroutine 29 [select]:
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.(*DB).tCompaction(0x575b7900)
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go:804 +0x580
created by github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.openDB
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/db.go:146 +0x67c

goroutine 30 [select]:
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.(*DB).mCompaction(0x575b7900)
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go:751 +0x230
created by github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.openDB
	/ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/db.go:147 +0x6a0

r0   0x0	r1   0x13e66e0
r2   0x64b8a4	r3   0x5bbd3680
r4   0x657520	r5   0x1
r6   0x5754c060	r7   0x5bbd8680
r8   0x1	r9   0x472f1000
r10  0x1c	r11  0x1011852
r12  0x0	r13  0x0
r14  0xf5	r15  0x8
r16  0x0	r17  0x0
r18  0x4672b0	r19  0x5b92c924
r20  0x575320f0	r21  0x2ef6ec11
r22  0x5b92c9fc	r23  0x14d0000
r24  0x0	r25  0x78fb9024
r26  0x0	r27  0x0
r28  0xbc002970	r29  0x5b92c910
r30  0x575320f0	r31  0x6486d4
pc   0x64b8a4	link 0x6486d4
lo   0x0	hi   0x0

@karalabe
Copy link
Member

karalabe commented Mar 1, 2017

Hmm, ok, at least we're one step closer :) Let me see what these logs mean :D

@karalabe
Copy link
Member

karalabe commented Mar 1, 2017

Reading up on the Go 1.8 release notes, it states:

Go now supports 32-bit MIPS on Linux for both big-endian (linux/mips) and little-endian machines (linux/mipsle) that implement the MIPS32r1 instruction set with FPU or kernel FPU emulation. Note that many common MIPS-based routers lack an FPU and have firmware that doesn't enable kernel FPU emulation; Go won't run on such machines.

Now, according to some wiki-like page:

  • The 24KEc is a 32-bit RISC core for high performance applications.
  • The 24KEf core adds an IEEE-754 compliant floating point unit. (CP0 Status Reg, Bit 29 set for Floating Point Unit)

which means that your CPU doesn't seem to have a floating point unit, but Go currently does require one to run. I'm guessing it should be possible for you to enable kernel FPU emulation, though I'm unfamiliar with exactly what that entail (i.e. flipping some config and rebooting, or rebuilding the kernel).

@EasonWang01
Copy link
Author

Thanks,I will try it tomorrow then update here.

@EasonWang01
Copy link
Author

EasonWang01 commented Mar 2, 2017

Hi,do you think it's useful?

Use a floating point emulation library
The application program written in high-level language uses the floating point operations asis, but the compiler, instead of generating floating point instructions for them, generates calls to the floating point emulation functions. These emulation functions are provided by some library, against which the program is then linked. The GNU C Library glibc also comes with support for floating point emulation. Note that the default glibc distribution might not have the floating point emultion (FPE) support, but glibc has a configure option using which we can compile glibc with FPE support.

GeertJohan/openwrt-go#12

@karalabe
Copy link
Member

karalabe commented Mar 2, 2017 via email

@karalabe
Copy link
Member

karalabe commented Mar 9, 2017

Soft float CLs are currently under review upstream in Go. Hopefully in a week or so we can do another test trial with this :)

@EasonWang01
Copy link
Author

thanks!

@stale
Copy link

stale bot commented Mar 11, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot closed this as completed Apr 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants