cudnn.torch icon indicating copy to clipboard operation
cudnn.torch copied to clipboard

DYLD_LIBRARY_PATH no longer easily inherited on OS X El Capitan

Open kcarnold opened this issue 9 years ago • 1 comments

The install instructions for CUDNN have you add its directory to DYLD_LIBRARY_PATH. Unfortunately, El Capitan changed how that environment variable works: certain executables (maybe everything in /bin?) don't inherit DYLD_* anymore. It has to do with System Integrity Protection, apparently. Unfortunately, since the th command is a #!/bin/sh script, th doesn't inherit the library path and you get

libcudnn (R4) not found in library path.
Please install CuDNN from https://developer.nvidia.com/cuDNN
Then make sure files named as libcudnn.so.4 or libcudnn.4.dylib are placed in your library load path (for example /usr/local/lib , or manually add a path to LD_LIBRARY_PATH)

I hacked around this temporarily by setting the DYLD_LIBRARY_PATH inside ~/torch/install/bin/th, but of course that's fragile. It would be great if somehow cudnn.torch could link directly against a CUDNN library so we wouldn't have to patch the linker to find it.

A workaround I haven't tried might be to put cudnn in ~/lib or /usr/local/lib, since those are on the library path by default.

Edit: some additional info from other projects: https://github.com/oracle/node-oracledb/issues/231

kcarnold avatar Feb 12 '16 18:02 kcarnold

ugh! this has been a horrible move from Apple. I had to deal with some of these after-effects recently.

We'll think of a robust solution against this, like allowing the user to specify the path to the lib at runtime as an option. And thanks for the heads-up.

soumith avatar Feb 12 '16 18:02 soumith