Skip to content

Instantly share code, notes, and snippets.

@benjohnde
Last active October 25, 2017 08:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save benjohnde/7155910ec3aa3dfec34d12461ab1d822 to your computer and use it in GitHub Desktop.
Save benjohnde/7155910ec3aa3dfec34d12461ab1d822 to your computer and use it in GitHub Desktop.
Compilation error of dynamic framework for iOS (OpenCV 3.3.0)
#!/bin/bash
git clone git@github.com:opencv/opencv.git
cd opencv
git checkout 3.3.0
python platforms/ios/build_framework.py ios \
--dynamic \
--without imgcodec --without videoio --without video --without calib3d --without features2d \
--without objdetect --without dnn --without ml --without flann --without photo --without stitching \
--without cudaarithm --without cudabgsegm --without cudacodec --without cudafeatures2d \
--without cudafilters --without cudaimgproc --without cudalegacy --without cudaobjdetect \
--without cudaoptflow --without cudastereo --without cudawarping --without cudev --without shape \
--without superres --without videostab --without viz
@benjohnde
Copy link
Author

benjohnde commented Sep 14, 2017

After failure you need to download:
https://github.com/opencv/opencv_3rdparty/blob/ippicv/master_20170418/ippicv/ippicv_2017u2_mac_intel64_20170418.tgz

And put the library into:
~/opencv/ios/build/build-iphonesimulator/3rdparty/ippicv
Then re-run command!

For god's sake, cmake only downloads the i386 ippicv prebuilt library.

In addition for a correct build, you need to add the following to the Info.plist:

    <key>UIDeviceFamily</key>
    <array>
        <integer>1</integer>
        <integer>2</integer>
    </array>

@benjohnde
Copy link
Author

For having full bitcode enabled, you need to add the following to the python buildscript in line #149:

        if self.dynamic:
            buildcmd += [
                "IPHONEOS_DEPLOYMENT_TARGET=8.0",
                "ONLY_ACTIVE_ARCH=NO",
                "BITCODE_GENERATION_MODE=bitcode"
            ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment