Closed e-desouza closed 3 years ago
I'll not support the architecture. Which is the bit of the CPU 32 or 64? Could you try the following command?
make MCL_USE_GMP=0 MCL_USE_LLVM=0 bin/bn_test.exe
Or, according to https://github.com/herumi/mcl/#how-to-make-asm-files-optional .
make MCL_USE_GMP=0 BIT=<32 or 64> ARCH=$(arch) LLVM_VER=<llvm-version> UPDATE_ASM=1 bin/bn_test.exe
It's 64bit, big-endian architecture. Is there anyway to skip the requirement for the .s files (even if the code might be sub-optimal) ?
I'm sure there's some CMakeLists.txt fixes needed too because right now even though arch=s390x
, it still seems to think this is x86.
$ make MCL_USE_LLVM=1 LLVM_VER=10.0.0 UPDATE_ASM=1
[ 7%] Building CXX object CMakeFiles/mcl.dir/src/fp.cpp.o
[ 14%] Building ASM object CMakeFiles/mcl.dir/src/asm/x86-64.s.o
/home/admin1/blockdaemon/mcl/src/asm/x86-64.s: Assembler messages:
/home/admin1/blockdaemon/mcl/src/asm/x86-64.s:8: Error: Unrecognized opcode: `movq'
/home/admin1/blockdaemon/mcl/src/asm/x86-64.s:9: Error: Unrecognized opcode: `movq'
As I wrote in https://github.com/herumi/mcl/issues/118#issuecomment-820838373, please specify ARCH
.
If you have opt-10
then set LLVM_VER=-10
.
make MCL_USE_GMP=0 BIT=64 ARCH=$(arch) LLVM_VER=-10 UPDATE_ASM=1 bin/bn_test.exe
It complains about
g++: fatal error: no input files
compilation terminated.
make: *** [Makefile:213: obj/.o] Error 1
since there's no source file after the g++ -c
below. The cmake recipe needs some fixes to remedy this.
$ make MCL_USE_GMP=0 BIT=64 ARCH=s390x LLVM_VER=-10 UPDATE_ASM=1 bin/bn_test.exe
g++ -c -o obj/.o -g3 -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -Wundef -I include -I test -fomit-frame-pointer -DNDEBUG -fno-stack-protector -O3 -DMCL_USE_VINT -DMCL_DONT_USE_OPENSSL -fPIC -DMCL_USE_LLVM=1
If I set aarch64, it does continue but of course it later complains about the .s file opcodes.
$ make MCL_USE_GMP=0 BIT=64 ARCH=aarch64 LLVM_VER=-10 UPDATE_ASM=1 bin/bn_test.exe
g++ -c src/asm/aarch64.s -o obj/aarch64.o -g3 -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -Wundef -I include -I test -fomit-frame-pointer -DNDEBUG -fno-stack-protector -O3 -DMCL_USE_VINT -DMCL_DONT_USE_OPENSSL -fPIC -DMCL_USE_LLVM=1
src/asm/aarch64.s: Assembler messages:
src/asm/aarch64.s:8: Error: Unrecognized opcode: `mov'
src/asm/aarch64.s:9: Error: Unrecognized opcode: `mov'
src/asm/aarch64.s:10: Error: Unrecognized opcode: `mov'
src/asm/aarch64.s:11: Error: Unrecognized opcode: `ret'
...
The issue is reproducible if you set arch to something random too (e.g noarch1).
I'm sorry that I missed.
Could you try to set CPU=systemz
instead of ARCH
?
Does your system have opt
or opt-10
?
If opt
then you don't have to specify LLVM_VER
.
@e-desouza , Have you solved the problem by https://github.com/herumi/mcl/issues/118#issuecomment-820900536 ?
Thanks for your help so far! It did make more progress but failed later in the compile step (I do have opt v10.0.0)
make MCL_USE_GMP=0 BIT=64 CPU=systemz UPDATE_ASM=1 bin/bn_test.exe
g++ obj/bn_test.o -o bin/bn_test.exe lib/libmcl.a -lrt
/usr/bin/ld: lib/libmcl.a(fp.o): in function `void mcl::fp::Mul2<7ul, true>(unsigned int*, unsigned int const*, unsigned int const*)':
/home/admin1/mcl/src/fp.cpp:269: undefined reference to `mcl_fp_add7L'
/usr/bin/ld: lib/libmcl.a(fp.o): in function `void mcl::fp::Mul2<7ul, false>(unsigned int*, unsigned int const*, unsigned int const*)':
/home/admin1/mcl/src/fp.cpp:269: undefined reference to `mcl_fp_addNF7L'
/usr/bin/ld: lib/libmcl.a(fp.o): in function `mcl::fp::SqrMont<7ul, true, mcl::fp::Ltag>::func(unsigned int*, unsigned int const*, unsigned int const*)':
/home/admin1/mcl/src/low_func.hpp:649: undefined reference to `mcl_fp_mont7L'
How about this?
make MCL_USE_GMP=0 BIT=64 CPU=systemz UPDATE_ASM=1 MCL_SIZEOF_UNIT=8
And I have some questions.
What shows the following command?
uname -s
uname -m
gcc t.c && ./a.out
t.c
#include <stdio.h>
#include <memory.h>
#include <stdint.h>
int main()
{
uint32_t x;
char buf[] = "abcd";
memcpy(&x, buf, 4);
printf("x=%08x\n", x);
}
make MCL_USE_GMP=0 BIT=64 CPU=systemz UPDATE_ASM=1 MCL_SIZEOF_UNIT=8
Similar failure:
make MCL_USE_GMP=0 BIT=64 CPU=systemz UPDATE_ASM=1 bin/bn_test.exe
g++ obj/bn_test.o -o bin/bn_test.exe lib/libmcl.a -lrt
/usr/bin/ld: lib/libmcl.a(fp.o): in function `void mcl::fp::Mul2<7ul, true>(unsigned int*, unsigned int const*, unsigned int const*)':
/home/admin1/mcl/src/fp.cpp:269: undefined reference to `mcl_fp_add7L'
uname -s, uname -m
Linux, s390x
gcc t.c && ./a.out
x=61626364
We do have free access to Linux on s390x at https://linuxone.cloud.marist.edu/#/register?flag=VM if you're interested in experimenting on your own. Of course, I'll continue to help but I just thought I'd throw this option out there 🙂 We also have Travis CI/CD support used for a bunch of OSS projects.
Thank you for the information about LinuxOne. I've fixed the dependency of mcl to little-endian. The latest version supports s390x.
make UPDATE_ASM=1
make bin/bn_test.exe && bin/bn_test.exe
The changes look non-trivial and I saw a lot of code refactored to support this - Thank You @herumi ! The main motivation for this was around the Prysm project for s390x and now I can continue on that.
The calculation part did not need to be modified, but the serialization part was wrong. I'll also update bls and bls-eth-go-binary.
Opening this to track the port to s390x which is needed in the code to generate s390x set of asm in src/asm.