cloudius-systems / osv-apps

OSv Applications
135 stars 75 forks source link

Fix sqlite in python3 #64

Closed pshem closed 5 years ago

pshem commented 5 years ago

As discussed in #62.

Changes to python3x/module.py and python3x/GET can be reverted when https://github.com/cloudius-systems/osv/issues/184 is closed, as they will no longer be useful.

wkozaczuk commented 5 years ago

@pshem I am going to merge this pull request. But would you mind to tweak this app to not include some huge static library files (*.a) that make the resulting images 70MB big. Thanks.

wkozaczuk commented 5 years ago

More specifically these 2 are huge and bother me:

du -h /usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/*.a
37M /usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.a
36M /usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m-pic.a
pshem commented 5 years ago

Gj @wkozaczuk ! I didn't realize we could just filter out the static libraries. Should I write a patch to do the same thing with the non-stripped shared objects, or do you think that would break things?

wkozaczuk commented 5 years ago

I have already made a change and pushed a commit.

Waldek

Sent from my iPhone

On Mar 11, 2019, at 15:37, pshem notifications@github.com wrote:

Gj @wkozaczuk ! I didn't realize we could just filter out the static libraries. Should I write a patch to do the same thing with the non-stripped shared objects, or do you think that would break things?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

pshem commented 5 years ago

I just updated the OSv submodule we use and saw my application's compiled image halved. Thank you very much!

wkozaczuk commented 5 years ago

You can remove specific shared libraries if you know they are NOT used by python or its modules or Python libraries you are using. In general shared libraries (*.so) are dynamically loaded typically in the lazy fashion so it is not that easy to verify if they are used or not. For example ldd shows you what shared libraries given native app depends on, but it does NOT tell you which symbols in those libraries and which execution paths would actually be used.

On other hand .a files are static libraries which are ONLY used when statically linking native code in build phase, which does not happen in this case against those .a files any way. Concluding *.a files can be always removed as a rule of thumb from all OSv images as they would NEVER be used by running OSv. I hope it makes it all clear.