Using Halide on windows?

2.2k Views Asked by At

My Question: How does one get Halide working in a windows environment? I have been unable to find any real documentation for windows (part of the 'rough edges' I expect).

My Situation: I'm trying to use Halide in a cross-platform (windows, mac, android) situation, and I'm having a lot of trouble getting it to work in VS2013. Using the prebuilt binaries everything runs and compiles just fine, but when I try and actually run the program, the line

Halide::Func gradient("gradient");

throws a std::bad_alloc exception in the Halide.DLL. I'm starting to suspect that perhaps the Halide windows binaries were compiled for use with the MinGW toolchain or some other non-msvc solution and my problems stem from that. Any ideas?

Update: I can now run without hitting this problem, but only in Release builds. Defining _DEBUG and/or linking with /MDd causes the crash.

2

There are 2 best solutions below

0
On

I do not know the details about the binaries provided by the Halide team, but your problem may be that MSVC often prevents to mix debug and release binaries, especially if they use the STL (see this answer)

Building LLVM/Clang and Halide from source is easier that it looks and will allow you to build binaries suited to your build environment. I recently built LLVM 3.5/Clang and the latest Halide with VS2012 without problems.

First build LLVM in Debug and Release (maybe 1 ou 2 hours each...). Then run cmake for Halide once for Debug and once for Release, with different build directories.

1
On

I've been able to get Halide working on the new Windows Subsystem of Linux without any issues. I used gcc4.8 to compile the tutorials.