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

Including opencv native libraries as resources in enso runner binary #11807

Merged
merged 3 commits into from
Dec 10, 2024

Conversation

JaroslavTulach
Copy link
Member

@JaroslavTulach JaroslavTulach commented Dec 9, 2024

Pull Request Description

test/Image_Tests can now be executed in native image mode of enso runner. All that's needed is to include (the right) native_libraries present in opencv-4.7.0-0.jar as resources in the native image binary. This is another step in the #10121 quest.

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • All code follows the
    Scala,
    TypeScript,
    Rust
    style guides.
  • Unit tests have been written where possible.

@JaroslavTulach JaroslavTulach self-assigned this Dec 9, 2024
@JaroslavTulach JaroslavTulach added the CI: No changelog needed Do not require a changelog entry for this PR. label Dec 9, 2024
@JaroslavTulach
Copy link
Member Author

These are the libraries we care about when it comes to packaging Standard.Image for native image executable:

enso.$ unzip -l built-distribution/enso-engine-*/enso-*/lib/Standard/Image/0.0.0-dev/polyglot/java/opencv-4.7.0-0.jar | grep -v class$  | cut -c31- | grep -v /$ | grep ^nu | grep -v README
nu/pattern/opencv/linux/ARMv7/libopencv_java470.so
nu/pattern/opencv/linux/ARMv8/libopencv_java470.so
nu/pattern/opencv/linux/x86_64/libopencv_java470.so
nu/pattern/opencv/osx/ARMv8/libopencv_java470.dylib
nu/pattern/opencv/osx/x86_64/libopencv_java470.dylib
nu/pattern/opencv/windows/x86_32/opencv_java470.dll
nu/pattern/opencv/windows/x86_64/opencv_java470.dll

when we select just the binary for the right platform (like 3b826f0 does), we go down from 441MB to 265MB on Linux.

@hubertp
Copy link
Collaborator

hubertp commented Dec 9, 2024

Doesn't this render enso a bit useless? >400MB for an exec seems like a lot. If we really want to go this way then we really need to prioritize #11483. Maybe this should be done the other way around?

@JaroslavTulach
Copy link
Member Author

Doesn't this render enso a bit useless? >400MB for an exec seems like a lot.

There has been some progress already:

when we select just the binary for the right platform (like 3b826f0 does), we go down from 441MB to 265MB on Linux.

It is hard to go lower (with the resource based approach) when the libopencv.so has 65MB and Enso itself has ~200MB.

If we really want to go this way then we really need to prioritize #11483. Maybe this should be done the other way around?

On Friday @jdunkerley sounded like wanting the quickest solution without waiting for any classloading changes, build system changes, etc. that are associated with #11483.

@jdunkerley
Copy link
Member

On Friday @jdunkerley sounded like wanting the quickest solution without waiting for any classloading changes, build system changes, etc. that are associated with #11483.

Happy for us to build the better approach for this if not hideous to do so.

@JaroslavTulach JaroslavTulach merged commit e879a27 into develop Dec 10, 2024
42 checks passed
@JaroslavTulach JaroslavTulach deleted the wip/jtulach/NativeImageTests branch December 10, 2024 05:21
jdunkerley pushed a commit that referenced this pull request Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants