herumi / bls

288 stars 133 forks source link

BN256 - Could not determine Kind of name for C.blsHashToSignaure #36

Closed sachin-0chain closed 4 years ago

sachin-0chain commented 4 years ago

TAGS USED: bn256

BUILD: SUCCESS works => (commit = github.com/herumi/bls v0.0.0-20190523064038-b1733a744a2e

BUILD: FAILURE fails => (commit = github.com/herumi/bls v0.0.0-20190607023536-90ce041aecd9)

ERROR MESSAGE:

github.com/herumi/bls/ffi/go/bls

/Users/sachin/gopath/pkg/mod/github.com/herumi/bls@v0.0.0-20190607023536-90ce041aecd9/ffi/go/bls/bls.go:554:9: could not determine kind of name for C.blsHashToSignature

herumi commented 4 years ago

What environments and commands do you test it on? make test_go256 of the latest version passes travis-ci.

sachin-0chain commented 4 years ago

The environment is darwin. make test_go256 was succeeding but the go modules were complaining. The install step for BLS and MCL install the include files under "/usr/local/include" and not "/usr/local/include<bls|mcl>". This caused old copies of the include file to be used and hence the error in the mis-match signature.

The following fix is required to both the install steps for BLS and MCL. I am surprised others haven't run into this problem. I will be trying our setup on linux and will let you know if we run into problems there as well...

BLS install step...

diff --git a/Makefile b/Makefile
index 45be351..231cb0e 100644
--- a/Makefile
+++ b/Makefile
@@ -222,7 +222,7 @@ DEPEND_FILE=$(addprefix $(OBJ_DIR)/, $(ALL_SRC:.cpp=.d))
 PREFIX?=/usr/local
 install: lib/libbls256.a lib/libbls256.$(LIB_SUF) lib/libbls384.a lib/libbls384.$(LIB_SUF) lib/libbls384_256.a lib/libbls384_256.$(LIB_SUF)
        $(MKDIR) $(PREFIX)/include/bls
-       cp -a include/bls/ $(PREFIX)/include/
+       cp -a include/bls/ $(PREFIX)/include/bls
        $(MKDIR) $(PREFIX)/lib
        cp -a lib/libbls256.a lib/libbls256.$(LIB_SUF) lib/libbls384.a lib/libbls384.$(LIB_SUF) lib/libbls384_256.a lib/libbls384_256.$(LIB_SUF) $(PREFIX)/lib/

mcl install step...

diff --git a/Makefile b/Makefile
index 6273490..37185ed 100644
--- a/Makefile
+++ b/Makefile
@@ -385,7 +385,7 @@ DEPEND_FILE=$(addprefix $(OBJ_DIR)/, $(addsuffix .d,$(basename $(ALL_SRC))))
 PREFIX?=/usr/local
 install: lib/libmcl.a lib/libmcl.$(LIB_SUF)
        $(MKDIR) $(PREFIX)/include/mcl
-       cp -a include/mcl/ $(PREFIX)/include/
+       cp -a include/mcl/ $(PREFIX)/include/mcl
        cp -a include/cybozu/ $(PREFIX)/include/
        $(MKDIR) $(PREFIX)/lib
        cp -a lib/libmcl.a lib/libmcl.$(LIB_SUF) $(PREFIX)/lib/
herumi commented 4 years ago

Thank you for your patch. I did not know that the meaning of cp -a src-dir/ dst-dir is different on Linux and Darwin.

I fixed it at mcl and bls.