homenc / HElib

HElib is an open-source software library that implements homomorphic encryption. It supports the BGV scheme with bootstrapping and the Approximate Number CKKS scheme. HElib also includes optimizations for efficient homomorphic evaluation, focusing on effective use of ciphertext packing techniques and on the Gentry-Halevi-Smart optimizations.
https://homenc.github.io/HElib
Other
3.14k stars 765 forks source link

Error while interpreting a python wrapper for a simple encryption decryption example using HELib #271

Open Foram16 opened 5 years ago

Foram16 commented 5 years ago

I'am writing a python wrapper for a simple encryption decryption code using ctypes. The wrapper code is throwing an error.

Traceback (most recent call last): File "example_pke.py", line 10, in <module> _pqc=ctypes.CDLL('/home/electrical/Downloads/HElib/src/pke.so') File "/usr/lib/python3.6/ctypes/__init__.py", line 348, in __init__ self._handle = _dlopen(self._name, mode) OSError: /home/electrical/Downloads/HElib/src/pke.so: undefined symbol: _Z16writeContextBaseRSoRK10FHEcontext

I compiled the .cpp as : g++ -g -O2 -std=c++11 -pthread -DFHE_THREADS -DFHE_BOOT_THREADS -fmax-errors=2 -fPIC -shared -o pke.so pke.cpp.

Foram16 commented 5 years ago

Initially the Traceback was:

Traceback (most recent call last): File "example_pke.py", line 10, in <module> _pqc =ctypes.CDLL('/home/electrical/Downloads/HElib/src/pke.so') File "/usr/lib/python3.6/ctypes/__init__.py", line 348, in __init__ self._handle = _dlopen(self._name, mode) OSError: /home/electrical/Downloads/HElib/src/pke.so: undefined symbol: _ZTVN10__cxxabiv120__si_class_type_infoE

Foram16 commented 5 years ago

the error occurs while loading the dynamically linked object.

import ctypes _pqc=ctypes.CDLL('/home/electrical/Downloads/HElib/src/pke.so')

command used to create a shared object : g++ -g -O2 -std=c++11 -pthread -DFHE_THREADS -DFHE_BOOT_THREADS -fmax-errors=2 -fPIC -shared -o pke.so pke.cpp