Repository: pytorch
Issue: make[2]: *** No rule to make target 'libtorch/lib/libc10.so'
Labels: module: build,module: cpp,triaged

## 🐛 make[2]: *** No rule to make target 'libtorch/lib/libc10.so'

<!--  -->
## Temporary Solution:
* If you want to find a temporary solution to that problem,please check the "EDIT" at the end

## To Reproduce
Steps to reproduce the behavior:

* I have successfully tried to compile and run the C++ libtorch example,as it is described here:https://pytorch.org/tutorials/advanced/cpp_export.html .Everything's working fine here.
* Now,I want to embed somehow my CMakelists.txt from the previous example to a new CMakelists.txt(new project).
* However,I have searched a lot but I can't cmake succesfully,because for unknown reason my target binary links false(or duplicates) some paths.I provide these wrong paths below.
* I have checked also the "CMakeFiles/<target_name>.dir/build.make file,which is created by CMake,in order to find these duplicate paths(target name is "app"):
```
app: ../libtorch/lib/libtorch.so
app: libtorch/lib/libc10.so
app: libtorch/lib/libc10_cuda.so
....
app: libtorch/lib/libc10.so
app: libtorch/lib/libc10_cuda.so
app: ../libtorch/lib/libc10_cuda.so
app: ../libtorch/lib/libc10.so
```
* Below is the successfuly working CMakelists.txt from the PyTorch Example(assume "ok" is the binary of my example app in the PyTorch website):
```
project(test_cmake)
set(CMAKE_PREFIX_PATH "libtorch/share/cmake/Torch")
find_package(Torch REQUIRED)
add_executable(ok ok.cpp)
target_link_libraries(ok "${TORCH_LIBRARIES}")
set_property(TARGET ok PROPERTY CXX_STANDARD 11)
```
* And the following is my final CMakelists.txt,where i have embedded the CMakelists.txt from the previous example,in order to build my app(not working,due to the error in the description)
```
cmake_minimum_required(VERSION 2.8.12)
project(examples)
add_subdirectory(../dlib-19.13/dlib/ dlib_build)
add_executable(app f1.cpp f2.cpp ... fn.cpp)
target_link_libraries(app dlib::dlib)
#find packages
find_package(OpenCV QUIET)
find_package(HDF5 REQUIRED COMPONENTS C CXX)
find_package(SDL2 REQUIRED)
set(CMAKE_PREFIX_PATH "libtorch/share/cmake/Torch")#Copied thefrom example!
find_package(Torch REQUIRED)#Copied thefrom example!
#includes dirs
include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(${HDF5_INCLUDE_DIRS})
include_directories(${SDL2_INCLUDE_DIRS})
include_directories(${Torch_INCLUDE_DIRS})#I just included that in order to fix the bug,there wasn't at the official  example
#target link libraries
target_link_libraries(app dlib::dlib ${OpenCV_LIBS})
target_link_libraries(app dlib::dlib ${HDF5_CXX_LIBRARIES} ${HDF5_LIBRARIES} )
target_link_libraries(app ${SDL2_LIBRARIES})
target_link_libraries(app "${TORCH_LIBRARIES}"  )#Copied thefrom example!
set_property(TARGET app PROPERTY CXX_STANDARD 11)#Copied thefrom example!	
```
* In both example and project, I used the same command use the CMake:
```
sudo cmake -DCMAKE_PREFIX_PATH=../libtorch .. && make
```
* I mention also that I copied the whole "libtorch" folder in another path,in order to be in the same folder with each project's source files.Despite the fact that this copy is meaningless, I don't think its the reason for the wrong compilation.
<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior

<!-- A clear and concise description of what you expected to happen. -->

## Environment
* PyTorch version: 1.1.0
* Is debug build: No
* CUDA used to build PyTorch: 9.0.176

* OS: Ubuntu 16.04.6 LTS
* GCC version: (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
* CMake version: version 3.5.1

* Python version: 3.6
* Is CUDA available: No
* CUDA runtime version: 7.5.17
* GPU models and configuration: Could not collect
* Nvidia driver version: Could not collect
* cuDNN version: /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcudnn.so.7


* [pip3] numpy==1.15.4
* [pip3] numpydoc==0.8.0
* [pip3] torch==1.1.0
* [pip3] torchsummary==1.5.1
* [pip3] torchvision==0.3.0
* [conda] blas                      1.0                         mkl  
* [conda] mkl                       2019.1                      144  
* [conda] mkl-service               1.1.2            py36he904b0f_5  
* [conda] mkl_fft                   1.0.10           py36ha843d7b_0  
* [conda] mkl_random                1.0.2            py36hd81dba3_0  
* [conda] torch                     1.1.0                     <pip>
* [conda] torchsummary              1.5.1                     <pip>
* [conda] torchvision               0.3.0                     <pip>

## EDIT
* I have found a temporary solution to avoid this error.However,it should be fixed normaly.
* I edited the **"CMakeFiles/<target_name>.dir/build.make** created by the CMake.I put in comments the targets that caused this error.In my project i put in comments the following
```
#app: libtorch/lib/libc10.so
```
* This process is done every time you run the cmake command.