gdanezis / petlib

A python library that implements a number of Privacy Enhancing Technolgies
BSD 2-Clause "Simplified" License
130 stars 33 forks source link

AttributeError: 'NoneType' object has no attribute 'EC_GROUP_new_by_curve_name' #11

Closed seblau closed 7 years ago

seblau commented 7 years ago

He,

just installed petlib and now trying to create a new EcGroup instance the following exception occurs. Any recommendations to make it work?

Python 2.7.10 (default, Oct 23 2015, 19:19:21) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import petlib
>>> from petlib.ec import EcGroup
Support not loading the library to build docs without compiling.
>>> G = EcGroup()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/sebastian/Developer/.envs/pet/lib/python2.7/site-packages/petlib/ec.py", line 62, in __init__
    self.ecg = _C.EC_GROUP_new_by_curve_name(nid)
AttributeError: 'NoneType' object has no attribute 'EC_GROUP_new_by_curve_name'
gdanezis commented 7 years ago

Hello -- given the error I suspect that the C library binding petlib to openssl did not build correctly. To be honest OSX is not a platform I have tested the build against. However, my students do use petlib with OSX homebrew so I will ask them to write a proper installation recipe.

seblau commented 7 years ago

Ok, that sounds legit. I had to use some global flags for the compiler in order to find the openssl headers on OSX.

pip install --global-option=build_ext --global-option="-I/usr/local/opt/openssl/include" petlib

I also tried to use homebrew openssl, but without success. An installation recipe for OSX would be great!

Regards, Sebastian

gdanezis commented 7 years ago

I now received a contribution from Panos Louridas, patching building for OSX. Would you like to try again installing petlib from the repository?

seblau commented 7 years ago

Works for me now! OSX 10.11.6

gdanezis commented 7 years ago

Awesome!