I’m trying to get started with a domain-specific language (C++ extension) for image processing called Halide.
Following the Halide README, here’s what I’ve tried:
- Downloaded the Ubuntu 12.04 Halide binary, and extracted in a directory called
~/halide. - In the
~/halidedirectory, I createdhello_halide.cpp, as described in theUsing Halidesection of this page. -
Tried to compile
hello_halide.cpp:g++-4.6 -std=c++0x hello_halide.cpp -L halide -lHalide -ldl -lpthread -o hello_halideBut, g++ can’t find libhalide:
/usr/bin/ld: error: cannot find -lHalide -
Tried adding
~/halideto my$PATHand$LD_LIBRARY_PATH, but this didn’t help.
How can I compile this basic hello_halide.cpp Halide program?
Notes:
- CUDA is one of Halide’s dependencies. I have CUDA installed, and I can compile/run CUDA programs.
- I’m using Ubuntu 12.04.
- My g++ version is 4.6.3.
-L halidetells the linker to look for the library in the subdirectoryhalide. In this case that means that your source filehello_halide.cppshould be in a folder~/myfolder/, and the librarylibHalide.soat~/myfolder/halide/libHalide.so(or.aif it’s static). If it’s somewhere else, pass an absolute path to-L.Your idea of setting
LD_LIBRARY_PATHorPATHdoes not work since the latter is for directories that will be searched for executables and the former is for directories that will be searched for shared libraries when you launch an executable that needs shared libraries.