Issue 1:
System Information

System: macOS Monterery 12.6(21G115) mac Mini

opencv branch master

cmake version 3.25.0-rc2

Python 3.9.7

Detailed description

**I want to cross build opencv for ios. in my Mac mini use following command:

python opencv/platforms/ios/build_framework.py ios --contrib opencv_contrib --iphoneos_archs arm64 --iphonesimulator_archs x86_64

but i alway report error as follows:

/Users/linxiaohai/source/opencv/ios/build/build-arm64-iphoneos/modules/objc/framework_build/opencv2.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'ALL_BUILD' from project 'opencv2')
note: Run script build phase 'Generate CMakeFiles/ALL_BUILD' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'ALL_BUILD' from project 'opencv2')
/Users/linxiaohai/source/opencv/ios/build/build-arm64-iphoneos/modules/objc/framework_build/opencv2.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'ZERO_CHECK' from project 'opencv2')
note: Run script build phase 'Generate CMakeFiles/ZERO_CHECK' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'ZERO_CHECK' from project 'opencv2')

BUILD FAILED

The following build commands failed:
SwiftCompile normal arm64 Compiling\ ImgcodecsExt.swift,\ ImgprocExt.swift,\ MlExt.swift /Users/linxiaohai/source/opencv/ios/build/build-arm64-iphoneos/modules/objc_bindings_generator/ios/gen/objc/imgcodecs/ImgcodecsExt.swift /Users/linxiaohai/source/opencv/ios/build/build-arm64-iphoneos/modules/objc_bindings_generator/ios/gen/objc/imgproc/ImgprocExt.swift /Users/linxiaohai/source/opencv/ios/build/build-arm64-iphoneos/modules/objc_bindings_generator/ios/gen/objc/ml/MlExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal arm64 /Users/linxiaohai/source/opencv/ios/build/build-arm64-iphoneos/modules/objc_bindings_generator/ios/gen/objc/imgcodecs/ImgcodecsExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal arm64 /Users/linxiaohai/source/opencv/ios/build/build-arm64-iphoneos/modules/objc_bindings_generator/ios/gen/objc/imgproc/ImgprocExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal arm64 /Users/linxiaohai/source/opencv/ios/build/build-arm64-iphoneos/modules/objc_bindings_generator/ios/gen/objc/ml/MlExt.swift (in target 'opencv2' from project 'opencv2')
SwiftCompile normal arm64 Compiling\ ObjdetectExt.swift,\ PhotoExt.swift,\ Structured_lightExt.swift /Users/linxiaohai/source/opencv/ios/build/build-arm64-iphoneos/modules/objc_bindings_generator/ios/gen/objc/objdetect/ObjdetectExt.swift /Users/linxiaohai/source/opencv/ios/build/build-arm64-iphoneos/modules/objc_bindings_generator/ios/gen/objc/photo/PhotoExt.swift /Users/linxiaohai/source/opencv/ios/build/build-arm64-iphoneos/modules/objc_bindings_generator/ios/gen/objc/structured_light/Structured_lightExt.swift (in target 'opencv2' from project 'opencv2')
(5 failures)
============================================================
ERROR: Command '['xcodebuild', 'BITCODE_GENERATION_MODE=bitcode', 'IPHONEOS_DEPLOYMENT_TARGET=9.0', 'ARCHS=arm64', '-sdk', 'iphoneos', '-configuration', 'Release', '-parallelizeTargets', '-jobs', '8', '-target', 'ALL_BUILD', 'build']' returned non-zero exit status 65.
============================================================
Traceback (most recent call last):
File "/Users/linxiaohai/source/opencv/opencv/platforms/ios/build_framework.py", line 181, in build
self._build(outdir)
File "/Users/linxiaohai/source/opencv/opencv/platforms/ios/build_framework.py", line 139, in _build
self.buildOne(target[0], target[1], main_build_dir, cmake_flags)
File "/Users/linxiaohai/source/opencv/opencv/platforms/ios/build_framework.py", line 329, in buildOne
execute(buildcmd + ["-target", "ALL_BUILD", "build"], cwd = builddir + "/modules/objc/framework_build")
File "/Users/linxiaohai/source/opencv/opencv/platforms/apple/cv_build_utils.py", line 13, in execute
retcode = check_call(cmd, cwd = cwd)
File "/Users/linxiaohai/.pyenv/versions/3.9.7/lib/python3.9/subprocess.py", line 373, 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', '8', '-target', 'ALL_BUILD', 'build']' returned non-zero exit status 65.

Steps to reproduce

run python opencv/platforms/ios/build_framework.py ios --contrib opencv_contrib --iphoneos_archs arm64 --iphonesimulator_archs x86_64 >> buildlog.log

i will report build error as menthon above.

Issue submission checklist

I report the issue, it's not a question

I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution

I updated to the latest OpenCV version and the issue is still there

There is reproducer code and related data files (videos, images, onnx, etc)

Issue 2:
** BUILD FAILED **

The following build commands failed:
EmitSwiftModule normal x86_64 (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/objdetect/ObjdetectExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/photo/PhotoExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/structured_light/Structured_lightExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/aruco/ArucoExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/calib3d/Calib3dExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/core/ByteVectorExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/core/CoreExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/imgcodecs/ImgcodecsExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/imgproc/ImgprocExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/ml/MlExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/core/CvTypeExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/core/DoubleVectorExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/core/FloatVectorExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/dnn/DnnExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/face/FaceExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/features2d/Features2dExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/core/IntVectorExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/core/MatExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/core/Typealiases.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/text/TextExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/video/VideoExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/videoio/VideoioExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/wechat_qrcode/Wechat_qrcodeExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/xfeatures2d/Xfeatures2dExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwift normal x86_64 /Users/andy/Workspace/OpenCV/build_xcframework/macos/build/build-x86_64-macosx/modules/objc_bindings_generator/osx/gen/objc/ximgproc/XimgprocExt.swift (in target 'opencv2' from project 'opencv2')
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'opencv2' from project 'opencv2')
(27 failures)
============================================================
ERROR: Command '['xcodebuild', 'MACOSX_DEPLOYMENT_TARGET=10.12', 'ARCHS=x86_64', '-sdk', 'macosx', '-configuration', 'Release', '-parallelizeTargets', '-jobs', '8', '-target', 'ALL_BUILD', 'build']' returned non-zero exit status 65.
============================================================
Traceback (most recent call last):
File "/Users/andy/Workspace/OpenCV/opencv/platforms/ios/build_framework.py", line 181, in build
self._build(outdir)
File "/Users/andy/Workspace/OpenCV/opencv/platforms/ios/build_framework.py", line 139, in _build
self.buildOne(target[0], target[1], main_build_dir, cmake_flags)
File "/Users/andy/Workspace/OpenCV/opencv/platforms/ios/build_framework.py", line 329, in buildOne
execute(buildcmd + ["-target", "ALL_BUILD", "build"], cwd = builddir + "/modules/objc/framework_build")
File "/Users/andy/Workspace/OpenCV/opencv/platforms/apple/cv_build_utils.py", line 13, in execute
retcode = check_call(cmd, cwd = cwd)
File "/Users/andy/opt/anaconda3/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['xcodebuild', 'MACOSX_DEPLOYMENT_TARGET=10.12', 'ARCHS=x86_64', '-sdk', 'macosx', '-configuration', 'Release', '-parallelizeTargets', '-jobs', '8', '-target', 'ALL_BUILD', 'build']' returned non-zero exit status 65.
============================================================
ERROR: Command '['python3', '/Users/andy/Workspace/OpenCV/opencv/platforms/osx/build_framework.py', './build_xcframework/macos', '--macos_archs', 'x86_64,arm64', '--framework_name', 'opencv2', '--build_only_specified_archs', '--contrib', 'opencv_contrib']' returned non-zero exit status 1.
============================================================
Traceback (most recent call last):
File "opencv/platforms/apple/build_xcframework.py", line 99, in <module>
execute(command, cwd=os.getcwd())
File "/Users/andy/Workspace/OpenCV/opencv/platforms/apple/cv_build_utils.py", line 13, in execute
retcode = check_call(cmd, cwd = cwd)
File "/Users/andy/opt/anaconda3/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['python3', '/Users/andy/Workspace/OpenCV/opencv/platforms/osx/build_framework.py', './build_xcframework/macos', '--macos_archs', 'x86_64,arm64', '--framework_name', 'opencv2', '--build_only_specified_archs', '--contrib', 'opencv_contrib']' returned non-zero exit status 1.