Skip to content

Remove debug symbols from embedded libssh build in wheels #43

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

Closed
enkore opened this issue Jan 14, 2022 · 3 comments · Fixed by #44
Closed

Remove debug symbols from embedded libssh build in wheels #43

enkore opened this issue Jan 14, 2022 · 3 comments · Fixed by #44

Comments

@enkore
Copy link
Member

enkore commented Jan 14, 2022

Currently there is one native extension for each libssh module (give or take), however due to how Cython tends to work out each native extension is relatively large. Currently wheels have around ~5-6 MB in native extensions. We could combine all the native extensions into a single, much smaller extension and then just have small Python modules for exporting the same API structure as before instead. This would make the wheels and installed size smaller and reduce the memory footprint as well.

If you're open to the idea I can spin a patch for this.

@pkittenis
Copy link
Member

Thanks for the interest.

If we can keep the .pyx files separate and still bundle them all into one extension then yes, I'm in favour of doing this.

@enkore
Copy link
Member Author

enkore commented Jan 17, 2022

Cython in principle supports compiling multiple pyx files into one extension, but I didn't find a way to cimport things between them when doing so

However, I noticed that the Linux wheels are shipping with full debug symbols in all libraries which is rather unnecessary ime. Removing those and the cythonized source from the wheels already reduces size by a lot. Another thing that could be done is to reduce the OpenSSL build size, right now we're doing a default libcrypto build which includes a lot of stuff that libssh doesn't use. That's a bit more fiddly though, and likely has less impact.

@pkittenis
Copy link
Member

Cython in principle supports compiling multiple pyx files into one extension, but I didn't find a way to cimport things between them when doing so

Yes, same when I was first writing this. I couldn't find a good way to keep the .pyx separate and generate one .so.

Stripping debug symbols would be good. If you mean package_data, those can't be excluded. They're compiled dependencies and Cython header files (.pxd), not full sources.

@pkittenis pkittenis changed the title Bundle native extensions into one? Remove debug symbols from libssh build Feb 3, 2022
@pkittenis pkittenis changed the title Remove debug symbols from libssh build Remove debug symbols from embedded libssh build Feb 3, 2022
@pkittenis pkittenis changed the title Remove debug symbols from embedded libssh build Remove debug symbols from embedded libssh build in wheels Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants