herumi/bls-eth-go-binary

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

AlexiaChen opened this issue · 9 comments

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

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

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

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

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

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

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

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

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.

g++ is supported on the latest version.