Repository: opencv
Issue: Build issues on M1 mac
Labels: category: build/install,platform: ios/osx,incomplete

##### System information (version)
- OpenCV => master and 5x latest
- Operating System / Platform => Macos 12.3.1
- Compiler => XCode 13.3.1, Python 3.8.9


##### Detailed description
Nor the master, nor the 5.x does not compile on my macbook pro. Everything is default, followed the documentation and fails.


##### Steps to reproduce
git clone master or v5.x

python3 platforms/ios/build_framework.py ios


##### Issue
```
CompileC ../opencv/ios/build/build-arm64-iphoneos/3rdparty/libwebp/OpenCV.build/Release-iphoneos/libwebp.build/Objects-normal/arm64/filters_msa.o ../opencv/3rdparty/libwebp/src/dsp/filters_msa.c normal arm64 c com.apple.compilers.llvm.clang.1_0.compiler (in target 'libwebp' from project 'OpenCV')
    cd ../opencv
    export LANG\=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -target arm64-apple-ios9.0 -fmessage-length\=272 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -fcolor-diagnostics -Wno-trigraphs -fpascal-strings -O3 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -DCMAKE_INTDIR\=\"Release-iphoneos\" -DWEBP_USE_THREAD -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk -fstrict-aliasing -Wdeprecated-declarations -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-semicolon-before-method-body -fembed-bitcode -I../opencv/ios/build/build-arm64-iphoneos/3rdparty/lib/Release/include -I../opencv/3rdparty/libwebp -I../opencv/ios/build/build-arm64-iphoneos -I../opencv/ios/build/build-arm64-iphoneos/3rdparty/libwebp/OpenCV.build/Release-iphoneos/libwebp.build/DerivedSources-normal/arm64 -I../opencv/ios/build/build-arm64-iphoneos/3rdparty/libwebp/OpenCV.build/Release-iphoneos/libwebp.build/DerivedSources/arm64 -I../opencv/ios/build/build-arm64-iphoneos/3rdparty/libwebp/OpenCV.build/Release-iphoneos/libwebp.build/DerivedSources -F../opencv/ios/build/build-arm64-iphoneos/3rdparty/lib/Release -fembed-bitcode -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wsign-promo -Wuninitialized -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Qunused-arguments -Wno-semicolon-before-method-body -fvisibility\=hidden -fvisibility-inlines-hidden -std\=c99 -Wno-unused-variable -Wno-unused-function -Wno-shadow -Wno-missing-prototypes -Wno-missing-declarations -Wno-implicit-fallthrough -DNDEBUG -DNDEBUG -fPIC -MMD -MT dependencies -MF ../opencv/ios/build/build-arm64-iphoneos/3rdparty/libwebp/OpenCV.build/Release-iphoneos/libwebp.build/Objects-normal/arm64/filters_msa.d --serialize-diagnostics ../opencv/ios/build/build-arm64-iphoneos/3rdparty/libwebp/OpenCV.build/Release-iphoneos/libwebp.build/Objects-normal/arm64/filters_msa.dia -c ../opencv/3rdparty/libwebp/src/dsp/filters_msa.c -o ../opencv/ios/build/build-arm64-iphoneos/3rdparty/libwebp/OpenCV.build/Release-iphoneos/libwebp.build/Objects-normal/arm64/filters_msa.o
../opencv/ios/build/build-arm64-iphoneos/3rdparty/libwebp/OpenCV.build/Release-iphoneos/libwebp.build/Objects-normal/arm64/filters_msa.dia:1:1: warning: Could not read serialized diagnostics file: error("Failed to open diagnostics file") (in target 'libwebp' from project 'OpenCV')

** BUILD FAILED **


The following build commands failed:
	PhaseScriptExecution Generate\ CMakeFiles/dephelper/gen_opencv_objc_source_ios ../opencv/ios/build/build-arm64-iphoneos/modules/objc_bindings_generator/OpenCV.build/Release-iphoneos/gen_opencv_objc_source_ios.build/Script-4F6679422619F9EE43BD91E5.sh (in target 'gen_opencv_objc_source_ios' from project 'OpenCV')
(1 failure)
============================================================
ERROR: Command '['xcodebuild', 'BITCODE_GENERATION_MODE=bitcode', 'IPHONEOS_DEPLOYMENT_TARGET=9.0', 'ARCHS=arm64', '-sdk', 'iphoneos', '-configuration', 'Release', '-parallelizeTargets', '-jobs', '10', '-target', 'ALL_BUILD', 'build']' returned non-zero exit status 65.
============================================================
Traceback (most recent call last):
  File "platforms/ios/build_framework.py", line 181, in build
    self._build(outdir)
  File "platforms/ios/build_framework.py", line 139, in _build
    self.buildOne(target[0], target[1], main_build_dir, cmake_flags)
  File "platforms/ios/build_framework.py", line 318, in buildOne
    execute(buildcmd + ["-target", "ALL_BUILD", "build"], cwd = builddir)
  File "../opencv/platforms/apple/cv_build_utils.py", line 13, in execute
    retcode = check_call(cmd, cwd = cwd)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['xcodebuild', 'BITCODE_GENERATION_MODE=bitcode', 'IPHONEOS_DEPLOYMENT_TARGET=9.0', 'ARCHS=arm64', '-sdk', 'iphoneos', '-configuration', 'Release', '-parallelizeTargets', '-jobs', '10', '-target', 'ALL_BUILD', 'build']' returned non-zero exit status 65.
```