Can you compile OpenCV Source (in arm64) on Apple M1?

Raymond Lo, PhD
Dec 17, 2020

Another Simple Answer: YES!

In my last post, I tried to get OpenCV — x86-64 running on Apple M1.

Simple answer: Yes, OpenCV can be compiled in x86-64 with Rosetta.

Here I just compile again natively.

git clone https://github.com/opencv/opencv
cd opencv
mkdir build_arm64
cd build_arm64
cmake ../
make -j 9

Again, a little while later. It is compiled successfully.

Ok, basically nothing to see here. It all works as expected. In conclusion, I could switch between two architectures without thinking much about it. If you are linking applications using dynamic linking, then it will be a management nightmare. Good luck here!

--

--

Raymond Lo, PhD

@Intel - OpenVINO AI Software Evangelist. ex-Google, ex-Samsung, and ex-Meta (Augmented Reality) executive. Ph.D. in Computer Engineer — U of T.