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

Cannot build on Mac Pre-Monterey #11364

Closed
4 tasks
dwedul-figure opened this issue Mar 11, 2022 · 4 comments
Closed
4 tasks

Cannot build on Mac Pre-Monterey #11364

dwedul-figure opened this issue Mar 11, 2022 · 4 comments

Comments

@dwedul-figure
Copy link
Collaborator

Summary of Bug

Running make build fails on a Mac that isn't yet on Monterey (MacOS V12.0+).

$ make build
Makefile:75: RocksDB support is disabled; to build and test with RocksDB support, set ENABLE_ROCKSDB=true
go build -mod=readonly -tags "netgo ledger" -ldflags '-X github.com/cosmos/cosmos-sdk/version.Name=sim -X github.com/cosmos/cosmos-sdk/version.AppName=simd -X github.com/cosmos/cosmos-sdk/version.Version=0.46.0-alpha2-160-gf4d50a989 -X github.com/cosmos/cosmos-sdk/version.Commit=f4d50a989fec8ffbc2e640ad492d40f72580064c -X "github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger" -X github.com/tendermint/tendermint/version.TMCoreSemVer=v0.35.2 -w -s' -trimpath -o /Users/danielwedul/git/cosmos-sdk/build/ ./...
# github.com/keybase/go-keychain
cgo-gcc-prolog:203:11: warning: 'SecTrustedApplicationCreateFromPath' is deprecated: first deprecated in macOS 10.15 - No longer supported [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Headers/SecTrustedApplication.h:59:10: note: 'SecTrustedApplicationCreateFromPath' has been explicitly marked deprecated here
# github.com/zondax/hid
In file included from ../../go/pkg/mod/github.com/zondax/hid@v0.9.1-0.20220302062450-5552068d2266/hid_enabled.go:38:
./hidapi/mac/hid.c:693:34: error: use of undeclared identifier 'kIOMainPortDefault'
        entry = IORegistryEntryFromPath(kIOMainPortDefault, path);
                                        ^
1 error generated.
make: *** [build] Error 2

Version

Master branch, current as of Friday Mar 11, 2022 19:20 UTC.
commit hash f4d50a989fec8ffbc2e640ad492d40f72580064c

Steps to Reproduce

  1. Be on a Mac that is still on Big Sur (or earlier).
  2. Download the cosmos-sdk repo and cd into it.
  3. Run make build.

Expected Results:
It builds without any errors.

Actual Results:

# github.com/zondax/hid
In file included from ../../go/pkg/mod/github.com/zondax/hid@v0.9.1-0.20220302062450-5552068d2266/hid_enabled.go:38:
./hidapi/mac/hid.c:693:34: error: use of undeclared identifier 'kIOMainPortDefault'
        entry = IORegistryEntryFromPath(kIOMainPortDefault, path);
                                        ^
1 error generated.
make: *** [build] Error 2

Extra Notes:
The kIOMainPortDefault variable is only available on MacOS 12.0+ (Monterey). Before that, it was named kIOMasterPortDefault.

$ go mod graph | grep -F 'github.com/zondax/hid'
github.com/cosmos/cosmos-sdk github.com/zondax/hid@v0.9.1-0.20220302062450-5552068d2266
github.com/cosmos/ledger-cosmos-go@v0.11.1 github.com/zondax/hid@v0.9.0
$ go mod graph | grep -F 'github.com/cosmos/ledger-cosmos-go'
github.com/cosmos/cosmos-sdk github.com/cosmos/ledger-cosmos-go@v0.11.1
github.com/cosmos/ledger-cosmos-go@v0.11.1 github.com/btcsuite/btcd@v0.0.0-20190115013929-ed77733ec07d
github.com/cosmos/ledger-cosmos-go@v0.11.1 github.com/cosmos/ledger-go@v0.9.2
github.com/cosmos/ledger-cosmos-go@v0.11.1 github.com/davecgh/go-spew@v1.1.1
github.com/cosmos/ledger-cosmos-go@v0.11.1 github.com/pkg/errors@v0.8.1
github.com/cosmos/ledger-cosmos-go@v0.11.1 github.com/stretchr/testify@v1.3.0
github.com/cosmos/ledger-cosmos-go@v0.11.1 github.com/zondax/hid@v0.9.0

Temporary workaround:

$ LEDGER_ENABLED=false make build

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@dwedul-figure
Copy link
Collaborator Author

Found this issue: Zondax/hid#4 which is applicable, and added a comment about it.

Basically, v0.9.0 uses kIOMasterPortDefault but the master branch uses kIOMainPortDefault. And the master branch is what's getting pulled in. I haven't checked the github.com/cosmos/ledger-cosmos-go repo yet, but I'd guess that it doesn't specify a version, so it's getting master instead of v0.9.0. The github.com/zondax/hid repo only has one branch: master, and one tag: v0.9.0.

Adding replace github.com/zondax/hid => github.com/zondax/hid v0.9.0 to go.mod (in the cosmo-sdk repo) allows the build to succeed.

@dwedul-figure
Copy link
Collaborator Author

Hmm... https://github.com/cosmos/ledger-cosmos-go/blob/master/go.mod#L11 has github.com/zondax/hid v0.9.0 // indirect in it, so I'm not exactly sure why that isn't the version being pulled into cosmos-sdk with that ledger-cosmos-go library.

Looks like it's indirect from github.com/cosmos/ledger-go v0.9.2, identified here: https://github.com/cosmos/ledger-go/blob/master/Gopkg.toml#L1-L3 as specifically v0.9.0.

@dwedul-figure
Copy link
Collaborator Author

Instead of using a replace directive in the cosmos-sdk go.mod file, it's been decided to do this:

  1. Convert https://github.com/cosmos/ledger-go to use go.mod instead of gopkg, define the zondax/hid version to use in there, and release a new version.
  2. Pull that new version into https://github.com/cosmos/ledger-cosmos-go and release a new version.
  3. Pull that into the cosmos-sdk and it should properly use v0.9.0 instead of master as an indirect include.

There are a couple workarounds for folks using cosmos-sdk running into this build problem, only one of which is needed:

  1. Add a replace line to your own go.mod: replace github.com/zondax/hid => github.com/zondax/hid v0.9.0
  2. Do not include the ledger tag in the --tags provided to go build.

@tac0turtle
Copy link
Member

unfortunately there isn't a clean way to avoid this due to the keyring library. ill close this for now, let us know if we should reopen

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

Successfully merging a pull request may close this issue.

2 participants