libff icon indicating copy to clipboard operation
libff copied to clipboard

Issue with compiling ate-pairing dependency

Open AHaliq opened this issue 3 years ago • 4 comments

My machine:

ProductName:	Mac OS X
ProductVersion:	10.14.6
BuildVersion:	18G9027

I'm compiling libff with emscripten targetting webassembly and I'm getting the following error upon running make

zm2.cpp:3644:22: fatal error: use of undeclared identifier 'Xbyak'
                static std::vector<Xbyak::uint8> buf;

Inspecting zm2.cpp, we can see this only happens if MIE_USE_X64ASM is set to false

you can view my full project here to reproduce the issue: https://github.com/AHaliq/WebAssemblyReact emscripten call starts at scripts/cryptoutils.sh line 49 cryptoutils adds libff at deps/cryptoutils/src/CMakeLists.txt line 14

AHaliq avatar Jul 21 '21 23:07 AHaliq

I've made some progress investigating this issue,

in zm2.cpp line 8, Xbyak is only included if MIE_USE_X64ASM is set in zm.h line 68, MIE_USE_X64ASM is unset when __x86_64__ is unset

In emscripten's faq site it says

Emscripten automatically unsets the following #define values, as these are commonly set in projects to enable platform dependent code (inline assembly): #undef __i386__ #undef __x86_64__

in zm.h since there is a case for without __x86_64__ does that mean there is an alternative ways to build the project or is that case unhandled and cannot build the project?

AHaliq avatar Aug 10 '21 03:08 AHaliq

I'm having the same problem. My machine:

macOS Monterey -- version 12.1 (21C52)
Apple M1 Max

@AHaliq Have you managed to figure out a solution to this? Are you using an Apple Silicon machine?

malturki avatar Feb 01 '22 02:02 malturki

@malturki libff uses ate-pairing and xbyak which contains inline assembly thus cant be compiled by emscripten. You should look for alternatives or fork this project and use other dependencies such as mcl

I havent tried it myself. The project i was working on has been handed over to someone else.

AHaliq avatar Feb 01 '22 03:02 AHaliq

Thanks @AHaliq for the prompt response. I will probably look into alternatives.

It would have been helpful to have a list of supported (or unsupported) architectures given up front in the README.

malturki avatar Feb 01 '22 03:02 malturki