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

[usage] Does Usage of this wrapper(go version) is correct ? #42

Closed
AlexiaChen opened this issue Apr 19, 2021 · 9 comments
Closed

[usage] Does Usage of this wrapper(go version) is correct ? #42

AlexiaChen opened this issue Apr 19, 2021 · 9 comments

Comments

@AlexiaChen
Copy link

build failed loocally on my laptop (ubuntu 18.04)

PR: harmony-one/harmony#3644

import "github.com/herumi/bls-eth-go-binary/bls"

this PR use this library to bls sign verfiy and so forth. but it shows error message related herumi when buid:

../../../../pkg/mod/github.com/herumi/bls-eth-go-binary@v0.0.0-20210407105559-9588dcfc7de7/bls/bls.go:36:24: could not determine kind of name for C.BLS_ETH_MODE_DRAFT_05
../../../../pkg/mod/github.com/herumi/bls-eth-go-binary@v0.0.0-20210407105559-9588dcfc7de7/bls/bls.go:37:24: could not determine kind of name for C.BLS_ETH_MODE_DRAFT_06
../../../../pkg/mod/github.com/herumi/bls-eth-go-binary@v0.0.0-20210407105559-9588dcfc7de7/bls/bls.go:38:24: could not determine kind of name for C.BLS_ETH_MODE_DRAFT_07
../../../../pkg/mod/github.com/herumi/bls-eth-go-binary@v0.0.0-20210407105559-9588dcfc7de7/bls/bls.go:39:23: could not determine kind of name for C.BLS_ETH_MODE_LATEST
../../../../pkg/mod/github.com/herumi/bls-eth-go-binary@v0.0.0-20210407105559-9588dcfc7de7/bls/bls.go:35:20: could not determine kind of name for C.BLS_ETH_MODE_OLD
../../../../pkg/mod/github.com/herumi/bls-eth-go-binary@v0.0.0-20210407105559-9588dcfc7de7/bls/bls.go:839:2: could not determine kind of name for C.blsAggregateSignature
../../../../pkg/mod/github.com/herumi/bls-eth-go-binary@v0.0.0-20210407105559-9588dcfc7de7/bls/bls.go:971:9: could not determine kind of name for C.blsAggregateVerifyNoCheck
../../../../pkg/mod/github.com/herumi/bls-eth-go-binary@v0.0.0-20210407105559-9588dcfc7de7/bls/bls.go:848:9: could not determine kind of name for C.blsFastAggregateVerify
../../../../pkg/mod/github.com/herumi/bls-eth-go-binary@v0.0.0-20210407105559-9588dcfc7de7/bls/bls.go:818:9: could not determine kind of name for C.blsMultiVerifyFinal
../../../../pkg/mod/github.com/herumi/bls-eth-go-binary@v0.0.0-20210407105559-9588dcfc7de7/bls/bls.go:781:4: could not determine kind of name for C.blsMultiVerifySub
../../../../pkg/mod/github.com/herumi/bls-eth-go-binary@v0.0.0-20210407105559-9588dcfc7de7/bls/bls.go:912:9: could not determine kind of name for C.blsPublicKeyDeserializeUncompressed
../../../../pkg/mod/github.com/herumi/bls-eth-go-binary@v0.0.0-20210407105559-9588dcfc7de7/bls/bls.go:457:9: could not determine kind of name for C.blsPublicKeyIsZero
../../../../pkg/mod/github.com/herumi/bls-eth-go-binary@v0.0.0-20210407105559-9588dcfc7de7/bls/bls.go:891:7: could not determine kind of name for C.blsPublicKeySerializeUncompressed
../../../../pkg/mod/github.com/herumi/bls-eth-go-binary@v0.0.0-20210407105559-9588dcfc7de7/bls/bls.go:299:9: could not determine kind of name for C.blsSecretKeyIsZero
../../../../pkg/mod/github.com/herumi/bls-eth-go-binary@v0.0.0-20210407105559-9588dcfc7de7/bls/bls.go:934:12: could not determine kind of name for C.blsSetETHmode
../../../../pkg/mod/github.com/herumi/bls-eth-go-binary@v0.0.0-20210407105559-9588dcfc7de7/bls/bls.go:922:9: could not determine kind of name for C.blsSignatureDeserializeUncompressed
../../../../pkg/mod/github.com/herumi/bls-eth-go-binary@v0.0.0-20210407105559-9588dcfc7de7/bls/bls.go:560:9: could not determine kind of name for C.blsSignatureIsZero
../../../../pkg/mod/github.com/herumi/bls-eth-go-binary@v0.0.0-20210407105559-9588dcfc7de7/bls/bls.go:902:7: could not determine kind of name for C.blsSignatureSerializeUncompressed

How to fix it ?

I found the problem using google, there are many root cause. I tried some way, but it did not work

@AlexiaChen AlexiaChen changed the title [usage] Does Usage of this wrapper(go version) correct ? [usage] Does Usage of this wrapper(go version) is correct ? Apr 19, 2021
@herumi
Copy link
Owner

herumi commented Apr 19, 2021

What version of Go do you use?
Can you exec go test -v ./bls and go run examples/sample.go ?

The GitHub action runs well.
https://github.com/herumi/bls-eth-go-binary/blob/master/.github/workflows/main.yml

@AlexiaChen
Copy link
Author

AlexiaChen commented Apr 19, 2021

What version of Go do you use?
Can you exec go test -v ./bls and go run examples/sample.go ?

The GitHub action runs well.
https://github.com/herumi/bls-eth-go-binary/blob/master/.github/workflows/main.yml

Go version is go version go1.14.15 linux/amd64

go test -v ./bls and go run examples/sample.go runs well locally, but it use in harmony project , it shows error: could not determine kind of name for C.xxx

but according to your github action , I did not use CXX=clang++(your action only use clang++), it default use g++, but it build failed when run make

mkdir -p bls/lib/linux/amd64
ar r bls/lib/linux/amd64/libbls384_256.a obj/bls_c384_256.o obj/fp.o obj/base64.o src/bls/mcl/obj/static_code.o
ar: obj/base64.o: No such file or directory
Makefile:53: recipe for target 'bls/lib/linux/amd64/libbls384_256.a' failed
make: *** [bls/lib/linux/amd64/libbls384_256.a] Error 1

@herumi
Copy link
Owner

herumi commented Apr 19, 2021

Recently, bls-eth-go-binary started treating bls and mcl as submodules, so try git submodule update --init --recursive?

@AlexiaChen
Copy link
Author

Recently, bls-eth-go-binary started treating bls and mcl as submodules, so try git submodule update --init --recursive?

I know that, because I run with git clone --recursive https://github.com/herumi/bls-eth-go-binary just 10 minutes ago and build, it might downloaded bls and mcl as submodule.

Now , I just run with git submodule update --init --recursive, it did not update anything , so build failed that I expected

@AlexiaChen
Copy link
Author

AlexiaChen commented Apr 19, 2021

Ohh, the PR author just give me the reason why this error pops , his reply here harmony-one/harmony#3644 (comment), Thanks, I will try this way . But this repo building did not success on my ubuntu18.04 that I mentioned above

@herumi
Copy link
Owner

herumi commented Apr 19, 2021

Hum, I don't know why the error ar: obj/base64.o: No such file or directory happens.

bls-eth-go-binary% make CXX=clang++-11
clang++-11 -c -o obj/bls_c384_256.o src/bls/src/bls_c384_256.cpp -std=c++03 -O3 -fno-exceptions -fno-rtti -fno-threadsafe-statics -fno-stack-protector -DNDEBUG -DMCL_DONT_USE_OPENSSL -DMCL_LLVM_BMI2=0 -DMCL_USE_LLVM=1 -DMCL_USE_VINT -DMCL_SIZEOF_UNIT=8 -DMCL_VINT_FIXED_BUFFER -DMCL_MAX_BIT_SIZE=384 -DCYBOZU_DONT_USE_EXCEPTION -DCYBOZU_DONT_USE_STRING -D_FORTIFY_SOURCE=0 -Isrc/bls/include -Isrc/bls/mcl/include -DBLS_ETH -DBLS_SWAP_G  -fPIC -DMCL_STATIC_CODE -DMCL_DONT_USE_XBYAK
clang++-11 -c -o obj/fp.o src/bls/mcl/src/fp.cpp -std=c++03 -O3 -fno-exceptions -fno-rtti -fno-threadsafe-statics -fno-stack-protector -DNDEBUG -DMCL_DONT_USE_OPENSSL -DMCL_LLVM_BMI2=0 -DMCL_USE_LLVM=1 -DMCL_USE_VINT -DMCL_SIZEOF_UNIT=8 -DMCL_VINT_FIXED_BUFFER -DMCL_MAX_BIT_SIZE=384 -DCYBOZU_DONT_USE_EXCEPTION -DCYBOZU_DONT_USE_STRING -D_FORTIFY_SOURCE=0 -Isrc/bls/include -Isrc/bls/mcl/include -DBLS_ETH -DBLS_SWAP_G  -fPIC -DMCL_STATIC_CODE -DMCL_DONT_USE_XBYAK
clang++-11 -c -o obj/base64.o src/bls/mcl/src/base64.ll -std=c++03 -O3 -fno-exceptions -fno-rtti -fno-threadsafe-statics -fno-stack-protector -DNDEBUG -DMCL_DONT_USE_OPENSSL -DMCL_LLVM_BMI2=0 -DMCL_USE_LLVM=1 -DMCL_USE_VINT -DMCL_SIZEOF_UNIT=8 -DMCL_VINT_FIXED_BUFFER -DMCL_MAX_BIT_SIZE=384 -DCYBOZU_DONT_USE_EXCEPTION -DCYBOZU_DONT_USE_STRING -D_FORTIFY_SOURCE=0 -Isrc/bls/include -Isrc/bls/mcl/include -DBLS_ETH -DBLS_SWAP_G  -fPIC -DMCL_STATIC_CODE -DMCL_DONT_USE_XBYAK
clang: warning: argument unused during compilation: '-I src/bls/include' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-I src/bls/mcl/include' [-Wunused-command-line-argument]
warning: overriding the module target triple with x86_64-pc-linux-gnu [-Woverride-module]
1 warning generated.
make -C src/bls/mcl obj/static_code.o
make[1]: Entering directory '/home/shigeo/Program/bls-eth-go-binary/src/bls/mcl'
clang++-11 -o src/dump_code src/dump_code.cpp src/fp.cpp -g -I include -DMCL_DUMP_JIT -DMCL_MAX_BIT_SIZE=384 -DMCL_DONT_USE_OPENSSL -DMCL_USE_VINT -DMCL_SIZEOF_UNIT=8 -DMCL_VINT_FIXED_BUFFER
src/dump_code > src/static_code.asm
nasm -felf64 -o obj/static_code.o src/static_code.asm
make[1]: Leaving directory '/home/shigeo/Program/bls-eth-go-binary/src/bls/mcl'
mkdir -p bls/lib/linux/amd64
ar r bls/lib/linux/amd64/libbls384_256.a obj/bls_c384_256.o obj/fp.o obj/base64.o src/bls/mcl/obj/static_code.o

@AlexiaChen
Copy link
Author

Hum, I don't know why the error ar: obj/base64.o: No such file or directory happens.

bls-eth-go-binary% make CXX=clang++-11
clang++-11 -c -o obj/bls_c384_256.o src/bls/src/bls_c384_256.cpp -std=c++03 -O3 -fno-exceptions -fno-rtti -fno-threadsafe-statics -fno-stack-protector -DNDEBUG -DMCL_DONT_USE_OPENSSL -DMCL_LLVM_BMI2=0 -DMCL_USE_LLVM=1 -DMCL_USE_VINT -DMCL_SIZEOF_UNIT=8 -DMCL_VINT_FIXED_BUFFER -DMCL_MAX_BIT_SIZE=384 -DCYBOZU_DONT_USE_EXCEPTION -DCYBOZU_DONT_USE_STRING -D_FORTIFY_SOURCE=0 -Isrc/bls/include -Isrc/bls/mcl/include -DBLS_ETH -DBLS_SWAP_G  -fPIC -DMCL_STATIC_CODE -DMCL_DONT_USE_XBYAK
clang++-11 -c -o obj/fp.o src/bls/mcl/src/fp.cpp -std=c++03 -O3 -fno-exceptions -fno-rtti -fno-threadsafe-statics -fno-stack-protector -DNDEBUG -DMCL_DONT_USE_OPENSSL -DMCL_LLVM_BMI2=0 -DMCL_USE_LLVM=1 -DMCL_USE_VINT -DMCL_SIZEOF_UNIT=8 -DMCL_VINT_FIXED_BUFFER -DMCL_MAX_BIT_SIZE=384 -DCYBOZU_DONT_USE_EXCEPTION -DCYBOZU_DONT_USE_STRING -D_FORTIFY_SOURCE=0 -Isrc/bls/include -Isrc/bls/mcl/include -DBLS_ETH -DBLS_SWAP_G  -fPIC -DMCL_STATIC_CODE -DMCL_DONT_USE_XBYAK
clang++-11 -c -o obj/base64.o src/bls/mcl/src/base64.ll -std=c++03 -O3 -fno-exceptions -fno-rtti -fno-threadsafe-statics -fno-stack-protector -DNDEBUG -DMCL_DONT_USE_OPENSSL -DMCL_LLVM_BMI2=0 -DMCL_USE_LLVM=1 -DMCL_USE_VINT -DMCL_SIZEOF_UNIT=8 -DMCL_VINT_FIXED_BUFFER -DMCL_MAX_BIT_SIZE=384 -DCYBOZU_DONT_USE_EXCEPTION -DCYBOZU_DONT_USE_STRING -D_FORTIFY_SOURCE=0 -Isrc/bls/include -Isrc/bls/mcl/include -DBLS_ETH -DBLS_SWAP_G  -fPIC -DMCL_STATIC_CODE -DMCL_DONT_USE_XBYAK
clang: warning: argument unused during compilation: '-I src/bls/include' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-I src/bls/mcl/include' [-Wunused-command-line-argument]
warning: overriding the module target triple with x86_64-pc-linux-gnu [-Woverride-module]
1 warning generated.
make -C src/bls/mcl obj/static_code.o
make[1]: Entering directory '/home/shigeo/Program/bls-eth-go-binary/src/bls/mcl'
clang++-11 -o src/dump_code src/dump_code.cpp src/fp.cpp -g -I include -DMCL_DUMP_JIT -DMCL_MAX_BIT_SIZE=384 -DMCL_DONT_USE_OPENSSL -DMCL_USE_VINT -DMCL_SIZEOF_UNIT=8 -DMCL_VINT_FIXED_BUFFER
src/dump_code > src/static_code.asm
nasm -felf64 -o obj/static_code.o src/static_code.asm
make[1]: Leaving directory '/home/shigeo/Program/bls-eth-go-binary/src/bls/mcl'
mkdir -p bls/lib/linux/amd64
ar r bls/lib/linux/amd64/libbls384_256.a obj/bls_c384_256.o obj/fp.o obj/base64.o src/bls/mcl/obj/static_code.o

I did not use CLANG++, I use g++ as default. Your github action also use CLANG++, I guess that there is different for our enviroment?. Thank you. maybe g++ does not generated base64.o

@herumi
Copy link
Owner

herumi commented Apr 19, 2021

Thank you. maybe g++ does not generated base64.o

Yes. The Makefile in bls-eth-go-binary does not support g++ to generate a static library.
The reason is simply that it was a hassle. I'll support g++ later.

@herumi
Copy link
Owner

herumi commented Aug 3, 2022

g++ is supported on the latest version.

@herumi herumi closed this as completed Aug 3, 2022
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

2 participants