herumi / mcl

a portable and fast pairing-based cryptography library
BSD 3-Clause "New" or "Revised" License
450 stars 152 forks source link

Building on M1 Mac error #125

Closed jamesrowe08 closed 2 years ago

jamesrowe08 commented 2 years ago

On a mac with m1 apple silicone. Trying to make mcl:

Makefile:219: warning: overriding commands for target src/base64.ll' Makefile:216: warning: ignoring old commands for targetsrc/base64.ll' c++ -o lib/libmclbn256.dylib obj/bn_c256.o -shared Undefined symbols for architecture arm64: "mcl::fp::expand_message_xmd(unsigned char, unsigned long, void const, unsigned long, void const, unsigned long)", referenced from: mcl::MapTo_WB19<mcl::FpT<mcl::bn::local::FpTag, 256ul>, mcl::EcT<mcl::FpT<mcl::bn::local::FpTag, 256ul> >, mcl::Fp2T<mcl::FpT<mcl::bn::local::FpTag, 256ul> >, mcl::EcT<mcl::Fp2T<mcl::FpT<mcl::bn::local::FpTag, 256ul> > > >::msgToG1(mcl::EcT<mcl::FpT<mcl::bn::local::FpTag, 256ul> >&, void const, unsigned long, char const, unsigned long) const in bn_c256.o mcl::MapTo_WB19<mcl::FpT<mcl::bn::local::FpTag, 256ul>, mcl::EcT<mcl::FpT<mcl::bn::local::FpTag, 256ul> >, mcl::Fp2T<mcl::FpT<mcl::bn::local::FpTag, 256ul> >, mcl::EcT<mcl::Fp2T<mcl::FpT<mcl::bn::local::FpTag, 256ul> > > >::hashToFp2(mcl::Fp2T<mcl::FpT<mcl::bn::local::FpTag, 256ul> >, void const, unsigned long, void const, unsigned long) const in bn_c256.o "mcl::fp::Op::init(mcl::VintT<mcl::vint::Buffer > const&, unsigned long, int, mcl::fp::Mode, unsigned long)", referenced from: mcl::FpT<mcl::bn::local::FpTag, 256ul>::init(bool, int, mcl::VintT<mcl::vint::Buffer > const&, mcl::fp::Mode) in bn_c256.o mcl::FpT<mcl::bn::local::FrTag, 256ul>::init(bool, int, mcl::VintT<mcl::vint::Buffer > const&, mcl::fp::Mode) in bn_c256.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [lib/libmclbn256.dylib] Error 1

herumi commented 2 years ago

What commands did you type? Could you try make clean?

On my M1 mac,

make test -j4

goes well.

clang -v
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: arm64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
jamesrowe08 commented 2 years ago

That works. I was trying make -j4 which was failing.

herumi commented 2 years ago

I was trying make -j4 which was failing.

Thank you for the information. I've fixed it. https://github.com/herumi/mcl/commit/36a3013cae4df452601bbeb5f78afc5c8748f715

jamesrowe08 commented 2 years ago

Awesome, thanks @herumi !