gocv icon indicating copy to clipboard operation
gocv copied to clipboard

running failed on MacOS ARM64

Open zcharym opened this issue 2 years ago • 6 comments

Description

I installed the necessary packages: OpenCV and pkgconfig with homebrew and followed with the guide on gocv, get results below:

# gocv.io/x/gocv
ld: warning: ld: warning: ignoring file /opt/homebrew/opt/opencv/lib/libopencv_aruco.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64ignoring file /opt/homebrew/opt/opencv/lib/libopencv_barcode.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64

Steps to Reproduce

Your Environment

  • Operating System and version: MacBook Pro (13-inch, M1, 2020)
  • OpenCV version used: OpenCV: stable 4.5.4 (bottled)
  • How did you install OpenCV? by homebrew
  • GoCV version used: latest
  • Go version: go 1.15
  • Did you run the env.sh or env.cmd script before trying to go run or go build? no

seems like CMake building step is using default x86_64 building strategy, maybe could pass by adding some args: cmake -DCMAKE_SYSTEM_PROCESSOR=arm64 -DCMAKE_OSX_ARCHITECTURES=arm64 ..

is there a correct way to fix this? and can it be done with user friendly method like using provided customenv , thanks?

zcharym avatar Dec 09 '21 06:12 zcharym

Same, cannot run on M1

adriantabirta avatar Mar 18 '22 16:03 adriantabirta

I also encountered this problem, may I ask how to solve it

feipengheart avatar May 08 '22 10:05 feipengheart

Same problem here.

EmiiFont avatar May 31 '22 17:05 EmiiFont

Same problem Still on Ventura 13.1 .

zkcrescent avatar Aug 01 '23 03:08 zkcrescent

I resloved this problem. you should check your go bin is built with arm64 ,check your go bin by run file /usr/local/go/bin/go and it should be Mach-O 64-bit executable arm64, if this cmd prints Mach-O 64-bit executable x86_64 you should reintall go with Apple Arm64

zkcrescent avatar Aug 01 '23 07:08 zkcrescent

Same, cannot run on M2pro

xpfo-go avatar Dec 11 '23 09:12 xpfo-go