Skip to content

ios dynamic framework refer to local path #18405

@sjang42

Description

@sjang42
System information (version)

OpenCV => fixed version of 4.4.x (https://github.com/komakai/opencv/tree/fix-build-without)
Operating System / Platform => MAC Catalina
Compiler => Cmake 3.8
Python => 2.7
Xcode => 12.0
I'm using the fixed version of opencv about without arguement issue. The code is here from @komakai.

Detailed description

When I build a dynamic framework for ios using platforms/ios/build_framework.py, the built fat framework can't be used stand alone. If I copy the built fat framework and remove the original, iOS project with copied framework fails to run.

Let's say I built a opencv2.framework using build_framework.py to the directory /Users/jex.jang/opencv/ios/ so the full path of built framework is /Users/jex.jang/opencv/ios/opencv2.framework.
And then I copy the framework to my ios project folder. let's say it is /Users/jex.jang/MyProject/. Then the full path of the framework is /Users/jex.jang/MyProject/opencv2.framework.
It works well only If I keep the original. If I remove the original built directory, /Users/jex.jang/opencv/ios/, It fails to run.
In this case, I can't share my project with other developers because the framework keep looking for My original built directory.
And the issue looks like only for iOS simulator not iOS real device.

I tried this issue in Xcode 11.5, 11.7, 12.0 and the same results.

Steps to reproduce
  1. get the code of fixed version of opencv
  1. build ios framework
    The script below only builds core, imgcodecs, imgproc, video, videoio, objc for the build speed sake.
python platforms/ios/build_framework.py ios \
        --dynamic \
	--without=calib3d \
	--without=dnn \
	--without=features2d \
	--without=flann \
	--without=gapi \
	--without=highgui \
	--without=java \
	--without=js \
	--without=ml \
	--without=objdetect \
	--without=photo \
	--without=python \
	--without=stitching \
	--without=ts \
	--iphoneos_archs=arm64 \
	--iphonesimulator_archs=x86_64
  1. Copy the built framework to ios project
  • I attached my testing ios project, OpenCVTests.zip. Drag and drop(copy) the built framework to the ios project and run the test code. testReturnMat using xcode. Check it runs without errors.
  1. Remove or rename the original built directory
  • rename platforms/ios/ to platforms/ios_2/
  1. Now re run the test code. It shows error.

Even if I change the order of step between 3, 4 the result is same.

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