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

Unable to build the cross-platform binary #615

Closed
Xjun7S opened this issue Feb 11, 2020 · 4 comments
Closed

Unable to build the cross-platform binary #615

Xjun7S opened this issue Feb 11, 2020 · 4 comments

Comments

@Xjun7S
Copy link

Xjun7S commented Feb 11, 2020

Description

To build the cross platform binary, mainly for windows from Ubuntu

Steps to Reproduce

$ env GOOS=windows GOARCH=386 go build -o main.exe main.go

Your Environment

  1. Go version :- 1.13.7
  2. OpenCV version(ie., gocv: 4.2)
  3. OS : Ubuntu:19.10 x86_64

Error:

gocv.io/x/gocv
/home/denny/go/src/gocv.io/x/gocv/calib3d_string.go:3:9: undefined: CalibFlag
/home/denny/go/src/gocv.io/x/gocv/core_string.go:3:9: undefined: MatType
/home/denny/go/src/gocv.io/x/gocv/core_string.go:57:9: undefined: CompareType
/home/denny/go/src/gocv.io/x/gocv/core_string.go:75:9: undefined: CovarFlags
/home/denny/go/src/gocv.io/x/gocv/core_string.go:93:9: undefined: DftFlags
/home/denny/go/src/gocv.io/x/gocv/core_string.go:113:9: undefined: RotateFlag
/home/denny/go/src/gocv.io/x/gocv/core_string.go:125:9: undefined: KMeansFlags
/home/denny/go/src/gocv.io/x/gocv/core_string.go:137:9: undefined: NormType
/home/denny/go/src/gocv.io/x/gocv/core_string.go:159:9: undefined: TermCriteriaType
/home/denny/go/src/gocv.io/x/gocv/core_string.go:169:9: undefined: SolveDecompositionFlags
/home/denny/go/src/gocv.io/x/gocv/core_string.go:169:9: too many errors

@zhengwang
Copy link

I have same issue when building wasm file.
GOOS=js GOARCH=wasm go build -o main.wasm

gocv.io/x/gocv

gocv.io/x/gocv/calib3d_string.go:3:9: undefined: CalibFlag
gocv.io/x/gocv/core_string.go:3:9: undefined: MatType
gocv.io/x/gocv/core_string.go:57:9: undefined: CompareType
gocv.io/x/gocv/core_string.go:75:9: undefined: CovarFlags
gocv.io/x/gocv/core_string.go:93:9: undefined: DftFlags
gocv.io/x/gocv/core_string.go:113:9: undefined: RotateFlag
gocv.io/x/gocv/core_string.go:125:9: undefined: KMeansFlags
gocv.io/x/gocv/core_string.go:137:9: undefined: NormType
gocv.io/x/gocv/core_string.go:159:9: undefined: TermCriteriaType
gocv.io/x/gocv/core_string.go:169:9: undefined: SolveDecompositionFlags
gocv.io/x/gocv/core_string.go:169:9: too many errors

@kahlil29
Copy link

kahlil29 commented Mar 10, 2020

Just got hit by this when trying to build a binary for an AWS Lambda :
(Working on MacOS Catalina)

env GOOS=linux go build -ldflags="-s -w" -o bin/hello hello/main.go
# gocv.io/x/gocv
/Users/kahlil/go/src/gocv.io/x/gocv/calib3d_string.go:3:9: undefined: CalibFlag
/Users/kahlil/go/src/gocv.io/x/gocv/core_string.go:3:9: undefined: MatType
/Users/kahlil/go/src/gocv.io/x/gocv/core_string.go:57:9: undefined: CompareType
/Users/kahlil/go/src/gocv.io/x/gocv/core_string.go:75:9: undefined: CovarFlags
/Users/kahlil/go/src/gocv.io/x/gocv/core_string.go:93:9: undefined: DftFlags
/Users/kahlil/go/src/gocv.io/x/gocv/core_string.go:113:9: undefined: RotateFlag
/Users/kahlil/go/src/gocv.io/x/gocv/core_string.go:125:9: undefined: KMeansFlags
/Users/kahlil/go/src/gocv.io/x/gocv/core_string.go:137:9: undefined: NormType
/Users/kahlil/go/src/gocv.io/x/gocv/core_string.go:159:9: undefined: TermCriteriaType
/Users/kahlil/go/src/gocv.io/x/gocv/core_string.go:169:9: undefined: SolveDecompositionFlags
/Users/kahlil/go/src/gocv.io/x/gocv/core_string.go:169:9: too many errors

Any idea why this happens or any known fix or workaround for this?

@NicoChenyt
Copy link
Contributor

Duplicate of #381

@deadprogram
Copy link
Member

You cannot currently build cross-platform binaries with GoCV due to that big binary dependency named OpenCV. You need to build the binary using the same OS that you want to target.

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

5 participants