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

undefined: secp256k1.RecoveryPubkey #100

Open
Daniel1984 opened this issue Jun 4, 2022 · 3 comments
Open

undefined: secp256k1.RecoveryPubkey #100

Daniel1984 opened this issue Jun 4, 2022 · 3 comments

Comments

@Daniel1984
Copy link

Daniel1984 commented Jun 4, 2022

Playing around with your sdk getting this err.
main.go

package main

import (
	"fmt"
	"log"

	"github.com/iotexproject/iotex-antenna-go/v2/account"
)

func main() {
	fmt.Println("hola")

	wal, err := account.NewAccount()
	if err != nil {
		log.Fatal(err.Error())
	}

	fmt.Printf("addr: %s", wal.Address())
}

go.mod:

module testing.iotex

go 1.17

require github.com/iotexproject/iotex-antenna-go/v2 v2.5.1

require (
	github.com/btcsuite/btcd v0.21.0-beta // indirect
	github.com/deckarep/golang-set v1.7.1 // indirect
	github.com/dustinxie/gmsm v1.4.0 // indirect
	github.com/ethereum/go-ethereum v1.10.4 // indirect
	github.com/go-stack/stack v1.8.0 // indirect
	github.com/google/uuid v1.1.5 // indirect
	github.com/iotexproject/go-pkgs v0.1.12 // indirect
	github.com/iotexproject/iotex-address v0.2.7 // indirect
	github.com/pkg/errors v0.9.1 // indirect
	github.com/rjeczalik/notify v0.9.2 // indirect
	golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 // indirect
	golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912 // indirect
)

go run main.go:

# github.com/iotexproject/go-pkgs/crypto
../../../go/pkg/mod/github.com/iotexproject/go-pkgs@v0.1.12/crypto/key.go:161:13: undefined: secp256k1.RecoverPubkey

Same with go-pkgs@v0.1.6

go version
go version go1.17 linux/amd64
@dustinxie
Copy link
Member

cannot repro this error, when i run this main.go, it works fine:
Screen Shot 2022-06-08 at 6 04 08 PM

@Daniel1984
Copy link
Author

@dustinxie can you also build this main.go with CGO_ENABLED=0 GOOS=linux go build -o main main.go? I can go run main.go on mac M1. Can't build it on mac and linux machine and linux machine refuses even to run with undefined: secp256k1.RecoverPubkey exception

@Liuhaai
Copy link
Member

Liuhaai commented Jan 25, 2024

CGO_ENABLED=0 GOOS=linux go build -o main main.go

It is caused by the dependency of C files on crypto, which could be fixed by xgo cross-compilation
iotexproject/iotex-core#2684

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

3 participants