How do you compile Halide for iOS?

582 Views Asked by At

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

2

There are 2 best solutions below

0
On BEST ANSWER

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

2
On

Clarification: are you trying to build Halide to run on ARM, or merely to generate code for ARM? (If the latter, any target will do, as all builds of Halide can generate code for all known targets.)