Skip to content

4.10.0 - visionOS compile errors with VideoIO  #26450

@danoli3

Description

@danoli3

System Information

OpenCV 4.10.0

GitHub Actions macOS latest
https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md

Detailed description

/Users/runner/work/apothecary/apothecary/apothecary/build/opencv/modules/videoio/src/cap_ios_abstract_camera.mm:40:31: error: 'AVCaptureVideoPreviewLayer' is unavailable: not available on visionOS
   40 | @property (nonatomic, strong) AVCaptureVideoPreviewLayer* captureVideoPreviewLayer;
      |                               ^
/Applications/Xcode_16.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS2.0.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureVideoPreviewLayer.h:33:12: note: 'AVCaptureVideoPreviewLayer' has been explicitly marked unavailable here
   33 | @interface AVCaptureVideoPreviewLayer : CALayer
      |            ^
/Users/runner/work/apothecary/apothecary/apothecary/build/opencv/modules/videoio/src/cap_ios_abstract_camera.mm:90:59: error: 'UIDeviceOrientationDidChangeNotification' is unavailable: not available on visionOS
   90 |                                                      name:UIDeviceOrientationDidChangeNotification
      |                                                           ^
/Applications/Xcode_16.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS2.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:83:39: note: 'UIDeviceOrientationDidChangeNotification' has been explicitly marked unavailable here
   83 | UIKIT_EXTERN NSNotificationName const UIDeviceOrientationDidChangeNotification API_UNAVAILABLE(tvos, visionos, watchos) NS_SWIFT_NONISOLATED;
      |                                       ^
/Users/runner/work/apothecary/apothecary/apothecary/build/opencv/modules/videoio/src/cap_ios_abstract_camera.mm:92:35: error: 'beginGeneratingDeviceOrientationNotifications' is unavailable: not available on visionOS
   92 |         [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
      |                                   ^
/Applications/Xcode_16.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS2.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:49:1: note: 'beginGeneratingDeviceOrientationNotifications' has been explicitly marked unavailable here
   49 | - (void)beginGeneratingDeviceOrientationNotifications API_UNAVAILABLE(tvos, visionos);      // nestable
      | ^
/Users/runner/work/apothecary/apothecary/apothecary/build/opencv/modules/videoio/src/cap_ios_abstract_camera.mm:93:62: error: 'orientation' is unavailable: not available on visionOS
   93 |         currentDeviceOrientation = [[UIDevice currentDevice] orientation];
      |                                                              ^
/Applications/Xcode_16.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS2.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:44:51: note: property 'orientation' is declared unavailable here
   44 | @property(nonatomic,readonly) UIDeviceOrientation orientation API_UNAVAILABLE(tvos, visionos);       // return current device orientation.  this will return UIDeviceOrientationUnknown unless device orientation notifications are being generated.
      |                                                   ^
/Applications/Xcode_16.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS2.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:44:51: note: 'orientation' has been explicitly marked unavailable here
/Users/runner/work/apothecary/apothecary/apothecary/build/opencv/modules/videoio/src/cap_ios_abstract_camera.mm:97:74: error: 'UIImagePickerControllerSourceTypeCamera' is unavailable: not available on visionOS
   97 |         cameraAvailable = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera];
      |                                                                          ^
/Applications/Xcode_16.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS2.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIImagePickerController.h:20:5: note: 'UIImagePickerControllerSourceTypeCamera' has been explicitly marked unavailable here
   20 |     UIImagePickerControllerSourceTypeCamera API_UNAVAILABLE(visionos),
      |     ^
/Users/runner/work/apothecary/apothecary/apothecary/build/opencv/modules/videoio/src/cap_ios_abstract_camera.mm:104:49: error: 'AVCaptureVideoOrientationLandscapeLeft' is unavailable: not available on visionOS
  104 |         self.defaultAVCaptureVideoOrientation = AVCaptureVideoOrientationLandscapeLeft;
      |                                                 ^
/Applications/Xcode_16.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS2.0.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureSession.h:140:28: note: 'AVCaptureVideoOrientation' has been explicitly marked unavailable here
  140 | typedef NS_ENUM(NSInteger, AVCaptureVideoOrientation) {
      |                            ^
/Users/runner/work/apothecary/apothecary/apothecary/build/opencv/modules/videoio/src/cap_ios_abstract_camera.mm:106:46: error: 'AVCaptureSessionPreset352x288' is unavailable: not available on visionOS
  106 |         self.defaultAVCaptureSessionPreset = AVCaptureSessionPreset352x288;
      |                                              ^
/Applications/Xcode_16.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS2.0.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureSessionPreset.h:81:41: note: 'AVCaptureSessionPreset352x288' has been explicitly marked unavailable here
   81 | AVF_EXPORT AVCaptureSessionPreset const AVCaptureSessionPreset352x288 API_AVAILABLE(macos(10.7), ios(5.0), macCatalyst(14.0), tvos(17.0)) API_UNAVAILABLE(visionos) API_UNAVAILABLE(watchos);
      |                                         ^
/Users/runner/work/apothecary/apothecary/apothecary/build/opencv/modules/videoio/src/cap_ios_abstract_camera.mm:123:59: error: 'UIDeviceOrientationDidChangeNotification' is unavailable: not available on visionOS
  123 |                                                      name:UIDeviceOrientationDidChangeNotification
      |                                                           ^
/Applications/Xcode_16.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS2.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:83:39: note: 'UIDeviceOrientationDidChangeNotification' has been explicitly marked unavailable here
   83 | UIKIT_EXTERN NSNotificationName const UIDeviceOrientationDidChangeNotification API_UNAVAILABLE(tvos, visionos, watchos) NS_SWIFT_NONISOLATED;
      |                                       ^
/Users/runner/work/apothecary/apothecary/apothecary/build/opencv/modules/videoio/src/cap_ios_abstract_camera.mm:125:35: error: 'beginGeneratingDeviceOrientationNotifications' is unavailable: not available on visionOS
  125 |         [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
      |                                   ^
/Applications/Xcode_16.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS2.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:49:1: note: 'beginGeneratingDeviceOrientationNotifications' has been explicitly marked unavailable here
   49 | - (void)beginGeneratingDeviceOrientationNotifications API_UNAVAILABLE(tvos, visionos);      // nestable
      | ^
/Users/runner/work/apothecary/apothecary/apothecary/build/opencv/modules/videoio/src/cap_ios_abstract_camera.mm:126:62: error: 'orientation' is unavailable: not available on visionOS
  126 |         currentDeviceOrientation = [[UIDevice currentDevice] orientation];
      |                                                              ^
/Applications/Xcode_16.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS2.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:44:51: note: property 'orientation' is declared unavailable here
   44 | @property(nonatomic,readonly) UIDeviceOrientation orientation API_UNAVAILABLE(tvos, visionos);       // return current device orientation.  this will return UIDeviceOrientationUnknown unless device orientation notifications are being generated.
      |                                                   ^
/Applications/Xcode_16.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS2.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:44:51: note: 'orientation' has been explicitly marked unavailable here
/Users/runner/work/apothecary/apothecary/apothecary/build/opencv/modules/videoio/src/cap_ios_abstract_camera.mm:130:74: error: 'UIImagePickerControllerSourceTypeCamera' is unavailable: not available on visionOS
  130 |         cameraAvailable = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera];
      |                                                                          ^
/Applications/Xcode_16.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS2.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIImagePickerController.h:20:5: note: 'UIImagePickerControllerSourceTypeCamera' has been explicitly marked unavailable here
   20 |     UIImagePickerControllerSourceTypeCamera API_UNAVAILABLE(visionos),
      |     ^
/Users/runner/work/apothecary/apothecary/apothecary/build/opencv/modules/videoio/src/cap_ios_abstract_camera.mm:137:49: error: 'AVCaptureVideoOrientationLandscapeLeft' is unavailable: not available on visionOS
  137 |         self.defaultAVCaptureVideoOrientation = AVCaptureVideoOrientationLandscapeLeft;
      |                                                 ^
/Applications/Xcode_16.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS2.0.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureSession.h:140:28: note: 'AVCaptureVideoOrientation' has been explicitly marked unavailable here
  140 | typedef NS_ENUM(NSInteger, AVCaptureVideoOrientation) {
      |                            ^
/Users/runner/work/apothecary/apothecary/apothecary/build/opencv/modules/videoio/src/cap_ios_abstract_camera.mm:139:46: error: 'AVCaptureSessionPreset640x480' is unavailable: not available on visionOS
  139 |         self.defaultAVCaptureSessionPreset = AVCaptureSessionPreset640x480;
      |                                              ^
/Applications/Xcode_16.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS2.0.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureSessionPreset.h:91:41: note: 'AVCaptureSessionPreset640x480' has been explicitly marked unavailable here
   91 | AVF_EXPORT AVCaptureSessionPreset const AVCaptureSessionPreset640x480 API_AVAILABLE(macos(10.7), ios(4.0), macCatalyst(14.0), tvos(17.0)) API_UNAVAILABLE(visionos) API_UNAVAILABLE(watchos);
      |                                         ^
/Users/runner/work/apothecary/apothecary/apothecary/build/opencv/modules/videoio/src/cap_ios_abstract_camera.mm:152:31: error: 'endGeneratingDeviceOrientationNotifications' is unavailable: not available on visionOS
  152 |     [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
      |                               ^
/Applications/Xcode_16.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS2.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:50:1: note: 'endGeneratingDeviceOrientationNotifications' has been explicitly marked unavailable here
   50 | - (void)endGeneratingDeviceOrientationNotifications API_UNAVAILABLE(tvos, visionos);
      | ^
/Users/runner/work/apothecary/apothecary/apothecary/build/opencv/modules/videoio/src/cap_ios_abstract_camera.mm:241:64: error: 'orientation' is unavailable: not available on visionOS
  241 |     UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
      |                                                                ^
/Applications/Xcode_16.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS2.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:44:51: note: 'orientation' has been explicitly marked unavailable here
   44 | @property(nonatomic,readonly) UIDeviceOrientation orientation API_UNAVAILABLE(tvos, visionos);       // return current device orientation.  this will return UIDeviceOrientationUnknown unless device orientation notifications are being generated.
      |                                                   ^
/Users/runner/work/apothecary/apothecary/apothecary/build/opencv/modules/videoio/src/cap_ios_abstract_camera.mm:270:30: error: 'canSetSessionPreset:' is unavailable: not available on visionOS
  270 |     if ([self.captureSession canSetSessionPreset:self.defaultAVCaptureSessionPreset]) {
      |                              ^
/Applications/Xcode_16.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS2.0.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureSession.h:184:1: note: 'canSetSessionPreset:' has been explicitly marked unavailable here
  184 | - (BOOL)canSetSessionPreset:(AVCaptureSessionPreset)preset API_UNAVAILABLE(visionos);
      | ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
12 warnings and 20 errors generated.
make[2]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_ios_abstract_camera.mm.o] Error 1
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
make: *** [all] Error 2

Steps to reproduce

Builing with VideoIO

mkdir -p "build_${TYPE}_${PLATFORM}"
    cd "build_${TYPE}_${PLATFORM}"
    rm -f CMakeCache.txt || true
    CORE_DEFS="
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_C_STANDARD=${C_STANDARD} \
    -DCMAKE_CXX_STANDARD=${CPP_STANDARD} \
    -DCMAKE_CXX_STANDARD_REQUIRED=ON \
    -DCMAKE_CXX_EXTENSIONS=OFF \
    -DBUILD_SHARED_LIBS=OFF \
    -DCMAKE_INSTALL_PREFIX=Release \
    -DCMAKE_INCLUDE_OUTPUT_DIRECTORY=include \
    -DCMAKE_INSTALL_INCLUDEDIR=include \
    -DZLIB_ROOT=${ZLIB_ROOT} \
    -DZLIB_LIBRARY=${ZLIB_LIBRARY} \
    -DZLIB_INCLUDE_DIRS=${ZLIB_INCLUDE_DIR} \
    -DPNG_ROOT=${LIBPNG_ROOT} \
    -DPNG_PNG_INCLUDE_DIR=${LIBPNG_INCLUDE_DIR} \
    -DPNG_LIBRARY=${LIBPNG_LIBRARY}"
    
    DEFS="
    -DBUILD_DOCS=OFF \
    -DENABLE_BUILD_HARDENING=ON \
    -DBUILD_EXAMPLES=OFF \
    -DBUILD_FAT_JAVA_LIB=OFF \
    -DBUILD_JASPER=OFF \
    -DBUILD_PACKAGE=OFF \
    -DBUILD_opencv_java=OFF \
    -DBUILD_opencv_python=OFF \
    -DBUILD_opencv_python2=OFF \
    -DBUILD_opencv_python3=OFF \
    -DBUILD_opencv_apps=OFF \
    -DBUILD_opencv_highgui=ON \
    -DBUILD_opencv_imgcodecs=ON \
    -DBUILD_opencv_stitching=ON \
    -DBUILD_opencv_calib3d=ON \
    -DBUILD_opencv_objdetect=ON \
    -DOPENCV_ENABLE_NONFREE=OFF \
    -DWITH_PNG=ON \
    -DBUILD_PNG=OFF \
    -DWITH_1394=OFF \
    -DWITH_IMGCODEC_HDR=ON \
    -DWITH_CARBON=OFF \
    -DWITH_JPEG=OFF \
    -DWITH_TIFF=ON \
    -DWITH_FFMPEG=ON \
    -DWITH_QUIRC=ON \
    -DWITH_GIGEAPI=OFF \
    -DBUILD_OBJC=ON \
    -DWITH_CUDA=OFF \
    -DWITH_METAL=ON
    -DWITH_CUFFT=OFF \
    -DWITH_JASPER=OFF \
    -DWITH_LIBV4L=OFF \
    -DWITH_IMAGEIO=OFF \
    -DWITH_IPP=OFF \
    -DWITH_OPENNI=OFF \
    -DWITH_OPENNI2=OFF \
    -DWITH_QT=OFF \
    -DWITH_QUICKTIME=OFF \
    -DWITH_V4L=OFF \
    -DWITH_PVAPI=OFF \
    -DWITH_OPENEXR=OFF \
    -DWITH_EIGEN=ON \
    -DBUILD_TESTS=OFF \
    -DWITH_LAPACK=OFF \
    -DWITH_WEBP=OFF \
    -DWITH_GPHOTO2=OFF \
    -DWITH_VTK=OFF \
    -DWITH_CAP_IOS=ON \
    -DWITH_WEBP=ON \
    -DWITH_GTK=OFF \
    -DWITH_GTK_2_X=OFF \
    -DWITH_MATLAB=OFF \
    -DWITH_OPENVX=ON \
    -DWITH_ADE=OFF \
    -DWITH_TBB=OFF \
    -DWITH_OPENGL=OFF \
    -DWITH_GSTREAMER=OFF \
    -DVIDEOIO_PLUGIN_LIST=gstreamer \
    -DWITH_IPP=OFF \
    -DWITH_IPP_A=OFF \
    -DBUILD_ZLIB=OFF \
    -DWITH_ITT=OFF "

    if [[ "$ARCH" =~ ^(arm64|SIM_arm64|arm64_32)$ ]]; then
      EXTRA_DEFS="-DCV_ENABLE_INTRINSICS=OFF -DWITH_CAROTENE=OFF"
    else 
      EXTRA_DEFS="-DCV_ENABLE_INTRINSICS=ON "
    fi

    if [[ "$TYPE" =~ ^(tvos|catos|xros)$ ]]; then
      EXTRA_DEFS="$EXTRA_DEFS -DBUILD_opencv_videoio=OFF -DBUILD_opencv_videostab=OFF"
    else 
      EXTRA_DEFS="-DBUILD_opencv_videoio=ON -DBUILD_opencv_videostab=ON"
    fi    

    cmake .. ${CORE_DEFS} ${DEFS} ${EXTRA_DEFS} \
      -DCMAKE_PREFIX_PATH="${LIBS_ROOT}" \
      -DCMAKE_TOOLCHAIN_FILE=$APOTHECARY_DIR/toolchains/ios.toolchain.cmake \
      -DPLATFORM=$PLATFORM \
      -DENABLE_BITCODE=OFF \
      -DENABLE_ARC=ON \
      -DDEPLOYMENT_TARGET=${MIN_SDK_VER} \
      -DENABLE_VISIBILITY=OFF \
      -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
      -DENABLE_FAST_MATH=OFF \
      -DCMAKE_EXE_LINKER_FLAGS="-framework Foundation -framework AVFoundation -framework CoreFoundation -framework CoreVideo" \
      -DCMAKE_CXX_FLAGS="-fvisibility-inlines-hidden -stdlib=libc++ -fPIC -Wno-implicit-function-declaration -DUSE_PTHREADS=1 ${FLAG_RELEASE}" \
      -DCMAKE_C_FLAGS="-fvisibility-inlines-hidden -stdlib=libc++ -fPIC -Wno-implicit-function-declaration -DUSE_PTHREADS=1 ${FLAG_RELEASE}" \
      -DENABLE_STRICT_TRY_COMPILE=ON \
      -DCMAKE_VERBOSE_MAKEFILE=${VERBOSE_MAKEFILE}

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)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions