herumi / mcl

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

Getting `undefined reference to mcl::fp::expand_message_xmd` when using C interface #140

Closed mxaddict closed 2 years ago

mxaddict commented 2 years ago

I'm seeing undefined reference to mcl::fp::expand_message_xmd on ld step of make build, even when using C interface, does this mean the C interface requires that I use fp.hpp ?

The exact error on ld step is :

/usr/bin/ld: bls/lib/libbls384_256.a(bls_c384_256.o): in function `mcl::MapTo_WB19<mcl::FpT<mcl::bn::local::FpTag, 384ul>, mcl::EcT<mcl::FpT<mcl::bn::local::FpTag, 384ul> >, mcl::Fp2T<mcl::FpT<mcl::bn::local::FpTag, 384ul> >, mcl::EcT<mcl::Fp2T<mcl::FpT<mcl::bn::local::FpTag, 384ul> > > >::hashToFp2(mcl::Fp2T<mcl::FpT<mcl::bn::local::FpTag, 384ul> >*, void const*, unsigned long, void const*, unsigned long) const':
/home/mxaddict/Projects/mxaddict/navcoin/src/bls/mcl/include/mcl/mapto_wb19.hpp:530: undefined reference to `mcl::fp::expand_message_xmd(unsigned char*, unsigned long, void const*, unsigned long, void const*, unsigned long)'

Code is as follows:

#include <mcl/bn_c384_256.h>
#include <bls/bls.h>

blsInit(5, MCLBN_COMPILED_TIME_VAR);

mclBnG1 g1;
mclBnG1_getBasePoint(&g1);

std::vector<unsigned char> ba(48);
int baLen = mclBnG1_serialize(&ba[0], 48, &g1);

assert(baLen == 48);

std::cout << "G1 basepoint: " << HexStr(ba);