How can I link OpenCL on OS X?


#1

Hi.

I tried Autumnai’s Leaf and Collenchyma. Collenchyma uses OpenCL.

I did cargo test Collenchyma and failed with the following error.

ld: library not found for -lOpenCL

I googled and modified the code in src/frameworks/opencl/mod.rs from

#[link(name = "OpenCL")]
#[cfg(target_os = "linux")]
extern { }

to

#[cfg(target_os = "macos")]
#[link(name = "OpenCL", kind = "framework")]
extern { }

But it didn’t solve the problem.

Could anyone give me any ideas or suggestions?


#2

I found link attribute in a different file.
Changing the code in src/frameworks/opencl/ffi.rs from

#[link(name = "OpenCL")]

to

#[cfg(target_os = "macos")]
#[link(name = "OpenCL", kind = "framework")]

solved the problem.
But now I am suffering from linker error by -lcuda…