Cannot find libHalide.so to build

241 Views Asked by At

I'd like to build the Halide tutorials on mac.

The instruction says:

// On os x:
// g++ lesson_02*.cpp -g -I <path/to/Halide.h> -I <path/to/tools/halide_image_io.h> -L <path/to/libHalide.so> -lHalide `libpng-config --cflags --ldflags` -ljpeg -o lesson_02 -std=c++17
// DYLD_LIBRARY_PATH=<path/to/libHalide.dylib> ./lesson_02

From the release of Halide, I can locate Halide.h and libHalide.dylib but not libHalide.so.

Where do I find it?

Example:

find . -name 'Halide.h'
./include/Halide.h

but looking for the .so file returns nothing.

1

There are 1 best solutions below

2
Alex Reinking On

The instructions were originally written for Linux systems. On macOS, shared libraries use the .dylib extension, not .so, so this amounts to a typo in the tutorial.


That said, I would recommend using CMake instead...

cmake_minimum_required(VERSION 3.16)
project(tutorial)

find_package(Halide REQUIRED)

add_executable(lesson02 lesson02.cpp)
target_link_libraries(lesson02 PRIVATE Halide::Halide)

This build is portable across Windows, macOS, and Linux.