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

Cross compile error (on mac for linux) #104

Open
matyunin opened this issue Apr 24, 2017 · 1 comment
Open

Cross compile error (on mac for linux) #104

matyunin opened this issue Apr 24, 2017 · 1 comment

Comments

@matyunin
Copy link

When I try to compile sample app natively on macos it's all ok:

$ cd $GOPATH/src/github.com/lazywei/go-opencv/samples
$ go build -o ./hello-mac hellocv.go
$ ls -lh hello-mac 
-rwxr-xr-x  1 user  user   2.3M Apr 24 16:42 hello-mac

But when I try to compile linux binary on my mac I get error:

$ cd $GOPATH/src/github.com/lazywei/go-opencv/samples
$ GOOS=linux GOARCH=amd64  go build -o ./hello-linux hellocv.go
# command-line-arguments
./hellocv.go:24: undefined: opencv.LoadImage
./hellocv.go:30: undefined: opencv.NewWindow
./hellocv.go:44: undefined: opencv.WaitKey

What I doing wrong?

@deadprogram
Copy link

Hi @matyunin the problem here is when using cgo as this package does you still need to compile/link against the target libs for the particular arch & OS. See https://github.com/lazywei/go-opencv/blob/master/opencv/cv.go#L7-L11

If there was a pure Golang implementation of an OpenCV-like library, then you would be able to cross-compile using the normal Golang compilation toolchain. But at least for the foreseeable future, you will need to compile on the target platform.

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

2 participants