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

Packaging apps using gocv on macOS #87

Open
vvarp opened this issue Feb 18, 2018 · 3 comments
Open

Packaging apps using gocv on macOS #87

vvarp opened this issue Feb 18, 2018 · 3 comments

Comments

@vvarp
Copy link

vvarp commented Feb 18, 2018

My use case is fairly simple - I need OpenCV to analyze image file and return true/false result, nothing too fancy, really a single call to function from imgproc module.

Creating Windows dist package was easy: take a go generated binary, pack it up with OpenCV DLLs, and call it a day.

However, doing same thing on macOS seems to be almost impossible task, but to be fair, I might be missing few tricks here and there.

In order to get the go binary to run, I need to pull in half of my /opt/local/lib folder into the dist package, only to have it running on the latest macOS version (if built on 10.13, it only runs on 10.12/10.13). Attempting to run on 10.10 throws an error about missing CoreImage - quite understandably, as this is system framework available starting with 10.11.

Mentioning /opt/local/lib means that I used OpenCV package from MacPorts (it uses ffmpeg compiled on the spot, meaning it links to other libraries from MacPorts universe), but from what I've noticed, OpenCV distributed via Homebrew has exact same problem.

Does anyone here have some practical take on this?

I know that opencv-python team managed to solve distribution problem somehow, and on PyPi you can get wheel package with staticallly linked dependencies that work on every macOS version since 10.6. I haven't really analyzed that yet, but I guess taking some hints from there would be the best way forward!

@deadprogram
Copy link
Member

Hello @vvarp so far the guidelines that appears to apply are related to this issue on the go-sdl project: veandco/go-sdl2#234

Basically, we need to dig in to the dependencies and figure out the same things for OpenCV/GoCV.

@willdurand
Copy link
Contributor

willdurand commented Mar 1, 2018

Why can't we statically compile by the way? Is it because of the way CGO works? That means we always need opencv installed along with the Go binary, is that correct?

@denismakogon
Copy link
Contributor

@willdurand it seems like so, i do some work to make gocv-based application running on relatively small docker images (https://github.com/denismakogon/gocv-alpine), so the images size is close to 150-170Mb.

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

No branches or pull requests

4 participants