btcsuite / btcd

An alternative full node bitcoin implementation written in Go (golang)
https://github.com/btcsuite/btcd/blob/master/README.md
ISC License
6.19k stars 2.35k forks source link

Failed to build forked repo #1333

Closed lzl124631x closed 5 years ago

lzl124631x commented 5 years ago

Note that I can run this original btcd project. However, I can't build my forked repo which is identical to this repo.

I first tried go get ./..., but:

Richards-MacBook-Pro:btcd ricl$ go get ./...
database/ffldb/db.go:19:2: use of internal package not allowed

Then I tried to follow the README.

  1. Ran glide install. It succeeded but with a warning.
Richards-MacBook-Pro:btcd ricl$ glide install
[WARN]  The name listed in the config file (github.com/btcsuite/btcd) does not match the current location (github.com/lzl124631x/btcd)
  1. Then I ran go install . ./cmd/... but got these errors.
Richards-MacBook-Pro:btcd ricl$ go install . ./cmd/...
# github.com/lzl124631x/btcd/cmd/addblock
cmd/addblock/addblock.go:75:41: cannot use backendLogger.Logger("BCDB") (type "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger) as type "github.com/btcsuite/btclog".Logger in argument to database.UseLogger:
        "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger does not implement "github.com/btcsuite/btclog".Logger (wrong type for Level method)
                have Level() "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Level
                want Level() "github.com/btcsuite/btclog".Level
cmd/addblock/addblock.go:76:43: cannot use backendLogger.Logger("CHAN") (type "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger) as type "github.com/btcsuite/btclog".Logger in argument to blockchain.UseLogger:
        "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger does not implement "github.com/btcsuite/btclog".Logger (wrong type for Level method)
                have Level() "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Level
                want Level() "github.com/btcsuite/btclog".Level
cmd/addblock/addblock.go:77:41: cannot use backendLogger.Logger("INDX") (type "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger) as type "github.com/btcsuite/btclog".Logger in argument to indexers.UseLogger:
        "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger does not implement "github.com/btcsuite/btclog".Logger (wrong type for Level method)
                have Level() "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Level
                want Level() "github.com/btcsuite/btclog".Level
cmd/addblock/import.go:132:53: cannot use block (type *"github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btcutil".Block) as type *"github.com/btcsuite/btcutil".Block in argument to bi.chain.ProcessBlock
# github.com/lzl124631x/btcd
./log.go:76:19: cannot use amgrLog (type "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger) as type "github.com/btcsuite/btclog".Logger in argument to addrmgr.UseLogger:
        "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger does not implement "github.com/btcsuite/btclog".Logger (wrong type for Level method)
                have Level() "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Level
                want Level() "github.com/btcsuite/btclog".Level
./log.go:77:19: cannot use cmgrLog (type "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger) as type "github.com/btcsuite/btclog".Logger in argument to connmgr.UseLogger:
        "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger does not implement "github.com/btcsuite/btclog".Logger (wrong type for Level method)
                have Level() "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Level
                want Level() "github.com/btcsuite/btclog".Level
./log.go:78:20: cannot use bcdbLog (type "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger) as type "github.com/btcsuite/btclog".Logger in argument to database.UseLogger:
        "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger does not implement "github.com/btcsuite/btclog".Logger (wrong type for Level method)
                have Level() "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Level
                want Level() "github.com/btcsuite/btclog".Level
./log.go:79:22: cannot use chanLog (type "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger) as type "github.com/btcsuite/btclog".Logger in argument to blockchain.UseLogger:
        "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger does not implement "github.com/btcsuite/btclog".Logger (wrong type for Level method)
                have Level() "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Level
                want Level() "github.com/btcsuite/btclog".Level
./log.go:80:20: cannot use indxLog (type "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger) as type "github.com/btcsuite/btclog".Logger in argument to indexers.UseLogger:
        "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger does not implement "github.com/btcsuite/btclog".Logger (wrong type for Level method)
                have Level() "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Level
                want Level() "github.com/btcsuite/btclog".Level
./log.go:81:18: cannot use minrLog (type "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger) as type "github.com/btcsuite/btclog".Logger in argument to mining.UseLogger:
        "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger does not implement "github.com/btcsuite/btclog".Logger (wrong type for Level method)
                have Level() "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Level
                want Level() "github.com/btcsuite/btclog".Level
./log.go:82:20: cannot use minrLog (type "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger) as type "github.com/btcsuite/btclog".Logger in argument to cpuminer.UseLogger:
        "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger does not implement "github.com/btcsuite/btclog".Logger (wrong type for Level method)
                have Level() "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Level
                want Level() "github.com/btcsuite/btclog".Level
./log.go:83:16: cannot use peerLog (type "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger) as type "github.com/btcsuite/btclog".Logger in argument to peer.UseLogger:
        "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger does not implement "github.com/btcsuite/btclog".Logger (wrong type for Level method)
                have Level() "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Level
                want Level() "github.com/btcsuite/btclog".Level
./log.go:84:20: cannot use scrpLog (type "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger) as type "github.com/btcsuite/btclog".Logger in argument to txscript.UseLogger:
        "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger does not implement "github.com/btcsuite/btclog".Logger (wrong type for Level method)
                have Level() "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Level
                want Level() "github.com/btcsuite/btclog".Level
./log.go:85:19: cannot use syncLog (type "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger) as type "github.com/btcsuite/btclog".Logger in argument to netsync.UseLogger:
        "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Logger does not implement "github.com/btcsuite/btclog".Logger (wrong type for Level method)
                have Level() "github.com/lzl124631x/btcd/vendor/github.com/btcsuite/btclog".Level
                want Level() "github.com/btcsuite/btclog".Level
./log.go:85:19: too many errors
Richards-MacBook-Pro:btcd ricl$
totaloutput commented 5 years ago

@lzl124631x can you post your GOPATH and current directory? go env and pwd

lzl124631x commented 5 years ago

@totaloutput Thanks.

Richards-MacBook-Pro:btcd ricl$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ricl/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/ricl/GoPath"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
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=/var/folders/th/vrgvr11j10d2sds7kw_z6tn00000gn/T/go-build471543907=/tmp/go-build -gno-record-gcc-switches -fno-common"
Richards-MacBook-Pro:btcd ricl$ pwd
/Users/ricl/GoPath/src/github.com/lzl124631x/btcd

The original btcd is at /Users/ricl/GoPath/src/github.com/btcsuite/btcd

totaloutput commented 5 years ago

@lzl124631x can you try run glide install and go install . ./cmd/... under /Users/ricl/GoPath/src/github.com/btcsuite/btcd

lzl124631x commented 5 years ago

Tried. Everything looks fine. The btcd executable is generated in /Users/ricl/GoPath/bin.

Then I tried glide install/ go install . ./cmd/... again in /Users/ricl/GoPath/src/github.com/lzl124631x/btcd. Same issue as I mentioned before.


I figured out. I need to change the first line of glide.yaml to package: github.com/lzl124631x/btcd. Then everything works now!

Thanks @totaloutput

lzl124631x commented 5 years ago

@totaloutput BTW, is there any chance that you can help look at this issue https://github.com/btcsuite/btcd/issues/1334?