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

Can't make ios #21340

Closed
ToJen opened this issue Jul 17, 2020 · 4 comments · Fixed by #21362
Closed

Can't make ios #21340

ToJen opened this issue Jul 17, 2020 · 4 comments · Fixed by #21362

Comments

@ToJen
Copy link

ToJen commented Jul 17, 2020

System information

Geth version: geth version
OS & Version: Windows/Linux/OSX
Commit hash : (if develop)

Geth
Version: 1.9.17-unstable
Git Commit: 9e88224eb86c92c78f5f03ffcd0793704a8b4309
Git Commit Date: 20200716
Architecture: amd64
Protocol Versions: [65 64 63]
Go Version: go1.13.10
Operating System: darwin
GOPATH=/my/go
GOROOT=/usr/local/Cellar/go@1.13/1.13.10_1/libexec

Expected behaviour

$ make ios
[...]
Done building.
Import "build/bin/Geth.framework" to use the library.

Actual behaviour

$ make ios
[...]
# gobind/gobind
Geth_darwin.m:5133:17: error: method 'sign:p1:error:' in protocol 'GethSigner' not implemented [-Werror,-Wprotocol]
gobind/Geth.objc.h:87:1: note: method 'sign:p1:error:' declared here
/code/go-ethereum/build/bin/gomobile: darwin-arm: go build -tags ios -v -ldflags -s -w -buildmode=c-archive -o /var/folders/05/rlnn721s0_d3yhbbx027602dsk4gsv/T/gomobile-work-343520635/geth-arm.a ./gobind failed: exit status 2

Steps to reproduce the behaviour

  • I cloned the repo
  • I ran make ios
  • This didn't work so I ran make geth android ios. The Android .aar was built but not the iOS .framework folder.

Backtrace

[backtrace]
@KevinVitale
Copy link

KevinVitale commented Jul 21, 2020

I'm seeing exactly the same issue.

macOS Catalina, 10.15.6 (19G73)

Version: 1.9.18-unstable
Git Commit: 123864fc055482279fa61ce063b7e2aad48c0609
Git Commit Date: 20200721
Architecture: amd64
Protocol Versions: [65 64 63]
Go Version: go1.14.5
Operating System: darwin

Edit:: I'm very unfamiliar with this code base (having just cloned it a few minutes ago). However, it appears that #20921 will fix this issue.

As the error states, GethSigner is missing an implementation for sign:p1:error:. The iOS build reportedly broke after merging #20764.

@fjl
Copy link
Contributor

fjl commented Jul 23, 2020

I can reproduce the build failure. The issue is with this interface:

type Signer interface {
Sign(*Address, *Transaction) (tx *Transaction, _ error)
}

When gomobile generates objc, it uses the parameter names for the method selector. For the Signer interface, it generates

@protocol GethSigner <NSObject>
- (GethTransaction* _Nullable)sign:(GethAddress* _Nullable)p0 p1:(GethTransaction* _Nullable)p1 error:(NSError* _Nullable* _Nullable)error;
@end

For the GethMobileSigner type

func (s *MobileSigner) Sign(addr *Address, unsignedTx *Transaction) (signedTx *Transaction, _ error) {
it generates:

- (GethTransaction* _Nullable)sign:(GethAddress* _Nullable)addr unsignedTx:(GethTransaction* _Nullable)unsignedTx error:(NSError* _Nullable* _Nullable)error {

This doesn't compile because the method selectors don't match.

fjl added a commit to fjl/go-ethereum that referenced this issue Jul 23, 2020
This fixes the iOS framework build by naming the second parameter of the
Signer interface method. The name is important because it becomes part
of the objc method signature.

Fixes ethereum#21340
@fjl fjl removed the status:triage label Jul 23, 2020
fjl added a commit that referenced this issue Jul 23, 2020
This fixes the iOS framework build by naming the second parameter of the
Signer interface method. The name is important because it becomes part
of the objc method signature.

Fixes #21340
@ToJen
Copy link
Author

ToJen commented Jul 23, 2020

Can confirm it works now 👍

@KevinVitale
Copy link

Builds successfully 👍

enriquefynn pushed a commit to enriquefynn/go-ethereum that referenced this issue Mar 10, 2021
This fixes the iOS framework build by naming the second parameter of the
Signer interface method. The name is important because it becomes part
of the objc method signature.

Fixes ethereum#21340
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.

5 participants