herumi / mcl

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

Getting segment fault on intel MacOS. #174

Closed RoastedGoose closed 1 year ago

RoastedGoose commented 1 year ago

Getting segment fault on intel MacOS. After “sudo make install” and simply called “initPairing()”, it caught exception “exc bad accss code exc I386 gpflt.” when running “mulUnitN()”. While the original build test works fine.

herumi commented 1 year ago

What is the CPU? What are the compiler options to build?

RoastedGoose commented 1 year ago

x86-64 intel i5 with clang++. Just follow the build method below: For x86-64 Linux and macOS. mkdir build cd build cmake .. make Then “sudo make install”. Create a new cpp file and include <mcl/bls12_381>, and link mcl and gmp libraries when compiling.

herumi commented 1 year ago

Okay, I verified the problem. It reproduces on only Intel Mac with CMake. There is no problem on the other intel Linux, M1 Mac and intel Mac with Makefile. I'll investigate the reason, but could you please use libmcl.a built by make for a while?

RoastedGoose commented 1 year ago

make works, thanks!

xfap commented 2 months ago

Hello, is this(cmake) fixed? I got the problem again on my mac intel.

herumi commented 2 months ago

Please show me what kind of code you build and how you build it.

The following commands go well.

mkdir build
cd build
cmake .. -DMCL_BUILD_TESTING=ON -DMCL_BUILD_SAMPLE=ON
make -j
bin/bls12_test
...
clang -v
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: x86_64-apple-darwin23.4.0
uname -a
% uname -a
Darwin macpro.local 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:11:05 PDT 2024; root:xnu-10063.101.17~1/RELEASE_X86_64 x86_64