Skip to content

Darwin collision of Point/Rect/Size types is still happening #19254

@imxieyi

Description

@imxieyi
System information (version)
  • OpenCV => 4.5.1
  • Operating System / Platform => macOS 11.1, iOS 14.3
  • Compiler => Xcode 12.3, CMake 3.19.2
Detailed description

Either the old .framework or the new .xcframework won't compile with pure Swift project. The collision was supposed to be fixed by #18977. However it is still happening with both 4.5.1 and master branch (005508a). Example log:

/Users/x/Library/Developer/Xcode/DerivedData/opencv-test-fergxwbmhhedlzemnxjfnzmrvlbj/Build/Products/Debug-iphoneos/opencv2.framework/Modules/opencv2.swiftmodule/arm64-apple-ios.swiftinterface:29:122: error: ambiguous type name 'Size' in module 'opencv2'
  @nonobjc public class func calibrateCamera(objectPoints: [opencv2.Mat], imagePoints: [opencv2.Mat], imageSize: opencv2.Size, cameraMatrix: opencv2.Mat, distCoeffs: opencv2.Mat, rvecs: inout [opencv2.Mat], tvecs: inout [opencv2.Mat], stdDeviationsIntrinsics: opencv2.Mat, stdDeviationsExtrinsics: opencv2.Mat, perViewErrors: opencv2.Mat, flags: Swift.Int32, criteria: opencv2.TermCriteria) -> Swift.Double
                                                                                                                 ~~~~~~~ ^
opencv2.Size:1:12: note: found candidate with type 'Size'
open class Size : NSObject {
           ^
Darwin.Size:1:18: note: found candidate with type 'Size' (aka 'Int')
public typealias Size = Int
                 ^
Steps to reproduce
  1. Build xcframework according to platforms/apple/readme.md.
  2. Create a new iOS Swift project in Xcode.
  3. Import opencv2.xcframework from step 1 to the project.
  4. Add import opencv2 in any of the .swift files.
  5. Build the project.
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    answers.opencv.org, Stack Overflow, etc and have not found solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions