herumi / bls-eth-go-binary

68 stars 41 forks source link

FreeBSD - gmake compiler error: use of undeclared identifier #27

Closed Laggger164 closed 3 years ago

Laggger164 commented 4 years ago

I followed these instructions

On a FreeNAS jail. Hopefully this can get fixed.

CLI log

root@Eth2:~/work/bls-eth-go-binary # gmake CXX=clang++
clang++ -c -o obj/bls_c384_256.o ../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 -I../bls/include -I../mcl/include -DBLS_ETH -DBLS_SWAP_G  -DMCL_STATIC_CODE -DMCL_DONT_USE_XBYAK
In file included from ../bls/src/bls_c384_256.cpp:3:
In file included from ../bls/src/bls_c_impl.hpp:7:
In file included from ../mcl/include/mcl/impl/bn_c_impl.hpp:13:
In file included from ../mcl/include/mcl/bls12_381.hpp:11:
In file included from ../mcl/include/mcl/bn.hpp:11:
In file included from ../mcl/include/mcl/fp_tower.hpp:9:
In file included from ../mcl/include/mcl/fp.hpp:29:
In file included from ../mcl/include/mcl/op.hpp:9:
In file included from ../mcl/include/mcl/gmp_util.hpp:34:
In file included from ../mcl/include/mcl/vint.hpp:17:
In file included from ../mcl/include/mcl/conversion.hpp:2:
../mcl/include/cybozu/itoa.hpp:125:11 error: use of undeclared identifier
           'LLONG_MIN'
             if (x == LLONG_MIN) {
                      ^
1 error generated. 
herumi commented 4 years ago

LLONG_MIN is a standard macro. http://www.cplusplus.com/reference/climits/ Could you search what header defines LLONG_MIN is in your system?

Or try gmake CXX=clang++ -DLLONG_MIN=-0x8000000000000000LL.

Laggger164 commented 4 years ago

I tried the command, doesn't work. Invalid option -- D

And I kinda have no idea how to find out what header my system uses. I found this but I have no idea what to do with that information other than that figure this should work :/

herumi commented 4 years ago

I'm sorry that I showed a bad option. Could you try make CFLAGS_USER="-DLLONG_MIN=-0x8000000000000000LL" CXX=clang++?

Laggger164 commented 4 years ago

That got me a little further:


root@Eth2:~/work/bls-eth-go-binary # gmake CFLAGS_USER="-DLLONG_MIN=-0x8000000000000000LL" CXX=clang++
clang++ -c -o obj/bls_c384_256.o ../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 -I../bls/include -I../mcl/include -DBLS_ETH -DBLS_SWAP_G -DLLONG_MIN=-0x8000000000000000LL -DMCL_STATIC_CODE -DMCL_DONT_USE_XBYAK
clang++ -c -o obj/fp.o ../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 -I../bls/include -I../mcl/include -DBLS_ETH -DBLS_SWAP_G -DLLONG_MIN=-0x8000000000000000LL -DMCL_STATIC_CODE -DMCL_DONT_USE_XBYAK
gmake -C ../mcl src/base64.ll
gmake[1]: Entering directory '/root/work/mcl'
clang++ -o src/gen src/gen.cpp -g3 -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -Wundef -m64 -I include -I test -fomit-frame-pointer -DNDEBUG -fno-stack-protector -O3 -DLLONG_MIN=-0x8000000000000000LL -DMCL_DONT_USE_OPENSSL -fPIC -DMCL_USE_LLVM=1
In file included from src/gen.cpp:3:
In file included from include/mcl/op.hpp:9:
include/mcl/gmp_util.hpp:37:10: fatal error: 'gmpxx.h' file not found
#include "gmpxx.h"
1 error generated ```
herumi commented 4 years ago
make CFLAGS_USER="-DLLONG_MIN=-0x8000000000000000LL" MCL_USE_GMP=0
Laggger164 commented 4 years ago

Fixing the build, one problem at a time!

root@Eth2:~/work/bls-eth-go-binary # gmake CFLAGS_USER="-DLLONG_MIN=-0x8000000000000000LL" MCL_USE_GMP=0
gmake -C ../mcl src/base64.ll
gmake[1]: Entering directory '/root/work/mcl'
c++ -o src/gen src/gen.cpp -g3 -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -Wundef -m64 -I include -I test -fomit-frame-pointer -DNDEBUG -fno-stack-protector -O3 -DLLONG_MIN=-0x8000000000000000LL -DMCL_USE_VINT -DMCL_DONT_USE_OPENSSL -fPIC -DMCL_USE_LLVM=1
src/gen -u 64 -f src/func.list > src/base64.ll
llvmVer=0x70
gmake[1]: Leaving directory '/root/work/mcl'
c++ -c -o obj/base64.o ../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 -I../bls/include -I../mcl/include -DBLS_ETH -DBLS_SWAP_G -DLLONG_MIN=-0x8000000000000000LL -DMCL_STATIC_CODE -DMCL_DONT_USE_XBYAK
c++: warning: argument unused during compilation: '-I ../bls/include' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-I ../mcl/include' [-Wunused-command-line-argument]
warning: overriding the module target triple with x86_64-unknown-freebsd11.4
      [-Woverride-module]
1 warning generated.
gmake -C ../mcl obj/static_code.o
gmake[1]: Entering directory '/root/work/mcl'
gmake -C ../mcl obj/static_code.o
gmake[1]: Entering directory '/root/work/mcl'
c++ -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
gmake[1]: *** [Makefile:253: src/static_code.asm] Segmentation fault
gmake[1]: *** Deleting file 'src/static_code.asm'
gmake[1]: Leaving directory '/root/work/mcl'
gmake: *** [Makefile:51: ../mcl/obj/static_code.o] Error 2
herumi commented 4 years ago

At first, I had to ask your environment. What CPU do you use?

cd mcl
make bin/bls12_test.exe CFLAGS_USER="-DLLONG_MIN=-0x8000000000000000LL" MCL_USE_GMP=0
bin/bls12_test.exe
Laggger164 commented 4 years ago
root@Eth2:~ # cat /proc/cpuinfo
cat: /proc/cpuinfo: No such file or directory
root@Eth2:~ # sysctl -a | egrep -i 'hw.machine|hw.model|hw.ncpu'
hw.machine: amd64
hw.model: Intel(R) Xeon(R) CPU E31270 @ 3.40GHzhw.ncpu: 8
hw.machine_arch: amd64
root@Eth2:~ # uname -a
FreeBSD Eth2.0 11.3-RELEASE-p11 FreeBSD 11.3-RELEASE-p11 #0 r325575+fb17f3e15b8(HEAD): Tue Jul 28 11:09:10 EDT 2020     root@tnbuilds05.tn.ixsystems.net:/freenas-releng/freenas/_BE/objs/freenas-releng/freenas/_BE/os/sys/FreeNAS.amd64  amd64
root@Eth2:~ # cd
go/         lighthouse/ prysm/      work/
root@Eth2:~ # cd work/mcl/
root@Eth2:~/work/mcl # make bin/bls12_test.exe CFLAGS_USER="-DLLONG_MIN=-0x8000000000000000LL" MCL_USE_GMP=0
make: "/root/work/mcl/common.mk" line 3: Missing dependency operator
make: "/root/work/mcl/common.mk" line 5: Need an operator
make: "/root/work/mcl/common.mk" line 6: Missing dependency operator
make: "/root/work/mcl/common.mk" line 9: Need an operator
make: "/root/work/mcl/common.mk" line 10: Missing dependency operator
make: "/root/work/mcl/common.mk" line 12: Need an operator
make: "/root/work/mcl/common.mk" line 13: Missing dependency operator
make: "/root/work/mcl/common.mk" line 23: Need an operator
make: "/root/work/mcl/common.mk" line 25: Need an operator
make: "/root/work/mcl/common.mk" line 26: Missing dependency operator
make: "/root/work/mcl/common.mk" line 31: Need an operator
make: "/root/work/mcl/common.mk" line 34: Missing dependency operator
make: "/root/work/mcl/common.mk" line 37: Missing dependency operator
make: "/root/work/mcl/common.mk" line 39: Need an operator
make: "/root/work/mcl/common.mk" line 44: Need an operator
make: "/root/work/mcl/common.mk" line 45: Missing dependency operator
make: "/root/work/mcl/common.mk" line 51: Need an operator
make: "/root/work/mcl/common.mk" line 52: Missing dependency operator
make: "/root/work/mcl/common.mk" line 56: Need an operator
make: "/root/work/mcl/common.mk" line 57: Missing dependency operator
make: "/root/work/mcl/common.mk" line 60: Need an operator
make: "/root/work/mcl/common.mk" line 61: Missing dependency operator
make: "/root/work/mcl/common.mk" line 63: Need an operator
make: "/root/work/mcl/common.mk" line 70: Missing dependency operator
make: "/root/work/mcl/common.mk" line 71: Missing dependency operator
make: "/root/work/mcl/common.mk" line 74: Need an operator
make: "/root/work/mcl/common.mk" line 75: Need an operator
make: "/root/work/mcl/common.mk" line 77: Missing dependency operator
make: "/root/work/mcl/common.mk" line 79: Need an operator
make: "/root/work/mcl/common.mk" line 80: Missing dependency operator
make: "/root/work/mcl/common.mk" line 82: Need an operator
make: "/root/work/mcl/common.mk" line 84: Need an operator
make: "/root/work/mcl/common.mk" line 85: Need an operator
make: "/root/work/mcl/common.mk" line 86: Missing dependency operator
make: "/root/work/mcl/common.mk" line 87: Missing dependency operator
make: "/root/work/mcl/common.mk" line 89: Need an operator
make: "/root/work/mcl/common.mk" line 90: Need an operator
make: "/root/work/mcl/common.mk" line 92: Need an operator
make: "/root/work/mcl/common.mk" line 93: Need an operator
make: "/root/work/mcl/common.mk" line 100: Missing dependency operator
make: "/root/work/mcl/common.mk" line 102: Need an operator
make: "/root/work/mcl/common.mk" line 105: Missing dependency operator
make: "/root/work/mcl/common.mk" line 106: Missing dependency operator
make: "/root/work/mcl/common.mk" line 109: Need an operator
make: "/root/work/mcl/common.mk" line 110: Need an operator
make: "/root/work/mcl/common.mk" line 112: Missing dependency operator
make: "/root/work/mcl/common.mk" line 114: Need an operator
make: "/root/work/mcl/common.mk" line 115: Missing dependency operator
make: "/root/work/mcl/common.mk" line 117: Need an operator
make: "/root/work/mcl/common.mk" line 118: Missing dependency operator
make: "/root/work/mcl/common.mk" line 120: Need an operator
make: "/root/work/mcl/common.mk" line 121: Missing dependency operator
make: "/root/work/mcl/common.mk" line 123: Need an operator
make: "/root/work/mcl/common.mk" line 124: Missing dependency operator
make: "/root/work/mcl/common.mk" line 126: Need an operator
make: "/root/work/mcl/Makefile" line 14: Missing dependency operator
make: "/root/work/mcl/Makefile" line 20: Need an operator
make: "/root/work/mcl/Makefile" line 21: Missing dependency operator
make: "/root/work/mcl/Makefile" line 24: Missing dependency operator
make: "/root/work/mcl/Makefile" line 26: Need an operator
make: "/root/work/mcl/Makefile" line 27: Missing dependency operator
make: "/root/work/mcl/Makefile" line 29: Need an operator
make: "/root/work/mcl/Makefile" line 30: Need an operator
make: "/root/work/mcl/Makefile" line 33: Missing dependency operator
make: "/root/work/mcl/Makefile" line 35: Need an operator
make: "/root/work/mcl/Makefile" line 36: Missing dependency operator
make: "/root/work/mcl/Makefile" line 38: Need an operator
make: "/root/work/mcl/Makefile" line 39: Missing dependency operator
make: "/root/work/mcl/Makefile" line 41: Need an operator
make: "/root/work/mcl/Makefile" line 42: Missing dependency operator
make: "/root/work/mcl/Makefile" line 45: Need an operator
make: "/root/work/mcl/Makefile" line 82: Missing dependency operator
make: "/root/work/mcl/Makefile" line 83: Missing dependency operator
make: "/root/work/mcl/Makefile" line 85: Need an operator
make: "/root/work/mcl/Makefile" line 86: Need an operator
make: "/root/work/mcl/Makefile" line 87: Missing dependency operator
make: "/root/work/mcl/Makefile" line 89: Need an operator
make: "/root/work/mcl/Makefile" line 91: Need an operator
make: "/root/work/mcl/Makefile" line 92: Missing dependency operator
make: "/root/work/mcl/Makefile" line 94: Need an operator
make: "/root/work/mcl/Makefile" line 106: Missing dependency operator
make: "/root/work/mcl/Makefile" line 108: Need an operator
make: "/root/work/mcl/Makefile" line 110: Need an operator
make: "/root/work/mcl/Makefile" line 111: Missing dependency operator
make: "/root/work/mcl/Makefile" line 115: Missing dependency operator
make: "/root/work/mcl/Makefile" line 116: Missing dependency operator
make: "/root/work/mcl/Makefile" line 118: Need an operator
make: "/root/work/mcl/Makefile" line 119: Need an operator
make: "/root/work/mcl/Makefile" line 120: Need an operator
make: "/root/work/mcl/Makefile" line 133: Missing dependency operator
make: "/root/work/mcl/Makefile" line 136: Need an operator
make: "/root/work/mcl/Makefile" line 138: Missing dependency operator
make: "/root/work/mcl/Makefile" line 141: Need an operator
make: "/root/work/mcl/Makefile" line 144: Need an operator
make: "/root/work/mcl/Makefile" line 146: Missing dependency operator
make: "/root/work/mcl/Makefile" line 154: Need an operator
make: "/root/work/mcl/Makefile" line 155: Missing dependency operator
make: "/root/work/mcl/Makefile" line 164: Need an operator
make: "/root/work/mcl/Makefile" line 239: Missing dependency operator
make: "/root/work/mcl/Makefile" line 242: Need an operator
make: "/root/work/mcl/Makefile" line 244: Need an operator
make: "/root/work/mcl/Makefile" line 302: warning: duplicate script for target "obj/%.o" ignored
make: "/root/work/mcl/Makefile" line 299: warning: using previous script for "obj/%.o" defined here
make: "/root/work/mcl/Makefile" line 358: Missing dependency operator
make: "/root/work/mcl/Makefile" line 361: Need an operator
make: "/root/work/mcl/" line 1: warning: Zero byte read from file, skipping rest of line.
make: "/root/work/mcl/" line 1: Need an operator
make: Fatal errors encountered -- cannot continue
make: stopped in /root/work/mcl
root@Eth2:~/work/mcl # gmake bin/bls12_test.exe CFLAGS_USER="-DLLONG_MIN=-0x8000000000000000LL" MCL_USE_GMP=0
c++ -c src/asm/x86-64.s -o obj/x86-64.o -g3 -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -Wundef -m64 -I include -I test -fomit-frame-pointer -DNDEBUG -fno-stack-protector -O3 -DLLONG_MIN=-0x8000000000000000LL -DMCL_USE_VINT -DMCL_DONT_USE_OPENSSL -fPIC -DMCL_USE_LLVM=1
c++: warning: argument unused during compilation: '-fomit-frame-pointer' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-D NDEBUG' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-fno-stack-protector' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-D LLONG_MIN=-0x8000000000000000LL' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-D MCL_USE_VINT' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-D MCL_DONT_USE_OPENSSL' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-D MCL_USE_LLVM=1' [-Wunused-command-line-argument]
src/asm/x86-64.s:16652:2: warning: DWARF2 only supports one section per compilation unit
        .section        ".note.GNU-stack","",@progbits
        ^
c++ -c src/asm/x86-64.bmi2.s -o obj/x86-64.bmi2.o -g3 -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -Wundef -m64 -I include -I test -fomit-frame-pointer -DNDEBUG -fno-stack-protector -O3 -DLLONG_MIN=-0x8000000000000000LL -DMCL_USE_VINT -DMCL_DONT_USE_OPENSSL -fPIC -DMCL_USE_LLVM=1
c++: warning: argument unused during compilation: '-fomit-frame-pointer' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-D NDEBUG' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-fno-stack-protector' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-D LLONG_MIN=-0x8000000000000000LL' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-D MCL_USE_VINT' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-D MCL_DONT_USE_OPENSSL' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-D MCL_USE_LLVM=1' [-Wunused-command-line-argument]
src/asm/x86-64.bmi2.s:14155:2: warning: DWARF2 only supports one section per compilation unit
        .section        ".note.GNU-stack","",@progbits
        ^
c++ -g3 -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -Wundef -m64 -I include -I test -fomit-frame-pointer -DNDEBUG -fno-stack-protector -O3 -DLLONG_MIN=-0x8000000000000000LL -DMCL_USE_VINT-DMCL_DONT_USE_OPENSSL -fPIC -DMCL_USE_LLVM=1 -c src/fp.cpp -o obj/fp.o -MMD -MP -MF obj/fp.d
ar r lib/libmcl.a obj/fp.o obj/x86-64.o obj/x86-64.bmi2.o
ar: warning: creating lib/libmcl.a
c++ -g3 -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -Wundef -m64 -I include -I test -fomit-frame-pointer -DNDEBUG -fno-stack-protector -O3 -DLLONG_MIN=-0x8000000000000000LL -DMCL_USE_VINT-DMCL_DONT_USE_OPENSSL -fPIC -DMCL_USE_LLVM=1 -c test/bls12_test.cpp -o obj/bls12_test.o -MMD -MP -MF obj/bls12_test.d
c++ obj/bls12_test.o -o bin/bls12_test.exe lib/libmcl.a -lrt   -m64
root@Eth2:~/work/mcl #
herumi commented 4 years ago

Does bin/bls12_test.exe run well?

Laggger164 commented 4 years ago

Yes, gmake for FreeBSD, otherwise it uses something completely different, not GNU/make.

And yes, the test seems to run correctly.

egonspace commented 4 years ago

I also have the same compilation error from the latest source. I am using docker-alpainlinux.

clang++ -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
make[1]: *** [Makefile:253: src/static_code.asm] Segmentation fault
make[1]: *** Deleting file 'src/static_code.asm'

Dockerfile

FROM alpine:3.9
RUN apk update && \
    apk upgrade && \
    apk --no-cache add git make gcc libc-dev build-base curl jq bash && \
    addgroup --g 503 tmuser && \
    adduser -S -G tmuser --uid 503 tmuser -h "$TMHOME"
herumi commented 4 years ago
src/dump_code > src/static_code.asm
gmake[1]: *** [Makefile:253: src/static_code.asm] Segmentation fault

Coud you try gdb?

gdb src/dump_code
r
(maybe segv)
bt
Laggger164 commented 4 years ago

How do I use that?

r just prints 'No executable file specified' 'Use the "file" or "exec-file" command'

herumi commented 4 years ago
cd bls-eth-go-binary
gmake ...
gdb src/dump_code

Then, gdb execs src/dump_code and stops. So could you type r and bt in the prompt of gdb?

Laggger164 commented 4 years ago
(gdb) r
Starting program:
No executable file specified.
Use the "file" or "exec-file" command.
(gdb) bt
No stack.

That's what I was getting before.

herumi commented 4 years ago

https://github.com/herumi/bls-eth-go-binary/issues/27#issuecomment-695780900

c++ -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
gmake[1]: *** [Makefile:253: src/static_code.asm] Segmentation fault

shows that you made src/dump_code.

@egonspace Could you exec https://github.com/herumi/bls-eth-go-binary/issues/27#issuecomment-696045772 ?

herumi commented 4 years ago

I found the reason. Please wait a moment.

herumi commented 4 years ago

I've fixed the problem. Could you try the latest mcl and bls-eth-go-binary?

egonspace commented 4 years ago

Yes, it's going well now. Building within docker made it difficult to run gdb. Thank you very much!!

Laggger164 commented 4 years ago

It seems the new version got further, but still stopped at some sort of illegal instruction.

Again I am on FreeBSD, so it's a lot different than GNU/Linux.

root@Eth2:~/work2/bls-eth-go-binary # gmake CXX=clang++
clang++ -c -o obj/bls_c384_256.o ../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 -I../bls/include -I../mcl/include -DBLS_ETH -DBLS_SWAP_G  -DMCL_STATIC_CODE -DMCL_DONT_USE_XBYAK
clang++ -c -o obj/fp.o ../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 -I../bls/include -I../mcl/include -DBLS_ETH -DBLS_SWAP_G  -DMCL_STATIC_CODE -DMCL_DONT_USE_XBYAK
gmake -C ../mcl src/base64.ll
gmake[1]: Entering directory '/root/work2/mcl'
clang++ -o src/gen src/gen.cpp -g3 -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -Wundef -m64 -I include -I test -fomit-frame-pointer -DNDEBUG -fno-stack-protector -O3  -DMCL_DONT_USE_OPENSSL -fPIC -DMCL_USE_LLVM=1 -DMCL_USE_VINT -DMCL_VINT_FIXED_BUFFER
src/gen -u 64 -f src/func.list > src/base64.ll
llvmVer=0x70
gmake[1]: Leaving directory '/root/work2/mcl'
clang++ -c -o obj/base64.o ../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 -I../bls/include -I../mcl/include -DBLS_ETH-DBLS_SWAP_G  -DMCL_STATIC_CODE -DMCL_DONT_USE_XBYAK
clang++: warning: argument unused during compilation: '-I ../bls/include' [-Wunused-command-line-argument]
clang++: warning: argument unused during compilation: '-I ../mcl/include' [-Wunused-command-line-argument]
warning: overriding the module target triple with x86_64-unknown-freebsd11.4
      [-Woverride-module]
1 warning generated.
gmake -C ../mcl obj/static_code.o
gmake[1]: Entering directory '/root/work2/mcl'
gmake -C ../mcl obj/static_code.o
gmake[1]: Entering directory '/root/work2/mcl'
clang++ -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
IT -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
gmake[1]: *** [Makefile:253: src/static_code.asm] Illegal instruction
gmake[1]: *** Deleting file 'src/static_code.asm'
gmake[1]: Leaving directory '/root/work2/mcl'
gmake: *** [Makefile:55: ../mcl/obj/static_code.o] Error 2
herumi commented 4 years ago

src/dump_code > src/static_code.asm gmake[1]: *** [Makefile:253: src/static_code.asm] Illegal instruction

Please try again the following commands:

cd <your mcl directory>
gdb src/dump_code
r
bt
git clone https://github.com/herumi/xbyak
cd xbyak/sample
g++ test_util.cpp -I ../ && ./a.out
Laggger164 commented 4 years ago
root@Eth2:~ # cd work2/mcl/
root@Eth2:~/work2/mcl # gdb src/dump_code
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
(gdb) r
Starting program: /root/work2/mcl/src/dump_code
align 16
dq 0xffffffff00000001,0x53bda402fffe5bfe,0x3339d80809a1d805,0x73eda753299d7d48,
segment .text
global mclx_Fr_addPre
align 16
mclx_Fr_addPre:
db 0x48,0x8b,0x06,0x48,0x03,0x02,0x48,0x89,0x07,0x48,0x8b,0x46,0x08,0x48,0x13,0x42,
db 0x08,0x48,0x89,0x47,0x08,0x48,0x8b,0x46,0x10,0x48,0x13,0x42,0x10,0x48,0x89,0x47,
db 0x10,0x48,0x8b,0x46,0x18,0x48,0x13,0x42,0x18,0x48,0x89,0x47,0x18,0xc3,
segment .text
global mclx_Fr_subPre
align 16
mclx_Fr_subPre:
db 0x48,0x8b,0x06,0x48,0x2b,0x02,0x48,0x89,0x07,0x48,0x8b,0x46,0x08,0x48,0x1b,0x42,
db 0x08,0x48,0x89,0x47,0x08,0x48,0x8b,0x46,0x10,0x48,0x1b,0x42,0x10,0x48,0x89,0x47,
db 0x10,0x48,0x8b,0x46,0x18,0x48,0x1b,0x42,0x18,0x48,0x89,0x47,0x18,0xc3,
segment .text
global mclx_Fr_add
align 16
mclx_Fr_add:
db 0x53,0x55,0x41,0x54,0x48,0x8b,0x0e,0x4c,0x8b,0x46,0x08,0x4c,0x8b,0x4e,0x10,0x4c,
db 0x8b,0x56,0x18,0x48,0x03,0x0a,0x4c,0x13,0x42,0x08,0x4c,0x13,0x4a,0x10,0x4c,0x13,
db 0x52,0x18,0x49,0x89,0xcb,0x4c,0x89,0xc3,0x4c,0x89,0xcd,0x4d,0x89,0xd4,0x48,0x8d,
db 0x05,0x4b,0xff,0xff,0xff,0x4c,0x2b,0x18,0x48,0x1b,0x58,0x08,0x48,0x1b,0x68,0x10,
db 0x4c,0x1b,0x60,0x18,0x4c,0x0f,0x42,0xd9,0x49,0x0f,0x42,0xd8,0x49,0x0f,0x42,0xe9,
db 0x4d,0x0f,0x42,0xe2,0x4c,0x89,0x1f,0x48,0x89,0x5f,0x08,0x48,0x89,0x6f,0x10,0x4c,
db 0x89,0x67,0x18,0x41,0x5c,0x5d,0x5b,0xc3,
segment .text
global mclx_Fr_sub
align 16
mclx_Fr_sub:
db 0x53,0x55,0x41,0x54,0x48,0x8b,0x0e,0x4c,0x8b,0x46,0x08,0x4c,0x8b,0x4e,0x10,0x4c,
db 0x8b,0x56,0x18,0x48,0x2b,0x0a,0x4c,0x1b,0x42,0x08,0x4c,0x1b,0x4a,0x10,0x4c,0x1b,
db 0x52,0x18,0x48,0x8d,0x05,0xe7,0xfe,0xff,0xff,0x4c,0x8b,0x18,0x48,0x8b,0x58,0x08,
db 0x48,0x8b,0x68,0x10,0x4c,0x8b,0x60,0x18,0x48,0x19,0xc0,0x49,0x21,0xc3,0x48,0x21,
db 0xc3,0x48,0x21,0xc5,0x49,0x21,0xc4,0x4c,0x01,0xd9,0x49,0x11,0xd8,0x49,0x11,0xe9,
db 0x4d,0x11,0xe2,0x48,0x89,0x0f,0x4c,0x89,0x47,0x08,0x4c,0x89,0x4f,0x10,0x4c,0x89,
db 0x57,0x18,0x41,0x5c,0x5d,0x5b,0xc3,
segment .text
global mclx_Fr_shr1
align 16
mclx_Fr_shr1:
db 0x48,0x8b,0x06,0x48,0x8b,0x56,0x08,0x48,0x0f,0xac,0xd0,0x01,0x48,0x89,0x07,0x48,
db 0x8b,0x46,0x10,0x48,0x0f,0xac,0xc2,0x01,0x48,0x89,0x57,0x08,0x48,0x8b,0x56,0x18,
db 0x48,0x0f,0xac,0xd0,0x01,0x48,0x89,0x47,0x10,0x48,0xd1,0xea,0x48,0x89,0x57,0x18,
db 0xc3,
segment .text
global mclx_Fr_neg
align 16
mclx_Fr_neg:
db 0x4c,0x8b,0x1e,0x48,0x8b,0x4e,0x08,0x4c,0x8b,0x46,0x10,0x4c,0x8b,0x4e,0x18,0x4c,
db 0x89,0xd8,0x48,0x09,0xc8,0x4c,0x09,0xc0,0x4c,0x09,0xc8,0x75,0x11,0x48,0x89,0x07,
db 0x48,0x89,0x47,0x08,0x48,0x89,0x47,0x10,0x48,0x89,0x47,0x18,0xeb,0x31,0x48,0x8d,
db 0x05,0x2b,0xfe,0xff,0xff,0x48,0x8b,0x10,0x4c,0x29,0xda,0x48,0x89,0x17,0x48,0x8b,
db 0x50,0x08,0x48,0x19,0xca,0x48,0x89,0x57,0x08,0x48,0x8b,0x50,0x10,0x4c,0x19,0xc2,
db 0x48,0x89,0x57,0x10,0x48,0x8b,0x50,0x18,0x4c,0x19,0xca,0x48,0x89,0x57,0x18,0xc3,
segment .text
global mclx_FrDbl_mod
align 16
mclx_FrDbl_mod:
db 0x53,0x55,0x41,0x54,0x41,0x55,0x41,0x56,0x41,0x57,0x49,0x89,0xd3,0xe8,0x0b,0x00,
db 0x00,0x00,0x41,0x5f,0x41,0x5e,0x41,0x5d,0x41,0x5c,0x5d,0x5b,0xc3,0xc4,0xe1,0xf9,
db 0x6e,0xc7,0x48,0x8b,0x3e,0x48,0xb8,0xff,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0x48,
db 0xf7,0xe7,0x48,0x8d,0x0d,0xc7,0xfd,0xff,0xff,0x49,0x89,0xc5,0x4c,0x89,0xea,0xc4,
db 0x62,0xbb,0xf6,0x09,0xc4,0x62,0xfb,0xf6,0x51,0x08,0x49,0x01,0xc1,0xc4,0x62,0xfb,
db 0xf6,0x69,0x10,0x49,0x11,0xc2,0xc4,0xe2,0xfb,0xf6,0x51,0x18,0x49,0x11,0xc5,0x48,
db 0x83,0xd2,0x00,0x4d,0x31,0xf6,0x4d,0x31,0xff,0x4d,0x31,0xdb,0x48,0x89,0xd3,0x49,
db 0x01,0xf8,0x4c,0x13,0x4e,0x08,0x4c,0x13,0x56,0x10,0x4c,0x13,0x6e,0x18,0x48,0x13,
db 0x5e,0x20,0x4c,0x13,0x76,0x28,0x4c,0x13,0x7e,0x30,0x4c,0x13,0x5e,0x38,0x48,0xb8,
db 0xff,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0x49,0xf7,0xe1,0x48,0x89,0xc7,0xc4,0xc1,
db 0xf9,0x6e,0xcb,0x48,0x89,0xfa,0xc4,0x62,0xcb,0xf6,0x21,0xc4,0xe2,0xfb,0xf6,0x69,
db 0x08,0x49,0x01,0xc4,0xc4,0xe2,0xfb,0xf6,0x79,0x10,0x48,0x11,0xc5,0xc4,0xe2,0xfb,
db 0xf6,0x51,0x18,0x48,0x11,0xc7,0x48,0x83,0xd2,0x00,0xc4,0xc1,0xf9,0x7e,0xcb,0x49,
db 0x01,0xf1,0x4d,0x11,0xe2,0x49,0x11,0xed,0x48,0x11,0xfb,0x49,0x11,0xd6,0x49,0x83,
db 0xd7,0x00,0x49,0x83,0xd3,0x00,0x48,0xb8,0xff,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,
db 0x49,0xf7,0xe2,0x48,0x89,0xc7,0x48,0x89,0xfa,0xc4,0xe2,0x9b,0xf6,0x31,0xc4,0xe2,
db 0xfb,0xf6,0x69,0x08,0x48,0x01,0xc6,0xc4,0xe2,0xfb,0xf6,0x79,0x10,0x48,0x11,0xc5,
db 0xc4,0xe2,0xfb,0xf6,0x51,0x18,0x48,0x11,0xc7,0x48,0x83,0xd2,0x00,0x4d,0x01,0xe2,
db 0x49,0x11,0xf5,0x48,0x11,0xeb,0x49,0x11,0xfe,0x49,0x11,0xd7,0x49,0x83,0xd3,0x00,
db 0x48,0xb8,0xff,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0x49,0xf7,0xe5,0x48,0x89,0xc7,
db 0x48,0x89,0xfa,0xc4,0xe2,0x9b,0xf6,0x31,0xc4,0xe2,0xfb,0xf6,0x69,0x08,0x48,0x01,
db 0xc6,0xc4,0xe2,0xfb,0xf6,0x79,0x10,0x48,0x11,0xc5,0xc4,0xe2,0xfb,0xf6,0x51,0x18,
db 0x48,0x11,0xc7,0x48,0x83,0xd2,0x00,0x4d,0x01,0xe5,0x48,0x11,0xf3,0x49,0x11,0xee,
db 0x49,0x11,0xff,0x49,0x11,0xd3,0x48,0x89,0xdf,0x4d,0x89,0xf0,0x4d,0x89,0xf9,0x4d,
db 0x89,0xdc,0x48,0x2b,0x19,0x4c,0x1b,0x71,0x08,0x4c,0x1b,0x79,0x10,0x4c,0x1b,0x59,
db 0x18,0x48,0x0f,0x42,0xdf,0x4d,0x0f,0x42,0xf0,0x4d,0x0f,0x42,0xf9,0x4d,0x0f,0x42,
db 0xdc,0xc4,0xe1,0xf9,0x7e,0xc7,0x48,0x89,0x1f,0x4c,0x89,0x77,0x08,0x4c,0x89,0x7f,
db 0x10,0x4c,0x89,0x5f,0x18,0xc3,
segment .text
global mclx_Fr_mul
align 16
mclx_Fr_mul:
db 0x53,0x55,0x41,0x54,0x41,0x55,0x41,0x56,0x41,0x57,0x49,0x89,0xd3,0xe8,0x0b,0x00,
db 0x00,0x00,0x41,0x5f,0x41,0x5e,0x41,0x5d,0x41,0x5c,0x5d,0x5b,0xc3,0xc4,0xe1,0xf9,
db 0x6e,0xc7,0x48,0x8d,0x3d,0x17,0xfc,0xff,0xff,0xc4,0xc1,0xf9,0x6e,0xcb,0x4d,0x8b,
db 0x1b,0x4c,0x89,0xda,0xc4,0x62,0xbb,0xf6,0x0e,0xc4,0x62,0xfb,0xf6,0x56,0x08,0x49,
db 0x01,0xc1,0xc4,0x62,0xfb,0xf6,0x5e,0x10,0x49,0x11,0xc2,0xc4,0xe2,0xfb,0xf6,0x56,
db 0x18,0x49,0x11,0xc3,0x48,0x83,0xd2,0x00,0x48,0x89,0xd1,0x48,0xb8,0xff,0xff,0xff,
db 0xff,0xfe,0xff,0xff,0xff,0x49,0xf7,0xe0,0x49,0x89,0xc5,0x4c,0x89,0xea,0xc4,0xe2,
db 0xe3,0xf6,0x2f,0xc4,0x62,0xfb,0xf6,0x67,0x08,0x48,0x01,0xc5,0xc4,0x62,0xfb,0xf6,
db 0x6f,0x10,0x49,0x11,0xc4,0xc4,0xe2,0xfb,0xf6,0x57,0x18,0x49,0x11,0xc5,0x48,0x83,
db 0xd2,0x00,0x49,0x01,0xd8,0x49,0x11,0xe9,0x4d,0x11,0xe2,0x4d,0x11,0xdd,0x48,0x11,
db 0xd1,0xc4,0xc1,0xf9,0x7e,0xcb,0x4d,0x8b,0x5b,0x08,0x4c,0x89,0xda,0xc4,0xe2,0xe3,
db 0xf6,0x2e,0xc4,0x62,0xfb,0xf6,0x66,0x08,0x48,0x01,0xc5,0xc4,0x62,0xfb,0xf6,0x5e,
db 0x10,0x49,0x11,0xc4,0xc4,0xe2,0xfb,0xf6,0x56,0x18,0x49,0x11,0xc3,0x48,0x83,0xd2,
db 0x00,0x49,0x01,0xd9,0x49,0x11,0xea,0x4d,0x11,0xe5,0x49,0x11,0xcb,0x49,0x11,0xd0,
db 0x48,0xb8,0xff,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0x49,0xf7,0xe1,0x48,0x89,0xc1,
db 0x48,0x89,0xca,0xc4,0xe2,0xe3,0xf6,0x2f,0xc4,0x62,0xfb,0xf6,0x67,0x08,0x48,0x01,
db 0xc5,0xc4,0xe2,0xfb,0xf6,0x4f,0x10,0x49,0x11,0xc4,0xc4,0xe2,0xfb,0xf6,0x57,0x18,
db 0x48,0x11,0xc1,0x48,0x83,0xd2,0x00,0x49,0x01,0xd9,0x49,0x11,0xea,0x4d,0x11,0xe5,
db 0x4c,0x11,0xd9,0x49,0x11,0xd0,0xc4,0xc1,0xf9,0x7e,0xcb,0x4d,0x8b,0x5b,0x10,0x4c,
db 0x89,0xda,0xc4,0xe2,0xe3,0xf6,0x2e,0xc4,0x62,0xfb,0xf6,0x66,0x08,0x48,0x01,0xc5,
db 0xc4,0x62,0xfb,0xf6,0x5e,0x10,0x49,0x11,0xc4,0xc4,0xe2,0xfb,0xf6,0x56,0x18,0x49,
db 0x11,0xc3,0x48,0x83,0xd2,0x00,0x49,0x01,0xda,0x49,0x11,0xed,0x4c,0x11,0xe1,0x4d,
db 0x11,0xc3,0x49,0x11,0xd1,0x48,0xb8,0xff,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0x49,
db 0xf7,0xe2,0x49,0x89,0xc0,0x4c,0x89,0xc2,0xc4,0xe2,0xe3,0xf6,0x2f,0xc4,0x62,0xfb,
db 0xf6,0x67,0x08,0x48,0x01,0xc5,0xc4,0x62,0xfb,0xf6,0x47,0x10,0x49,0x11,0xc4,0xc4,
db 0xe2,0xfb,0xf6,0x57,0x18,0x49,0x11,0xc0,0x48,0x83,0xd2,0x00,0x49,0x01,0xda,0x49,
db 0x11,0xed,0x4c,0x11,0xe1,0x4d,0x11,0xd8,0x49,0x11,0xd1,0xc4,0xc1,0xf9,0x7e,0xcb,
db 0x4d,0x8b,0x5b,0x18,0x4c,0x89,0xda,0xc4,0xe2,0xe3,0xf6,0x2e,0xc4,0x62,0xfb,0xf6,
db 0x66,0x08,0x48,0x01,0xc5,0xc4,0x62,0xfb,0xf6,0x5e,0x10,0x49,0x11,0xc4,0xc4,0xe2,
db 0xfb,0xf6,0x56,0x18,0x49,0x11,0xc3,0x48,0x83,0xd2,0x00,0x49,0x01,0xdd,0x48,0x11,
db 0xe9,0x4d,0x11,0xe0,0x4d,0x11,0xcb,0x49,0x11,0xd2,0x48,0xb8,0xff,0xff,0xff,0xff,
db 0xfe,0xff,0xff,0xff,0x49,0xf7,0xe5,0x49,0x89,0xc1,0x4c,0x89,0xca,0xc4,0xe2,0xe3,
db 0xf6,0x2f,0xc4,0x62,0xfb,0xf6,0x67,0x08,0x48,0x01,0xc5,0xc4,0x62,0xfb,0xf6,0x4f,
db 0x10,0x49,0x11,0xc4,0xc4,0xe2,0xfb,0xf6,0x57,0x18,0x49,0x11,0xc1,0x48,0x83,0xd2,
db 0x00,0x49,0x01,0xdd,0x48,0x11,0xe9,0x4d,0x11,0xe0,0x4d,0x11,0xd9,0x49,0x11,0xd2,
db 0x48,0x89,0xcb,0x4c,0x89,0xc5,0x4d,0x89,0xcc,0x4c,0x89,0xd2,0x48,0x2b,0x0f,0x4c,
db 0x1b,0x47,0x08,0x4c,0x1b,0x4f,0x10,0x4c,0x1b,0x57,0x18,0x48,0x0f,0x42,0xcb,0x4c,
db 0x0f,0x42,0xc5,0x4d,0x0f,0x42,0xcc,0x4c,0x0f,0x42,0xd2,0xc4,0xe1,0xf9,0x7e,0xc7,
db 0x48,0x89,0x0f,0x4c,0x89,0x47,0x08,0x4c,0x89,0x4f,0x10,0x4c,0x89,0x57,0x18,0xc3,
segment .text
global mclx_Fr_sqr
align 16
mclx_Fr_sqr:
db 0x48,0x89,0xf2,0xe9,0x88,0xfd,0xff,0xff,
segment .text
global mclx_Fr_preInv
align 16
mclx_Fr_preInv:
db 0x53,0x55,0x41,0x54,0x41,0x55,0x41,0x56,0x41,0x57,0x48,0x83,0xec,0x48,0x48,0x89,
db 0x7c,0x24,0x18,0x48,0x89,0xf0,0x4c,0x8b,0x30,0x4c,0x8b,0x78,0x08,0x48,0x8b,0x48,
db 0x10,0x48,0x89,0x0c,0x24,0x48,0x8b,0x48,0x18,0x48,0x89,0x4c,0x24,0x08,0x48,0x8d,
db 0x05,0x8b,0xf9,0xff,0xff,0x48,0x8b,0x10,0x48,0x8b,0x70,0x08,0x48,0x8b,0x78,0x10,
db 0x48,0x8b,0x48,0x18,0x48,0x89,0x4c,0x24,0x10,0x48,0x31,0xc0,0x49,0x89,0xc3,0x49,
db 0x89,0xc2,0x49,0x89,0xc0,0x49,0x89,0xc1,0x48,0x89,0xc3,0x48,0x89,0xc5,0x49,0x89,
db 0xc4,0x49,0x89,0xc5,0xbb,0x01,0x00,0x00,0x00,0x4c,0x89,0xf1,0x4c,0x09,0xf9,0x48,
db 0x0b,0x0c,0x24,0x48,0x0b,0x4c,0x24,0x08,0x0f,0x84,0xf7,0x02,0x00,0x00,0x48,0xf7,
db 0xc2,0x01,0x00,0x00,0x00,0x0f,0x84,0xcd,0x00,0x00,0x00,0x49,0xf7,0xc6,0x01,0x00,
db 0x00,0x00,0x0f,0x84,0x6e,0x00,0x00,0x00,0x48,0x8b,0x4c,0x24,0x08,0x48,0x0b,0x4c,
db 0x24,0x10,0x0f,0x84,0x07,0x01,0x00,0x00,0x48,0x8b,0x4c,0x24,0x10,0x48,0x39,0x4c,
db 0x24,0x08,0x0f,0x82,0x80,0x00,0x00,0x00,0x0f,0x85,0x28,0x00,0x00,0x00,0x48,0x39,
db 0x3c,0x24,0x0f,0x82,0x70,0x00,0x00,0x00,0x0f,0x85,0x18,0x00,0x00,0x00,0x49,0x39,
db 0xf7,0x0f,0x82,0x61,0x00,0x00,0x00,0x0f,0x85,0x09,0x00,0x00,0x00,0x49,0x39,0xd6,
db 0x0f,0x82,0x52,0x00,0x00,0x00,0x49,0x29,0xd6,0x49,0x19,0xf7,0x48,0x19,0x3c,0x24,
db 0x48,0x8b,0x4c,0x24,0x10,0x48,0x19,0x4c,0x24,0x08,0x4c,0x01,0xdb,0x4c,0x11,0xd5,
db 0x4d,0x11,0xc4,0x4d,0x11,0xcd,0x4d,0x0f,0xac,0xfe,0x01,0x48,0x8b,0x0c,0x24,0x49,
db 0x0f,0xac,0xcf,0x01,0x48,0x8b,0x4c,0x24,0x08,0x48,0x0f,0xac,0x0c,0x24,0x01,0x48,
db 0xd1,0x6c,0x24,0x08,0x4d,0x01,0xdb,0x4d,0x11,0xd2,0x4d,0x11,0xc0,0x4d,0x11,0xc9,
db 0x48,0xff,0xc0,0xe9,0x31,0xff,0xff,0xff,0x4c,0x29,0xf2,0x4c,0x19,0xfe,0x48,0x1b,
db 0x3c,0x24,0x48,0x8b,0x4c,0x24,0x08,0x48,0x19,0x4c,0x24,0x10,0x49,0x01,0xdb,0x49,
db 0x11,0xea,0x4d,0x11,0xe0,0x4d,0x11,0xe9,0x48,0x0f,0xac,0xf2,0x01,0x48,0x0f,0xac,
db 0xfe,0x01,0x48,0x8b,0x4c,0x24,0x10,0x48,0x0f,0xac,0xcf,0x01,0x48,0xd1,0x6c,0x24,
db 0x10,0x48,0x01,0xdb,0x48,0x11,0xed,0x4d,0x11,0xe4,0x4d,0x11,0xed,0x48,0xff,0xc0,
db 0xe9,0xe4,0xfe,0xff,0xff,0x4c,0x89,0xf1,0x4c,0x09,0xf9,0x48,0x0b,0x0c,0x24,0x0f,
db 0x84,0xe0,0x01,0x00,0x00,0x48,0xf7,0xc2,0x01,0x00,0x00,0x00,0x0f,0x84,0x94,0x00,
db 0x00,0x00,0x49,0xf7,0xc6,0x01,0x00,0x00,0x00,0x0f,0x84,0x4b,0x00,0x00,0x00,0x48,
db 0x8b,0x0c,0x24,0x48,0x09,0xf9,0x0f,0x84,0xc1,0x00,0x00,0x00,0x48,0x39,0x3c,0x24,
db 0x0f,0x82,0x5a,0x00,0x00,0x00,0x0f,0x85,0x18,0x00,0x00,0x00,0x49,0x39,0xf7,0x0f,
db 0x82,0x4b,0x00,0x00,0x00,0x0f,0x85,0x09,0x00,0x00,0x00,0x49,0x39,0xd6,0x0f,0x82,
db 0x3c,0x00,0x00,0x00,0x49,0x29,0xd6,0x49,0x19,0xf7,0x48,0x19,0x3c,0x24,0x4c,0x01,
db 0xdb,0x4c,0x11,0xd5,0x4d,0x11,0xc4,0x4d,0x11,0xcd,0x4d,0x0f,0xac,0xfe,0x01,0x48,
db 0x8b,0x0c,0x24,0x49,0x0f,0xac,0xcf,0x01,0x48,0xd1,0x2c,0x24,0x4d,0x01,0xdb,0x4d,
db 0x11,0xd2,0x4d,0x11,0xc0,0x4d,0x11,0xc9,0x48,0xff,0xc0,0xe9,0x65,0xff,0xff,0xff,
db 0x4c,0x29,0xf2,0x4c,0x19,0xfe,0x48,0x1b,0x3c,0x24,0x49,0x01,0xdb,0x49,0x11,0xea,
db 0x4d,0x11,0xe0,0x4d,0x11,0xe9,0x48,0x0f,0xac,0xf2,0x01,0x48,0x0f,0xac,0xfe,0x01,
db 0x48,0xd1,0xef,0x48,0x01,0xdb,0x48,0x11,0xed,0x4d,0x11,0xe4,0x4d,0x11,0xed,0x48,
db 0xff,0xc0,0xe9,0x2e,0xff,0xff,0xff,0x4c,0x89,0xf1,0x4c,0x09,0xf9,0x0f,0x84,0x12,
db 0x01,0x00,0x00,0x48,0xf7,0xc2,0x01,0x00,0x00,0x00,0x0f,0x84,0x71,0x00,0x00,0x00,
db 0x49,0xf7,0xc6,0x01,0x00,0x00,0x00,0x0f,0x84,0x36,0x00,0x00,0x00,0x4c,0x89,0xf9,
db 0x48,0x09,0xf1,0x0f,0x84,0x97,0x00,0x00,0x00,0x49,0x39,0xf7,0x0f,0x82,0x3d,0x00,
db 0x00,0x00,0x0f,0x85,0x09,0x00,0x00,0x00,0x49,0x39,0xd6,0x0f,0x82,0x2e,0x00,0x00,
db 0x00,0x49,0x29,0xd6,0x49,0x19,0xf7,0x4c,0x01,0xdb,0x4c,0x11,0xd5,0x4d,0x11,0xc4,
db 0x4d,0x11,0xcd,0x4d,0x0f,0xac,0xfe,0x01,0x49,0xd1,0xef,0x4d,0x01,0xdb,0x4d,0x11,
db 0xd2,0x4d,0x11,0xc0,0x4d,0x11,0xc9,0x48,0xff,0xc0,0xe9,0x88,0xff,0xff,0xff,0x4c,
db 0x29,0xf2,0x4c,0x19,0xfe,0x49,0x01,0xdb,0x49,0x11,0xea,0x4d,0x11,0xe0,0x4d,0x11,
db 0xe9,0x48,0x0f,0xac,0xf2,0x01,0x48,0xd1,0xee,0x48,0x01,0xdb,0x48,0x11,0xed,0x4d,
db 0x11,0xe4,0x4d,0x11,0xed,0x48,0xff,0xc0,0xe9,0x5a,0xff,0xff,0xff,0x4d,0x85,0xf6,
db 0x0f,0x84,0x6f,0x00,0x00,0x00,0x48,0xf7,0xc2,0x01,0x00,0x00,0x00,0x0f,0x84,0x4b,
db 0x00,0x00,0x00,0x49,0xf7,0xc6,0x01,0x00,0x00,0x00,0x0f,0x84,0x18,0x00,0x00,0x00,
db 0x49,0x39,0xd6,0x0f,0x82,0x26,0x00,0x00,0x00,0x49,0x29,0xd6,0x4c,0x01,0xdb,0x4c,
db 0x11,0xd5,0x4d,0x11,0xc4,0x4d,0x11,0xcd,0x49,0xd1,0xee,0x4d,0x01,0xdb,0x4d,0x11,
db 0xd2,0x4d,0x11,0xc0,0x4d,0x11,0xc9,0x48,0xff,0xc0,0xe9,0xae,0xff,0xff,0xff,0x4c,
db 0x29,0xf2,0x49,0x01,0xdb,0x49,0x11,0xea,0x4d,0x11,0xe0,0x4d,0x11,0xe9,0x48,0xd1,
db 0xea,0x48,0x01,0xdb,0x48,0x11,0xed,0x4d,0x11,0xe4,0x4d,0x11,0xed,0x48,0xff,0xc0,
db 0xe9,0x88,0xff,0xff,0xff,0x48,0x8d,0x1d,0x44,0xf6,0xff,0xff,0x48,0x8b,0x54,0x24,
db 0x18,0x48,0x8b,0x0b,0x4c,0x29,0xd9,0x48,0x89,0x0a,0x48,0x8b,0x4b,0x08,0x4c,0x19,
db 0xd1,0x48,0x89,0x4a,0x08,0x48,0x8b,0x4b,0x10,0x4c,0x19,0xc1,0x48,0x89,0x4a,0x10,
db 0x48,0x8b,0x4b,0x18,0x4c,0x19,0xc9,0x48,0x89,0x4a,0x18,0x73,0x1e,0x48,0x8b,0x0b,
db 0x48,0x01,0x0a,0x48,0x8b,0x4b,0x08,0x48,0x11,0x4a,0x08,0x48,0x8b,0x4b,0x10,0x48,
db 0x11,0x4a,0x10,0x48,0x8b,0x4b,0x18,0x48,0x11,0x4a,0x18,0x48,0x83,0xc4,0x48,0x41,
db 0x5f,0x41,0x5e,0x41,0x5d,0x41,0x5c,0x5d,0x5b,0xc3,

Program received signal SIGILL, Illegal instruction.
0x00000008006d83f4 in ?? ()
(gdb) bt
#0  0x00000008006d83f4 in ?? ()
Segmentation fault
root@Eth2:~/work2/mcl # git clone https://github.com/herumi/xbyak
Cloning into 'xbyak'...
remote: Enumerating objects: 86, done.
remote: Counting objects: 100% (86/86), done.
remote: Compressing objects: 100% (58/58), done.
remote: Total 4907 (delta 34), reused 63 (delta 28), pack-reused 4821
Receiving objects: 100% (4907/4907), 2.08 MiB | 600.00 KiB/s, done.
Resolving deltas: 100% (3318/3318), done.
root@Eth2:~/work2/mcl # cd xbyak/sample
root@Eth2:~/work2/mcl/xbyak/sample # g++ test_util.cpp -I ../ && ./a.out
g++: Command not found.
herumi commented 4 years ago

Your mcl/src/dump_code seems not to be updated. please clean the directory.

g++: Command not found.

If you dont have g++, then use clang++.

Laggger164 commented 4 years ago

Not sure what this accomplished :/

root@Eth2:~/work2/mcl/xbyak/sample # clang++ test_util.cpp -I ../ && ./a.out
64bit
vendor intel
 mmx mmx2 cmov sse sse2 sse3 ssse3 sse41 sse42 popcnt aesni rdtscp osxsave(xgetvb) pclmulqdq avx
popcnt ok
family=6, model=A, stepping=7, extFamily=0, extModel=2
display:family=6, model=2A
cache level=0 data cache size=32768 cores sharing data cache=1
cache level=1 data cache size=262144 cores sharing data cache=1
cache level=2 data cache size=8388608 cores sharing data cache=4
SmtLevel =2
CoreLevel=4
herumi commented 4 years ago
vendor intel
 mmx mmx2 cmov sse sse2 sse3 ssse3 sse41 sse42 popcnt aesni rdtscp osxsave(xgetvb) pclmulqdq avx

Your CPU does not support mulx and adox etc. The old version of dump_code called those mnemonic.

Laggger164 commented 4 years ago
vendor intel
 mmx mmx2 cmov sse sse2 sse3 ssse3 sse41 sse42 popcnt aesni rdtscp osxsave(xgetvb) pclmulqdq avx

Your CPU does not support mulx and adox etc. The old version of dump_code called those mnemonic.

Sooo, I am screwed then?

herumi commented 4 years ago

Your mcl/src/dump_code seems not to be updated. please clean the directory.

Did you try it? Is there any problem?

Laggger164 commented 4 years ago

I think it worked?

root@Eth2:~/work2/mcl # gmake CFLAGS_USER="-DLLONG_MIN=-0x8000000000000000LL" MCL_USE_GMP=0
c++ -c src/asm/x86-64.s -o obj/x86-64.o -g3 -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -Wundef -m64 -I include -I test -fomit-frame-pointer -DNDEBUG -fno-stack-protector -O3 -DLLONG_MIN=-0x8000000000000000LL -DMCL_USE_VINT -DMCL_DONT_USE_OPENSSL -fPIC -DMCL_USE_LLVM=1
c++: warning: argument unused during compilation: '-fomit-frame-pointer' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-D NDEBUG' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-fno-stack-protector' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-D LLONG_MIN=-0x8000000000000000LL' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-D MCL_USE_VINT' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-D MCL_DONT_USE_OPENSSL' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-D MCL_USE_LLVM=1' [-Wunused-command-line-argument]
src/asm/x86-64.s:16652:2: warning: DWARF2 only supports one section per compilation unit
        .section        ".note.GNU-stack","",@progbits
        ^
c++ -c src/asm/x86-64.bmi2.s -o obj/x86-64.bmi2.o -g3 -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -Wundef -m64 -I include -I test -fomit-frame-pointer -DNDEBUG -fno-stack-protector -O3 -DLLONG_MIN=-0x8000000000000000LL -DMCL_USE_VINT -DMCL_DONT_USE_OPENSSL -fPIC -DMCL_USE_LLVM=1
c++: warning: argument unused during compilation: '-fomit-frame-pointer' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-D NDEBUG' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-fno-stack-protector' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-D LLONG_MIN=-0x8000000000000000LL' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-D MCL_USE_VINT' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-D MCL_DONT_USE_OPENSSL' [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-D MCL_USE_LLVM=1' [-Wunused-command-line-argument]
src/asm/x86-64.bmi2.s:14155:2: warning: DWARF2 only supports one section per compilation unit
        .section        ".note.GNU-stack","",@progbits
        ^
c++ -g3 -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -Wundef -m64 -I include -I test -fomit-frame-pointer -DNDEBUG -fno-stack-protector -O3 -DLLONG_MIN=-0x8000000000000000LL -DMCL_USE_VINT-DMCL_DONT_USE_OPENSSL -fPIC -DMCL_USE_LLVM=1 -c src/fp.cpp -o obj/fp.o -MMD -MP -MF obj/fp.d
ar r lib/libmcl.a obj/fp.o obj/x86-64.o obj/x86-64.bmi2.o
ar: warning: creating lib/libmcl.a
c++ -o lib/libmcl.so obj/fp.o obj/x86-64.o obj/x86-64.bmi2.o -shared -lrt   -m64
c++ -g3 -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -Wundef -m64 -I include -I test -fomit-frame-pointer -DNDEBUG -fno-stack-protector -O3 -DLLONG_MIN=-0x8000000000000000LL -DMCL_USE_VINT-DMCL_DONT_USE_OPENSSL -fPIC -DMCL_USE_LLVM=1 -c src/bn_c256.cpp -o obj/bn_c256.o -MMD -MP -MF obj/bn_c256.d
ar r lib/libmclbn256.a obj/bn_c256.o
ar: warning: creating lib/libmclbn256.a
c++ -o lib/libmclbn256.so obj/bn_c256.o -shared -lrt   -m64
c++ -g3 -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -Wundef -m64 -I include -I test -fomit-frame-pointer -DNDEBUG -fno-stack-protector -O3 -DLLONG_MIN=-0x8000000000000000LL -DMCL_USE_VINT-DMCL_DONT_USE_OPENSSL -fPIC -DMCL_USE_LLVM=1 -c src/bn_c384.cpp -o obj/bn_c384.o -MMD -MP -MF obj/bn_c384.d
ar r lib/libmclbn384.a obj/bn_c384.o
ar: warning: creating lib/libmclbn384.a
c++ -o lib/libmclbn384.so obj/bn_c384.o -shared -lrt   -m64
c++ -g3 -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -Wundef -m64 -I include -I test -fomit-frame-pointer -DNDEBUG -fno-stack-protector -O3 -DLLONG_MIN=-0x8000000000000000LL -DMCL_USE_VINT-DMCL_DONT_USE_OPENSSL -fPIC -DMCL_USE_LLVM=1 -c src/bn_c384_256.cpp -o obj/bn_c384_256.o -MMD -MP -MF obj/bn_c384_256.d
ar r lib/libmclbn384_256.a obj/bn_c384_256.o
ar: warning: creating lib/libmclbn384_256.a
c++ -o lib/libmclbn384_256.so obj/bn_c384_256.o -shared -lrt   -m64
c++ -g3 -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -Wundef -m64 -I include -I test -fomit-frame-pointer -DNDEBUG -fno-stack-protector -O3 -DLLONG_MIN=-0x8000000000000000LL -DMCL_USE_VINT-DMCL_DONT_USE_OPENSSL -fPIC -DMCL_USE_LLVM=1 -c src/bn_c512.cpp -o obj/bn_c512.o -MMD -MP -MF obj/bn_c512.d
ar r lib/libmclbn512.a obj/bn_c512.o
ar: warning: creating lib/libmclbn512.a
c++ -o lib/libmclbn512.so obj/bn_c512.o -shared -lrt   -m64
c++ -g3 -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -Wundef -m64 -I include -I test -fomit-frame-pointer -DNDEBUG -fno-stack-protector -O3 -DLLONG_MIN=-0x8000000000000000LL -DMCL_USE_VINT-DMCL_DONT_USE_OPENSSL -fPIC -DMCL_USE_LLVM=1 -c src/she_c256.cpp -o obj/she_c256.o -MMD -MP -MF obj/she_c256.d
ar r lib/libmclshe256.a obj/she_c256.o
ar: warning: creating lib/libmclshe256.a
c++ -o lib/libmclshe256.so obj/she_c256.o lib/libmcl.a -shared -lrt   -m64
c++ -g3 -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -Wundef -m64 -I include -I test -fomit-frame-pointer -DNDEBUG -fno-stack-protector -O3 -DLLONG_MIN=-0x8000000000000000LL -DMCL_USE_VINT-DMCL_DONT_USE_OPENSSL -fPIC -DMCL_USE_LLVM=1 -c src/she_c384.cpp -o obj/she_c384.o -MMD -MP -MF obj/she_c384.d
ar r lib/libmclshe384.a obj/she_c384.o
ar: warning: creating lib/libmclshe384.a
c++ -o lib/libmclshe384.so obj/she_c384.o lib/libmcl.a -shared -lrt   -m64
c++ -g3 -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -Wundef -m64 -I include -I test -fomit-frame-pointer -DNDEBUG -fno-stack-protector -O3 -DLLONG_MIN=-0x8000000000000000LL -DMCL_USE_VINT-DMCL_DONT_USE_OPENSSL -fPIC -DMCL_USE_LLVM=1 -c src/she_c384_256.cpp -o obj/she_c384_256.o -MMD -MP -MF obj/she_c384_256.d
ar r lib/libmclshe384_256.a obj/she_c384_256.o
ar: warning: creating lib/libmclshe384_256.a
c++ -o lib/libmclshe384_256.so obj/she_c384_256.o lib/libmcl.a -shared -lrt   -m64
c++ -g3 -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -Wundef -m64 -I include -I test -fomit-frame-pointer -DNDEBUG -fno-stack-protector -O3 -DLLONG_MIN=-0x8000000000000000LL -DMCL_USE_VINT-DMCL_DONT_USE_OPENSSL -fPIC -DMCL_USE_LLVM=1 -c src/ecdsa_c.cpp -o obj/ecdsa_c.o -MMD -MP -MF obj/ecdsa_c.d
ar r lib/libmclecdsa.a obj/ecdsa_c.o
ar: warning: creating lib/libmclecdsa.a
herumi commented 4 years ago

Not mcl but bls-eth-go-binary.

md work
cd work
git clone https://github.com/herumi/mcl
git clone https://github.com/herumi/bls
git clone https://github.com/herumi/bls-eth-go-binary
cd bls-eth-go-binary
gmake CXX=clang++
go test ./bls

But I don't think that you have enough knowledge to use my library on FreeBSD. I can't ditect that the problem is FreeBSD or your CPU is too old or my code. Can't you ask anyone using FreeBSD?

herumi commented 4 years ago

I think that the least version fixed this problem. https://github.com/herumi/bls-eth-go-binary/issues/31#issuecomment-717058488