Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build from Source Error '/usr/local/cuda/lib64' is not a directory #977

Closed
jordandraper opened this issue May 31, 2019 · 5 comments
Closed

Comments

@jordandraper
Copy link

OS: macOS High Sierra 10.13.6 (17G2307)
Xcode: 10.1 (10B61)
Apple LLVM: 10.0.0
CUDA Toolkit: 10.1 with cuDNN for CUDA 10.1

I successfully built/installed PyTorch from source. Then went to build/install Torch Vision but kept running into this error:

ld: warning: -L path '/usr/local/cuda/lib64' is not a directory
ld: library not found for -lcudart
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang++' failed with exit status 1

Something about the build is pointing to '/usr/local/cuda/lib64' even though the newest CUDA 10.1 installation uses '/usr/local/cuda/lib'.

As a fix, I duplicated the '/usr/local/cuda/lib' folder, renamed it '/usr/local/cuda/lib64' and the build worked.

@fmassa
Copy link
Member

fmassa commented May 31, 2019

What command did you use to install torchvision?

This might be a problem with our cpp extension picking the wrong directory.

cc @yf225 this part of the code might have a limitation that could potentially be fixed

@jordandraper
Copy link
Author

@fmassa I used MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install

@fmassa
Copy link
Member

fmassa commented May 31, 2019

Ok, thanks!

This looks like something that we should fix in PyTorch.

@DrMechanica
Copy link

I'd like to chime in and say I'm having the same issue here in July. Fixed it by editing the relevant lines in cpp_extension.py as mentioned by @fmassa.

@fmassa
Copy link
Member

fmassa commented Jul 10, 2019

@DrMechanica I was about to open an issue in PyTorch when I realized that there was already one open in pytorch/pytorch#16955 .

rgommers added a commit to Quansight/pytorch that referenced this issue Jul 28, 2019
Closes pytorchgh-16955.
Closes pytorch/vision#977

On Linux both `lib64` and `lib` may be present (symlinked). The reports
seem to all be about macOS, but it seems like this is also possibly more
robust on Linux and can't hurt. So not treating platforms differently.

Note that Eigen has a similar check in its CMake:

```
if(CUDA_64_BIT_DEVICE_CODE AND (EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/lib64"))
  link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64")
else()
  link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib")
endif()
 ```

There may be other issues for building from source on macOS, can't test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants