The linked framework 'opencv2.framework' is missing one or more architectures required by this target: arm64

Hi, I am able to compile OpenCV by following below instructions,

  1. Prepare CMake. (e.g. brew install cmake)
  2. Download opencv-4.2.0.zip from https://github.com/opencv/opencv/archive/4.2.0.zip.
  3. Prepare a working directory. (e.g. mkdir ~/foo)
  4. Unpack the file into the working directory.
  5. Open terminal at the working directory. (e.g. cd ~/foo)
  6. Run a build script by python 2. python opencv-4.2.0/platforms/osx/build_framework.py osx
  7. Copy osx/opencv2.framework into OpenCVSample_macOS directory.

It’s working great in my macOS project. But I have to archive the build for distribution. When I am going to archive I am getting the error,

The linked framework ‘opencv2.framework’ is missing one or more architectures required by this target: arm64.

Luckily I found a git repo for building OpenCV for osx. But I don’t have any idea to build the OpenCV for macOS along with M1 Chip support. Can you please anyone help me to solve this problem?

I asked question in Stack Overflow too: https://stackoverflow.com/questions/70541655/opencv-the-linked-framework-opencv2-framework-is-missing-one-or-more-architec

Thank you very much for your help.