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

Build fails in Go 1.10.3, 1.10.4 and 1.11 #2253

Closed
4 tasks
sunnya97 opened this issue Sep 7, 2018 · 45 comments
Closed
4 tasks

Build fails in Go 1.10.3, 1.10.4 and 1.11 #2253

sunnya97 opened this issue Sep 7, 2018 · 45 comments

Comments

@sunnya97
Copy link
Member

sunnya97 commented Sep 7, 2018

Summary of Bug

I believe this is from the Ledger dependency:

vendor/github.com/brejski/hid/hid_darwin.go:162: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFStringCreateWithBytes
vendor/github.com/brejski/hid/hid_darwin.go:216: cannot use nil as type _Ctype_CFDictionaryRef in argument to func literal

Steps to Reproduce

Run make when using Go 1.10.4 or 1.11. Works with 1.10.1

I did not test 1.10.2 and 1.10.3


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@adrianbrink
Copy link
Contributor

It also works with 1.10.3

@flyq
Copy link

flyq commented Sep 7, 2018

I failed too.

go version go1.10.3 linux/amd64

make install
go install -tags "netgo ledger" -ldflags "-X github.com/cosmos/cosmos-sdk/version.GitCommit=416181be" ./cmd/gaia/cmd/gaiad

github.com/cosmos/cosmos-sdk/store

store/iavlstore.go:43:8: undefined: iavl.VersionedTree
Makefile:61: recipe for target 'install' failed
make: *** [install] Error 2

go test -v iavlstore_test.go

command-line-arguments

./iavlstore_test.go:32:41: undefined: iavl.VersionedTree
./iavlstore_test.go:32:61: undefined: CommitID
./iavlstore_test.go:33:10: undefined: iavl.NewVersionedTree
./iavlstore_test.go:44:15: undefined: CommitID
./iavlstore_test.go:50:15: undefined: newIAVLStore
./iavlstore_test.go:75:15: undefined: newIAVLStore
./iavlstore_test.go:148:15: undefined: newIAVLStore
./iavlstore_test.go:207:15: undefined: newIAVLStore
./iavlstore_test.go:263:24: undefined: iavlStore
./iavlstore_test.go:325:10: undefined: iavl.NewVersionedTree
./iavlstore_test.go:325:10: too many errors
FAIL command-line-arguments [build failed]

@alexanderbez
Copy link
Contributor

@flyq I believe you need to update your vendor dependencies.

@alexanderbez
Copy link
Contributor

/cc @zmanian

@ValarDragon
Copy link
Contributor

I think we just need to update our dependency for brejski/hid.

@zmanian
Copy link
Member

zmanian commented Sep 7, 2018

If you update
https://github.com/ZondaX/ledger-goclient to master from v0.1

Are folks only having problems on MacOS or linux/windows as well?

Should we pull packages living under ZondaX into the Tendermint org? I think we will have to maintain them

@zramsay
Copy link
Contributor

zramsay commented Sep 8, 2018

vendor/github.com/ZondaX/hid-go/hid_darwin.go:216: cannot use 0 (type int) as type *_Ctype_struct___CFDictionary in argument to func literal

that's with the latest update to master as suggested by @zmanian. Notice its the same line but different error as Sunny.

using:
go version go1.10.3 darwin/amd64

@rigelrozanski
Copy link
Contributor

passes once upgraded to 1.11 for me

@zramsay
Copy link
Contributor

zramsay commented Sep 8, 2018

^ ditto. works now for me

@ValarDragon
Copy link
Contributor

Closing due to fix

@jackzampolin
Copy link
Member

jackzampolin commented Sep 10, 2018

Still running into this issue on 1.10.3...

cosmos-sdk [develop] :> make get_vendor_deps
--> Generating vendor directory via dep ensure
(1/55) Wrote github.com/pelletier/go-toml@v1.2.0
(2/55) Wrote github.com/pkg/errors@v0.8.0
(3/55) Wrote github.com/tendermint/iavl@v0.11.0
(4/55) Wrote github.com/prometheus/common@master
(5/55) Wrote github.com/syndtr/goleveldb@master
(6/55) Wrote github.com/zondax/ledger-goclient@v0.1.0
(7/55) Wrote github.com/tendermint/tmlibs@v0.9.0
(8/55) Wrote github.com/tendermint/go-amino@v0.12.0-rc0
(9/55) Wrote gopkg.in/yaml.v2@v2.2.1
(10/55) Wrote github.com/stretchr/testify@v1.2.1
(11/55) Wrote github.com/prometheus/client_model@master
(12/55) Wrote github.com/pmezard/go-difflib@v1.0.0
(13/55) Wrote github.com/tendermint/ed25519@master
(14/55) Wrote github.com/prometheus/client_golang@ae27198cdd90bf12cd134ad79d1366a6cf49f632
(15/55) Wrote github.com/prometheus/procfs@master
(16/55) Wrote github.com/davecgh/go-spew@v1.1.1
(17/55) Wrote github.com/ebuchman/fail-test@95f809107225be108efcf10a3509e4ea6ceef3c4
(18/55) Wrote github.com/rcrowley/go-metrics@e2704e165165ec55d062f5919b4b29494e9fa790
(19/55) Wrote github.com/btcsuite/btcutil@d4cc87b860166d00d6b5b9e0d3b3d71d6088d4d4
(20/55) Wrote github.com/spf13/afero@v1.1.1
(21/55) Wrote github.com/ZondaX/hid-go@master
(22/55) Wrote github.com/fsnotify/fsnotify@v1.4.7
(23/55) Wrote github.com/gorilla/context@v1.1.1
(24/55) Wrote github.com/gogo/protobuf@v1.1.1
(25/55) Wrote github.com/tendermint/tendermint@v0.23.1-rc0
(26/55) Wrote github.com/hashicorp/hcl@master
(27/55) Wrote github.com/bartekn/go-bip39@a05967ea095d81c8fe4833776774cfaff8e5036c
(28/55) Wrote github.com/spf13/cast@v1.2.0
(29/55) Wrote github.com/inconshreveable/mousetrap@v1.0
(30/55) Wrote golang.org/x/sys@master
(31/55) Wrote github.com/gorilla/websocket@v1.2.0
(32/55) Wrote github.com/beorn7/perks@master
(33/55) Wrote github.com/golang/snappy@master
(34/55) Wrote github.com/gorilla/mux@v1.6.2
(35/55) Wrote golang.org/x/crypto@master
(36/55) Wrote github.com/bgentry/speakeasy@v0.1.0
(37/55) Wrote github.com/spf13/cobra@v0.0.1
(38/55) Wrote github.com/matttproud/golang_protobuf_extensions@v1.0.1
(39/55) Wrote github.com/mattn/go-isatty@v0.0.3
(40/55) Wrote google.golang.org/genproto@master
(41/55) Wrote github.com/spf13/jwalterweatherman@master
(42/55) Wrote google.golang.org/grpc@v1.13.0
(43/55) Wrote github.com/mitchellh/mapstructure@v1.0.0
(44/55) Wrote github.com/jmhodges/levigo@master
(45/55) Wrote github.com/spf13/pflag@v1.0.2
(46/55) Wrote golang.org/x/net@292b43bbf7cb8d35ddf40f8d5100ef3837cced3f
(47/55) Wrote github.com/spf13/viper@v1.0.0
(48/55) Wrote golang.org/x/text@v0.3.0
(49/55) Wrote github.com/go-logfmt/logfmt@v0.3.0
(50/55) Wrote github.com/magiconair/properties@v1.8.0
(51/55) Wrote github.com/kr/logfmt@master
(52/55) Wrote github.com/go-stack/stack@v1.7.0
(53/55) Wrote github.com/btcsuite/btcd@master
(54/55) Wrote github.com/go-kit/kit@v0.6.0
(55/55) Wrote github.com/golang/protobuf@v1.1.0
cosmos-sdk [develop] :> make install
go install -tags "netgo ledger" -ldflags "-X github.com/cosmos/cosmos-sdk/version.GitCommit=e13cdc02" ./cmd/gaia/cmd/gaiad
# github.com/cosmos/cosmos-sdk/vendor/github.com/ZondaX/hid-go
vendor/github.com/ZondaX/hid-go/hid_darwin.go:216: cannot use 0 (type int) as type *_Ctype_struct___CFDictionary in argument to func literal
make: *** [install] Error 2
cosmos-sdk [develop] :> git rev-parse HEAD
e13cdc02606eb32d23fe94e05590b4e6914201d4

@jackzampolin jackzampolin changed the title Build fails in Go 1.10.4 and 1.11 Build fails in Go 1.10.3, 1.10.4 and 1.11 Sep 10, 2018
@rigelrozanski
Copy link
Contributor

latest develop still passes for me (with newest deps), I'm running go version go1.11 darwin/amd64

@alexanderbez
Copy link
Contributor

alexanderbez commented Sep 10, 2018

Able to replicate. I had to upgrade to go1.11 per @rigelrozanski suggestion.

@zramsay
Copy link
Contributor

zramsay commented Sep 11, 2018

ya, i got the exact same error on 1.10.3 and 1.11 did the trick

@RomanBrodetski
Copy link

fails for me with go version go1.11 darwin/amd64

@alexanderbez
Copy link
Contributor

@RomanBrodetski can you update your vendor dependencies?

@RomanBrodetski
Copy link

After running make get_vendor_deps it works, thanks!

@shanev
Copy link

shanev commented Sep 12, 2018

I know go modules aren't supported yet, but thought I'd put this here. Getting similar errors on go1.11 darwin/amd64:

cosmos-sdk@v0.24.2/store/iavlstore.go:43:8: undefined: iavl.VersionedTree

@alexanderbez
Copy link
Contributor

@shanev you need to update you vendor dependencies: make get_vendor_deps

@shanev
Copy link

shanev commented Sep 12, 2018

@alexanderbez I'm using go modules introduced in go 1.11. It downloads modules to $GOPATH/pkg/mod which isn't in GOPATH/src, so dep ensure can't run.

@alexanderbez
Copy link
Contributor

I see. I dont know if we have plans on supporting or using modules yet.

@zmanian
Copy link
Member

zmanian commented Sep 13, 2018

It seems like the migration path to modules is to have a known good Gopkg.lock file for go1.11 and then run go mod init

https://github.com/golang/go/wiki/Modules#how-to-define-a-module

@dokwon
Copy link

dokwon commented Sep 18, 2018

Getting similar errors on go1.11 darwin/amd64

running make get_vendor_deps and them compiling still results in the same error.

@peterbourgon
Copy link

peterbourgon commented Sep 18, 2018

On a brand-new install, after a successful make get_vendor_deps.

$ go version
go version go1.11 darwin/amd64

$ make install
go install -tags "netgo ledger" -ldflags "-X github.com/cosmos/cosmos-sdk/version.GitCommit=416181be" ./cmd/gaia/cmd/gaiad
# github.com/cosmos/cosmos-sdk/vendor/github.com/brejski/hid
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//IOKit.framework/IOKit.tbd and library file /System/Library/Frameworks//IOKit.framework/IOKit are out of sync. Falling back to library file for linking.
# github.com/cosmos/cosmos-sdk/vendor/github.com/brejski/hid
vendor/github.com/brejski/hid/hid_darwin.go:162:41: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFStringCreateWithBytes
vendor/github.com/brejski/hid/hid_darwin.go:216:149: cannot use nil as type _Ctype_CFDictionaryRef in argument to func literal

Maybe related?

edit: thanks to @xla I can get it built:

$ env CGO_ENABLED=0 make install
go install -tags "netgo ledger" -ldflags "-X github.com/cosmos/cosmos-sdk/version.GitCommit=416181be" ./cmd/gaia/cmd/gaiad
go install -tags "netgo ledger" -ldflags "-X github.com/cosmos/cosmos-sdk/version.GitCommit=416181be" ./cmd/gaia/cmd/gaiacli

@mabodx
Copy link

mabodx commented Sep 24, 2018

I had the same issue. @adrianbrink

➜  cosmos-sdk git:(master) ✗  go version
go version go1.11 darwin/amd64
➜  cosmos-sdk git:(master) ✗ make install
go install -tags "netgo ledger" -ldflags "-X github.com/cosmos/cosmos-sdk/version.GitCommit=416181be" ./cmd/gaia/cmd/gaiad
# github.com/cosmos-sdk/vendor/github.com/brejski/hid
vendor/github.com/brejski/hid/hid_darwin.go:162:41: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFStringCreateWithBytes
vendor/github.com/brejski/hid/hid_darwin.go:216:149: cannot use nil as type _Ctype_CFDictionaryRef in argument to func literal
make: *** [install] Error 2

image

@alexanderbez
Copy link
Contributor

@mabodx please update the vendor deps. iirc, github.com/brejski/hid isn't used anymore.

@peterbourgon
Copy link

@alexanderbez Right now master is 416181b, which lists github.com/brejski/hid in Gopkg.lock:

[[projects]]
  branch = "master"
  digest = "1:70f6b224a59b2fa453debffa85c77f71063d8754b90c8c4fbad5794e2c382b0f"
  name = "github.com/brejski/hid"
  packages = ["."]
  pruneopts = "UT"
  revision = "06112dcfcc50a7e0e4fd06e17f9791e788fdaafc"

It's a transitive dependency of github.com/zondax/ledger-goclient, imported by crypto/ledger.go.

@zmanian
Copy link
Member

zmanian commented Sep 24, 2018

So 48b08affede2cea076a3cf13b2e3f72ed262b743 is the latest from github.com/brejski/hid

if you aren't getting it from make get_vendor_deps, it's mostly likely that your dep is old. make update_tools will upgrade your dep and then make get_vendor_deps should get the correct hid verison.

@peterbourgon
Copy link

@zmanian Because cosmos/cosmos-sdk has checked in a Gopkg.lock file, dep won't pick a version of any dependency (direct or transitive) for me, it will use the specific revision that's recorded in that file. "The correct hid version" is the one that's listed there: 06112dc, not 48b08af.

To get me to use the latest rev 48b08af, a maintainer needs to re-run dep ensure, maybe via dep ensure -update github.com/brejski/hid, commit the resulting Gopkg.lock to master, and push that change.

@zmanian
Copy link
Member

zmanian commented Sep 26, 2018

Okay. I am asking for consensus on doing a v0.24.3 release to update the Gopkg.toml

@shanev
Copy link

shanev commented Sep 29, 2018

Using a vendored copy of Cosmos SDK.

Gopkg.toml:

[[constraint]]
  name = "github.com/cosmos/cosmos-sdk"
  branch = "develop"

go version go1.11 darwin/amd64

Dep seems to resolve an older version of tendermint/iavl for some reason.

# github.com/.../vendor/github.com/cosmos/cosmos-sdk/store/iavlstore.go:43:8: undefined: iavl.MutableTree
# github.com/.../vendor/github.com/tendermint/iavl
github.com/tendermint/iavl/proof_range.go:295:6: lastDepth declared but not used
vet: typecheck failures

@shanev
Copy link

shanev commented Sep 29, 2018

For anyone else having issues with vendored use, try this Gopkg.toml:

[[constraint]]
  name = "github.com/cosmos/cosmos-sdk"
  branch = "develop"

[[override]]
  name = "github.com/tendermint/iavl"
  version = "=v0.11.0"

[[override]]
  name = "github.com/tendermint/tendermint"
  version = "=v0.23.1-rc0"

Works for 1e26ba2.

@alexanderbez
Copy link
Contributor

@shanev I've experienced similar issues with using the SDK...as an SDK. Hoping with 0.25 many of these dependency issues will be resolved. Thanks!

@rednaxus
Copy link

rednaxus commented Oct 10, 2018

similar issues...

~/go/src/github.com/cosmos/cosmos-sdk$ make install
go install -tags "netgo ledger" -ldflags "-X github.com/cosmos/cosmos-sdk/version.GitCommit=416181be" ./cmd/gaia/cmd/gaiad
# github.com/cosmos/cosmos-sdk/vendor/github.com/brejski/hid
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//IOKit.framework/IOKit.tbd and library file /System/Library/Frameworks//IOKit.framework/IOKit are out of sync. Falling back to library file for linking.
# github.com/cosmos/cosmos-sdk/vendor/github.com/brejski/hid
vendor/github.com/brejski/hid/hid_darwin.go:162:41: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFStringCreateWithBytes
vendor/github.com/brejski/hid/hid_darwin.go:216:149: cannot use nil as type _Ctype_CFDictionaryRef in argument to func literal
make: *** [install] Error 2

works without package lock

@peterbourgon
Copy link

As a quick fix, try

env CGO_ENABLED=0 make install

@tanhuiya
Copy link

go version
go version go1.10.3 darwin/amd64

I create a new project using cosmos-sdk-cli
Then I go to the directory, and run make, It fails

$ make
go get github.com/golang/dep/cmd/dep
go build -o bin/th_projectcli cmd/th_projectcli/main.go && go build -o bin/th_projectd cmd/th_projectd/main.go
# th_project/vendor/github.com/cosmos/cosmos-sdk/store
vendor/github.com/cosmos/cosmos-sdk/store/iavlstore.go:43:8: undefined: iavl.VersionedTree
make: *** [build] Error 2

@adrianbrink

@zmanian
Copy link
Member

zmanian commented Oct 11, 2018

You need go1.11 to build the SDK at this point.

@tanhuiya
Copy link

You need go1.11 to build the SDK at this point.

upgrade to 1.11.1

same error

go version go1.11.1 darwin/amd64

@zmanian
Copy link
Member

zmanian commented Oct 11, 2018

This works for me.

go version
go version go1.11.1 darwin/amd64

git checkout master
dep ensure -update github.com/brejski/hid
make get_vendor_deps
make install

@tanhuiya
Copy link

This works for me.

go version
go version go1.11.1 darwin/amd64

git checkout master
dep ensure -update github.com/brejski/hid
make get_vendor_deps
make install

Did you make the gaiad and gaiacli ?
I got the error in a new project created by cosmos-sdk-cli .

@zmanian
Copy link
Member

zmanian commented Oct 12, 2018

yeah make install builds gaiad and gaiacli puts them in your PATH.

@shanev
Copy link

shanev commented Oct 17, 2018

Here's an update using the latest develop branch, with Cosmos in vendor/.

Gopkg.toml:

[[constraint]]
  name = "github.com/cosmos/cosmos-sdk"
  branch = "develop"

dep ensure, then try to build my app.

Fun error:

vendor/github.com/cosmos/cosmos-sdk/types/context.go:167:32: undefined: "github.com/..../vendor/github.com/tendermint/tendermint/abci/types".VoteInfo
vendor/github.com/cosmos/cosmos-sdk/types/context.go:168:41: undefined: "github.com/..../vendor/github.com/tendermint/tendermint/abci/types".VoteInfo
vendor/github.com/cosmos/cosmos-sdk/types/context.go:192:11: newHeader.ProposerAddress undefined (type "github.com/..../vendor/github.com/tendermint/tendermint/abci/types".Header has no field or method ProposerAddress)
vendor/github.com/cosmos/cosmos-sdk/types/context.go:216:44: undefined: "github.com/..../vendor/github.com/tendermint/tendermint/abci/types".VoteInfo

For some reason, just including Cosmos as a dependency does not pick up the right versions of dependencies. Tendermint is v0.23.1, and IAVL is v0.8.1.

@alexanderbez
Copy link
Contributor

@shanev yes, unfortunately you'll need overrides. See an example here 👍

@ghost
Copy link

ghost commented Oct 24, 2018

go version go1.11.1 darwin/amd64

thank you! this line fixed my install error

dep ensure -update github.com/brejski/hid

go version go1.11.1 darwin/amd64

@alessio
Copy link
Contributor

alessio commented Jan 22, 2019

We are now successfully building with Go 1.11.4. Hence closing.

@alessio alessio closed this as completed Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests