2015年12月17日木曜日

El capitan で DYLD_LIBRARY_PATH が効かない

dyld: Library not loaded: @rpath/libcudart.7.5.dylib
のようなエラーが出るのでDYLD_LIBRARY_PATHで避けようとしてもなんかうまくいかない。調べてみると、System Integrity Protection の影響らしい。
ここによると、
Spawning children processes of processes restricted by System Integrity Protection, such as by launching a helper process in a bundle with NSTask or calling the exec(2) command, resets the Mach special ports of that child process. Any dynamic linker (dyld) environment variables, such as DYLD_LIBRARY_PATH, are purged when launching protected processes.
だそうで、起動時に引き渡されないらしい。これは参った。そもそもリンクの時におかしなことになっているのが悪いのだが。。

otool -L build/examples/cifar10/convert_cifar_data.bin
とやると、

    @rpath/libcudart.7.5.dylib (compatibility version 0.0.0, current version 7.5.18)
となっている。

install_name_tool -add_rpath /usr/local/cuda/lib build/examples/cifar10/convert_cifar_data.bin
とやるとちゃんと動くようになるのだが、これを全部やるのか??かんべんしてくれ。

0 件のコメント: