Search code examples
ioshalide

How do you compile Halide for iOS?


The README claims it can compile to armv7, but I cannot find the magic incantation to make it work.

I started down the rabbit hole of changing the Makefile to set the arch=armv7, fixing the resulting compilation errors, etc, but that doesn't seem like the right way to go about it.

There recommended cmake flags are:

cmake -DLLVM_TARGETS_TO_BUILD="X86;ARM;NVPTX" -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_BUILD_TYPE=Release ..

But alas, the bin directory contains only a .a and a .so, both of which are compiled for x86_64. There are no dylibs.

I can successfully run the test iOS app in the simulator, linking with the x86 libraries, but I cannot build on a device since there are no arm binaries.

Here is a link to the Halide test app I'm trying to build: https://github.com/halide/Halide/tree/master/apps/HelloiOS


Solution

  • You should use AOT compilation for iOS. The JIT in principle works on ARM (the architecture), but not on iOS (the OS).