Repository: pytorch
Issue: Build link not right
Labels: module: build,module: cpp,triaged

I am using CUDA10.1 so that I build libtorch from source, but after building, used I just need replace `lib` with official libtorch downloaded and everything can works.

From libtorch-nightly begain,  I can not do this anymore, the lib generates always link to my another folder where it builds:

```
	linux-vdso.so.1 =>  (0x00007fffb5518000)
	libcudart.so.10.1 => /usr/local/cuda/lib64/libcudart.so.10.1 (0x00007f8a33ac5000)
	libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f8a338a3000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8a33686000)
	libmpi_cxx.so.1 => /usr/lib/libmpi_cxx.so.1 (0x00007f8a3346b000)
	libmpi.so.12 => /usr/lib/libmpi.so.12 (0x00007f8a33195000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f8a32f8d000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f8a32d77000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8a32b73000)
	libopenblas.so.0 => /usr/lib/libopenblas.so.0 (0x00007f8a30adf000)
	libc10_cuda.so => /media/fagangjin/wd/permanent/software/source_codes/dl/pytorch/build_libtorch/build/lib/libc10_cuda.so (0x00007f8a308b3000)
	libnvToolsExt.so.1 => /usr/local/cuda/lib64/libnvToolsExt.so.1 (0x00007f8a306aa000)
	libcusparse.so.10 => /usr/local/cuda/lib64/libcusparse.so.10 (0x00007f8a29423000)
	libcurand.so.10 => /usr/local/cuda/lib64/libcurand.so.10 (0x00007f8a253c2000)
	libcudnn.so.7 => /usr/local/cuda/lib64/libcudnn.so.7 (0x00007f8a0b21c000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8a0af13000)
	libc10.so => /media/fagangjin/wd/permanent/software/source_codes/dl/pytorch/build_libtorch/build/lib/libc10.so (0x00007f8a0accc000)
	libcufft.so.10 => /usr/local/cuda/lib64/libcufft.so.10 (0x00007f8a02692000)
	libcublas.so.10 => /usr/lib/x86_64-linux-gnu/libcublas.so.10 (0x00007f89fe8f7000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f89fe575000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f89fe1ab000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f8a4adda000)
	libibverbs.so.1 => /usr/lib/libibverbs.so.1 (0x00007f89fdf9c000)
	libopen-rte.so.12 => /usr/lib/libopen-rte.so.12 (0x00007f89fdd22000)
	libopen-pal.so.13 => /usr/lib/libopen-pal.so.13 (0x00007f89fda85000)
	libgfortran.so.3 => /usr/lib/x86_64-linux-gnu/libgfortran.so.3 (0x00007f89fd75a000)
	libnuma.so.1 => /usr/lib/x86_64-linux-gnu/libnuma.so.1 (0x00007f89fd54f000)
	libcublasLt.so.10 => /usr/lib/x86_64-linux-gnu/libcublasLt.so.10 (0x00007f89fb6ab000)
	libhwloc.so.5 => /usr/lib/x86_64-linux-gnu/libhwloc.so.5 (0x00007f89fb471000)
	libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f89fb26e000)
	libquadmath.so.0 => /usr/lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007f89fb02f000)
	libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007f89fae25000)

```

And when I build libtorch program, it just can not found related functions:

```
human_pose_estimator.cc:(.text+0x177): undefined reference to `c10::CPUTensorId()'
human_pose_estimator.cc:(.text+0x1a9): undefined reference to `c10::CUDATensorId()'
human_pose_estimator.cc:(.text+0x1db): undefined reference to `c10::HIPTensorId()'
human_pose_estimator.cc:(.text+0x20d): undefined reference to `c10::MSNPUTensorId()'
human_pose_estimator.cc:(.text+0x23f): undefined reference to `c10::XLATensorId()'
human_pose_estimator.cc:(.text+0x271): undefined reference to `c10::SparseCPUTensorId()'
human_pose_estimator.cc:(.text+0x2a3): undefined reference to `c10::SparseCUDATensorId()'
human_pose_estimator.cc:(.text+0x2d5): undefined reference to `c10::SparseHIPTensorId()'
human_pose_estimator.cc:(.text+0x307): undefined reference to `c10::MkldnnCPUTensorId()'
human_pose_estimator.cc:(.text+0x339): undefined reference to `c10::QuantizedCPUTensorId()'
human_pose_estimator.cc:(.text+0x36b): undefined reference to `c10::ComplexCPUTensorId()'
human_pose_estimator.cc:(.text+0x39d): undefined reference to `c10::ComplexCUDATensorId()'
human_pose_estimator.cc:(.text+0x3cf): undefined reference to `c10::UndefinedTensorId()'
CMakeFiles/light_pose_estimate.dir/src/human_pose_estimator.cc.o: In function `c10::TensorOptions::computeTensorTypeId() const':
human_pose_estimator.cc:(.text._ZNK3c1013TensorOptions19computeTensorTypeIdEv[_ZNK3c1013TensorOptions19computeTensorTypeIdEv]+0xa9): undefined reference to `c10::ComplexCPUTensorId()'
human_pose_estimator.cc:(.text._ZNK3c1013TensorOptions19computeTensorTypeIdEv[_ZNK3c1013TensorOptions19computeTensorTypeIdEv]+0xd5): undefined reference to `c10::QuantizedCPUTensorId()'
human_pose_estimator.cc:(.text._ZNK3c1013TensorOptions19computeTensorTypeIdEv[_ZNK3c1013TensorOptions19computeTensorTypeIdEv]+0xdf): undefined reference to `c10::CPUTensorId()'
human_pose_estimator.cc:(.text._ZNK3c1013TensorOptions19computeTensorTypeIdEv[_ZNK3c1013TensorOptions19computeTensorTypeIdEv]+0x10b): undefined reference to `c10::ComplexCUDATensorId()'
human_pose_estimator.cc:(.text._ZNK3c1013TensorOptions19computeTensorTypeIdEv[_ZNK3c1013TensorOptions19computeTensorTypeIdEv]+0x115): undefined reference to `c10::CUDATensorId()'
human_pose_estimator.cc:(.text._ZNK3c1013TensorOptions19computeTensorTypeIdEv[_ZNK3c1013TensorOptions19computeTensorTypeIdEv]+0x11f): undefined reference to `c10::MKLDNNTensorId()'
human_pose_estimator.cc:(.text._ZNK3c1013TensorOptions19computeTensorTypeIdEv[_ZNK3c1013TensorOptions19computeTensorTypeIdEv]+0x129): undefined reference to `c10::OpenGLTensorId()'
human_pose_estimator.cc:(.text._ZNK3c1013TensorOptions19computeTensorTypeIdEv[_ZNK3c1013TensorOptions19computeTensorTypeIdEv]+0x133): undefined reference to `c10::OpenCLTensorId()'
human_pose_estimator.cc:(.text._ZNK3c1013TensorOptions19computeTensorTypeIdEv[_ZNK3c1013TensorOptions19computeTensorTypeIdEv]+0x13d): undefined reference to `c10::IDEEPTensorId()'
human_pose_estimator.cc:(.text._ZNK3c1013TensorOptions19computeTensorTypeIdEv[_ZNK3c1013TensorOptions19computeTensorTypeIdEv]+0x147): undefined reference to `c10::HIPTensorId()'
human_pose_estimator.cc:(.text._ZNK3c1013TensorOptions19computeTensorTypeIdEv[_ZNK3c1013TensorOptions19computeTensorTypeIdEv]+0x151): undefined reference to `c10::MSNPUTensorId()'
human_pose_estimator.cc:(.text._ZNK3c1013TensorOptions19computeTensorTypeIdEv[_ZNK3c1013TensorOptions19computeTensorTypeIdEv]+0x15b): undefined reference to `c10::XLATensorId()'
human_pose_estimator.cc:(.text._ZNK3c1013TensorOptions19computeTensorTypeIdEv[_ZNK3c1013TensorOptions19computeTensorTypeIdEv]+0x2e3): undefined reference to `c10::SparseCPUTensorId()'
human_pose_estimator.cc:(.text._ZNK3c1013TensorOptions19computeTensorTypeIdEv[_ZNK3c1013TensorOptions19computeTensorTypeIdEv]+0x2ed): undefined reference to `c10::SparseCUDATensorId()'
human_pose_estimator.cc:(.text._ZNK3c1013TensorOptions19computeTensorTypeIdEv[_ZNK3c1013TensorOptions19computeTensorTypeIdEv]+0x2f7): undefined reference to `c10::SparseHIPTensorId()'
human_pose_estimator.cc:(.text._ZNK3c1013TensorOptions19computeTensorTypeIdEv[_ZNK3c1013TensorOptions19computeTensorTypeIdEv]+0x473): undefined reference to `c10::MkldnnCPUTensorId()'

```



What should I do??? I can not build it aganst CUDA10.1

```