gocv
gocv copied to clipboard
running failed on MacOS ARM64
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
orenv.cmd
script before trying togo run
orgo 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?
Same, cannot run on M1
I also encountered this problem, may I ask how to solve it
Same problem here.
Same problem Still on Ventura 13.1 .
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
Same, cannot run on M2pro