There was a much simpler fix for linking libcuda at runtime.