jesoos
February 22, 2023, 6:35am
1
안녕하세요!
klaytn 모듈과 go-ethereum 모듈을 동시에 사용하는 소스 코드에서 go build 시 오류가 발생이 되어서 문의를 드립니다.
macOS 환경에서 아래와 같은 오류 메시지가 나왔습니다.
…
duplicate symbol ‘_secp256k1GoPanicError’ in:
/var/folders/5v/206vphw577b7rsrz53s31mhm0000gn/T/go-link-1644593204/000014.o
/var/folders/5v/206vphw577b7rsrz53s31mhm0000gn/T/go-link-1644593204/000018.o
…
ld: 33 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
동일한 오브젝트 파일을 링크하는 과정 중에 발생한 것으로 보입니다.
혹시라도 해결 방법이 있는지 문의 드립니다.!!
안녕하세요 klaytn모듈과 ethereum모듈을 동시에 사용하신다는게 어떤 의미이신가요? 상황을 조금 더 설명해주신다면 답변드릴 수 있을 것 같습니다.
jesoos
February 23, 2023, 10:04am
3
Klaytn 과 Ethereum 에 트랜잭션을 보내는 기능을 하나의 Go 언어 기반의 서버로 구현을 하고 있습니다.
각각 API 로 구분을 하였지만, 컴파일 되는 과정에서 위와 같은 오류가 발생이 되고 있습니다.
2023년 2월 23일 (목) 오후 5:44, Klaytn Developers Forum의 jack 님 <notifications@klaytn.discoursemail.com >님이 작성:
어떤 모듈들은 import해서 구현하고 계신지는 모르겠지만, 컴파일하면서 symbol에러가 발생하는것같아 보입니다. 사용하고 계신 모듈들을 공유해주실 수 있나요?
jesoos
February 23, 2023, 11:28pm
5
go 1.19
require (
[github.com/BurntSushi/toml](http://github.com/BurntSushi/toml) v1.2.0
[github.com/facebookgo/grace](http://github.com/facebookgo/grace) v0.0.0-20180706040059-75cf19382434
[github.com/gin-gonic/gin](http://github.com/gin-gonic/gin) v1.8.2
[github.com/go-playground/locales](http://github.com/go-playground/locales) v0.14.0
[github.com/go-playground/universal-translator](http://github.com/go-playground/universal-translator) v0.18.0
[github.com/hanwha-blockchain/common-go](http://github.com/hanwha-blockchain/common-go) v0.0.8
[github.com/joho/godotenv](http://github.com/joho/godotenv) v1.4.0
[github.com/json-iterator/go](http://github.com/json-iterator/go) v1.1.12
[github.com/klaytn/klaytn](http://github.com/klaytn/klaytn) v1.10.1
[github.com/lestrrat-go/file-rotatelogs](http://github.com/lestrrat-go/file-rotatelogs) v2.4.0+incompatible
[github.com/medivh-jay/lfshook](http://github.com/medivh-jay/lfshook) v0.0.0-20180920164130-b9218ef580f5
[github.com/olivere/elastic/v7](http://github.com/olivere/elastic/v7) v7.0.32
[github.com/sirupsen/logrus](http://github.com/sirupsen/logrus) v1.9.0
[github.com/swaggo/files](http://github.com/swaggo/files) v1.0.0
[github.com/swaggo/gin-swagger](http://github.com/swaggo/gin-swagger) v1.5.3
[github.com/swaggo/swag](http://github.com/swaggo/swag) v1.8.10
[gopkg.in/go-playground/validator.v9](http://gopkg.in/go-playground/validator.v9) v9.31.0
[gorm.io/driver/postgres](http://gorm.io/driver/postgres) v1.0.0
[gorm.io/gorm](http://gorm.io/gorm) v1.20.6
)
require (
[github.com/KyleBanks/depth](http://github.com/KyleBanks/depth) v1.2.1 // indirect
[github.com/btcsuite/btcd/btcec/v2](http://github.com/btcsuite/btcd/btcec/v2) v2.2.0 // indirect
[github.com/decred/dcrd/dcrec/secp256k1/v4](http://github.com/decred/dcrd/dcrec/secp256k1/v4) v4.0.1 // indirect
[github.com/ethereum/go-ethereum](http://github.com/ethereum/go-ethereum) v1.11.1 // indirect
[github.com/facebookgo/clock](http://github.com/facebookgo/clock) v0.0.0-20150410010913-600d898af40a // indirect
[github.com/facebookgo/ensure](http://github.com/facebookgo/ensure) v0.0.0-20200202191622-63f1cf65ac4c // indirect
[github.com/facebookgo/freeport](http://github.com/facebookgo/freeport) v0.0.0-20150612182905-d4adf43b75b9 // indirect
[github.com/facebookgo/httpdown](http://github.com/facebookgo/httpdown) v0.0.0-20180706035922-5979d39b15c2 // indirect
[github.com/facebookgo/stack](http://github.com/facebookgo/stack) v0.0.0-20160209184415-751773369052 // indirect
[github.com/facebookgo/stats](http://github.com/facebookgo/stats) v0.0.0-20151006221625-1b76add642e4 // indirect
[github.com/facebookgo/subset](http://github.com/facebookgo/subset) v0.0.0-20200203212716-c811ad88dec4 // indirect
[github.com/gin-contrib/sse](http://github.com/gin-contrib/sse) v0.1.0 // indirect
[github.com/go-openapi/jsonpointer](http://github.com/go-openapi/jsonpointer) v0.19.6 // indirect
[github.com/go-openapi/jsonreference](http://github.com/go-openapi/jsonreference) v0.20.2 // indirect
[github.com/go-openapi/spec](http://github.com/go-openapi/spec) v0.20.8 // indirect
[github.com/go-openapi/swag](http://github.com/go-openapi/swag) v0.22.3 // indirect
[github.com/go-playground/validator/v10](http://github.com/go-playground/validator/v10) v10.11.1 // indirect
[github.com/go-stack/stack](http://github.com/go-stack/stack) v1.8.1 // indirect
[github.com/goccy/go-json](http://github.com/goccy/go-json) v0.9.11 // indirect
[github.com/google/go-cmp](http://github.com/google/go-cmp) v0.5.8 // indirect
[github.com/hashicorp/golang-lru](http://github.com/hashicorp/golang-lru) v0.5.5-0.20210104140557-80c98217689d // indirect
[github.com/jackc/chunkreader/v2](http://github.com/jackc/chunkreader/v2) v2.0.1 // indirect
[github.com/jackc/pgconn](http://github.com/jackc/pgconn) v1.10.1 // indirect
[github.com/jackc/pgio](http://github.com/jackc/pgio) v1.0.0 // indirect
[github.com/jackc/pgpassfile](http://github.com/jackc/pgpassfile) v1.0.0 // indirect
[github.com/jackc/pgproto3/v2](http://github.com/jackc/pgproto3/v2) v2.2.0 // indirect
[github.com/jackc/pgservicefile](http://github.com/jackc/pgservicefile) v0.0.0-20200714003250-2b9c44734f2b // indirect
[github.com/jackc/pgtype](http://github.com/jackc/pgtype) v1.9.0 // indirect
[github.com/jackc/pgx/v4](http://github.com/jackc/pgx/v4) v4.14.0 // indirect
[github.com/jinzhu/inflection](http://github.com/jinzhu/inflection) v1.0.0 // indirect
[github.com/jinzhu/now](http://github.com/jinzhu/now) v1.1.3 // indirect
[github.com/jonboulle/clockwork](http://github.com/jonboulle/clockwork) v0.3.0 // indirect
[github.com/josharian/intern](http://github.com/josharian/intern) v1.0.0 // indirect
[github.com/leodido/go-urn](http://github.com/leodido/go-urn) v1.2.1 // indirect
[github.com/lestrrat-go/strftime](http://github.com/lestrrat-go/strftime) v1.0.6 // indirect
[github.com/mailru/easyjson](http://github.com/mailru/easyjson) v0.7.7 // indirect
[github.com/mattn/go-colorable](http://github.com/mattn/go-colorable) v0.1.13 // indirect
[github.com/mattn/go-isatty](http://github.com/mattn/go-isatty) v0.0.16 // indirect
[github.com/modern-go/concurrent](http://github.com/modern-go/concurrent) v0.0.0-20180306012644-bacd9c7ef1dd // indirect
[github.com/modern-go/reflect2](http://github.com/modern-go/reflect2) v1.0.2 // indirect
[github.com/pbnjay/memory](http://github.com/pbnjay/memory) v0.0.0-20190104145345-974d429e7ae4 // indirect
[github.com/pelletier/go-toml/v2](http://github.com/pelletier/go-toml/v2) v2.0.6 // indirect
[github.com/pkg/errors](http://github.com/pkg/errors) v0.9.1 // indirect
[github.com/shopspring/decimal](http://github.com/shopspring/decimal) v1.3.1 // indirect
[github.com/ugorji/go/codec](http://github.com/ugorji/go/codec) v1.2.7 // indirect
[go.uber.org/atomic](http://go.uber.org/atomic) v1.6.0 // indirect
[go.uber.org/multierr](http://go.uber.org/multierr) v1.5.0 // indirect
[go.uber.org/zap](http://go.uber.org/zap) v1.13.0 // indirect
[golang.org/x/crypto](http://golang.org/x/crypto) v0.1.0 // indirect
[golang.org/x/lint](http://golang.org/x/lint) v0.0.0-20200302205851-738671d3881b // indirect
[golang.org/x/net](http://golang.org/x/net) v0.5.0 // indirect
[golang.org/x/sys](http://golang.org/x/sys) v0.5.0 // indirect
[golang.org/x/text](http://golang.org/x/text) v0.7.0 // indirect
[golang.org/x/tools](http://golang.org/x/tools) v0.5.0 // indirect
[google.golang.org/protobuf](http://google.golang.org/protobuf) v1.28.1 // indirect
[gopkg.in/go-playground/assert.v1](http://gopkg.in/go-playground/assert.v1) v1.2.1 // indirect
[gopkg.in/yaml.v2](http://gopkg.in/yaml.v2) v2.4.0 // indirect
[gopkg.in/yaml.v3](http://gopkg.in/yaml.v3) v3.0.1 // indirect
)
입니다.!
2023년 2월 23일 (목) 오후 7:56, Klaytn Developers Forum의 jack 님 <notifications@klaytn.discoursemail.com >님이 작성:
어떻게 개발하고 계신지 잘 감이 오지 않긴하지만요, 우선 제 생각에는 이더리움이나 클레이튼 둘 중 한개만 import하신 후에 사용하시는게 좋을 것 같습니다. 둘 간에는 컴파일시에 동일한 구조체를 내부적으로 사용할 수 있어 symbol이 겹칠거 같습니다.
클레이튼 또는 이더리움 둘중 하나의 패키지만 이용해서 양쪽에 트랜잭션을 보내도록 구현할수도 있습니다. 구체적으로 사용하시는 모듈과 간략한 예제를 알려주시면 구체적인 답변 드리겠습니다.
jesoos
February 24, 2023, 1:02am
7
답변 감사드립니다.
대납 기능을 사용하려면 TxTypeFeeDelegatedSmartContractExecution 으로 klaytn 모듈을 사용해야 하는 것으로 알고 있습니다.
ethereum 의 DynamicFeeTx 를 사용하려면 go-ethreum 모듈을 사용해야 하는 것으로 알고 있습니다.
혹시라도 제가 모를 수 있사오니, 구체적인 예를 주시면 감사하겠습니다.
klaytn의 TxTypeEthereumDynamicFee 트랜잭션이 있습니다. 이더리움과 동일한 구조체이니 이걸 이용하셔도 문제 없을 것 같습니다. 한번 사용해보시고 문제가 생기면 다시 알려주세요.
jesoos
February 24, 2023, 1:28am
9
아! 그 부분은 확인을 못해 보았네요.
설명 감사드립니다.
결국에는 klaytn 모듈과 ethereum 모듈을 한 파일에 import 를 하지 않고, 다른 파일에서 import 를 하더라도 동일한 go.mod 내에서 사용하게 되므로 symbol 이 중복되는 문제는 해결이 불가능하다고 이해하겠습니다.
감사합니다.
1 Like
안녕하세요. 같은 이슈를 겪고 있습니다. 하나의 go 서버에서 이더리움과 클레이튼 트랜잭션을 사용하는 서비스를 개발 중인데 혹시 해결하셨을까요?
클레이튼 또는 이더리움 둘중 하나의 패키지만 import하시면 될거같습니다
2 Likes
jesoos
March 17, 2023, 3:55am
12
jack_jin 님 답글 달아주신 방법처럼 해결했습니다.!
2 Likes