Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locally built wolfSSL uses local WolfSSL .so instead of bundling WolfSSL #40

Open
laurenzfg opened this issue Apr 12, 2023 · 3 comments
Assignees

Comments

@laurenzfg
Copy link

Hey there!

I want to use wolfssl-py with RSA key exchange. Hence, I built wolfssl with the needed flags (and successfully made use of the combiled .so using a C program).

Unfortunately, building wolfssl-py does not work out as expected.
After running USE_LOCAL_WOLFSSL=/usr/local pip3 install ~/Desktop/wolfssl-py/ a package is installed.

But executing my program fails with

Traceback (most recent call last):
[...]
  File "/home/lgrote/Documents/app/venv/lib64/python3.11/site-packages/wolfssl/__init__.py", line 144, in __init__
    _lib.wolfSSL_Init()
    ^^^^
NameError: name '_lib' is not defined
Exception ignored in: <function SSLContext.__del__ at 0x7fafdad49580>
Traceback (most recent call last):
  File "/home/lgrote/Documents/app/venv/lib64/python3.11/site-packages/wolfssl/__init__.py", line 167, in __del__
    if getattr(self, 'native_object', _ffi.NULL) != _ffi.NULL:
                                      ^^^^
NameError: name '_ffi' is not defined

Process finished with exit code 1

Indeed, the generated folder in site-packages does not contain _ffi.py.

Any help here would be appreciated. Please let me know if you need any additional information.

@embhorn embhorn self-assigned this Apr 12, 2023
@embhorn
Copy link
Member

embhorn commented Apr 12, 2023

Hi @laurenzfg

Please see the prerequisites for wolfssl-py:
https://github.com/wolfSSL/wolfssl-py#compiling

This is usually accomplished by running the setup.py script:
https://github.com/wolfSSL/wolfssl-py/blob/master/setup.py

If you don't want to use the script, try:
pip install cffi

Thanks,
@embhorn - wolfSSL Support

@laurenzfg laurenzfg changed the title Unable to build wolfssl-py using local wolfssl Locally built wolfSSL uses local WolfSSL .so instead of bundling WolfSSL Apr 13, 2023
@laurenzfg
Copy link
Author

laurenzfg commented Apr 13, 2023

Hey @embhorn,

I really appreciate you getting back to me so fast. Unfortunately, your tips did not help as I had cffi installed already.

I further iterated on the issues and found out that, if ./configure is NOT supplied with --disable-shared and henceforth a .so is installed to \usr\local\lib, wolfssl-py builds and runs just fine using the shared library at runtime. However, the wheel is not self contained as it relies on the shared lib to be present.

I want to build a wheel containing both wolfssl-py and the compiled wolfssl lib. Such a wheel is NOT built if I compile & install wolfssl with ./configure --disable-shared and then run USE_LOCAL_WOLFSSL=1 python3 setup.py bdist_wheel.

For these purposes, I'd love to use the dist target of your Makefile. However, the make folder is not checked into the repo. Is this on purpose?

@embhorn embhorn assigned cconlon and unassigned embhorn Apr 13, 2023
@embhorn
Copy link
Member

embhorn commented Apr 14, 2023

Hi @laurenzfg

I've requested a review of this issue by my colleague, @cconlon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants