Compiling PyTorch from Source on Xavier
Labels: module: build, triaged, module: vectorization

### 🐛 Describe the bug

My device: Xavier (JetPack 4.6.2)

I want pytorch 1.10.0 with python 3.7 upper version.

I try on python 3.8.
But build compile end with error.
```ninja: build stopped: subcommand failed.```

I think main issue is,

```
immintrin.h: No such file or directory
unrecognized command line option ‘-mavx’ ‘-mavx2’ ‘-mfma’ ‘-mavx512f’ ‘-mavx512dq’ ‘-mavx512vl’ ‘-mavx512bw’ ‘-mvsx’
arch:AVX AVX2 AVX512: No such file or directory

c++: error: unrecognized command line option '-Wshorten-64-to-32'
c++: error: unrecognized command line option '-wd654'
c++: error: unrecognized command line option '-Wthread-safety'; did you mean '-fthread-jumps'?

src.c:6:9: error: impossible constraint in ‘asm’
CheckSymbolExists.c:8:19: error: ‘strtod_l’ undeclared

cc1plus: error: -Werror=cast-function-type: no option -Wcast-function-type
```

Details,  
[CMakeError.log](https://github.com/pytorch/pytorch/files/10729782/CMakeError.log)
how i can fix it?

I refer to https://forums.developer.nvidia.com/t/pytorch-for-jetson/72048.

### Error logs

Building wheel torch-1.10.0a0+git36449ea
-- Building version 1.10.0a0+git36449ea
cmake --build . --target install --config Release -- -j 8
[14/383] Building NVCC (Device) object...orch_cuda_generated_SegmentReduce.cu.o
/home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/cuda/SegmentReduce.cu: In lambda function:
/home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/cuda/SegmentReduce.cu:54:51: warning: ‘at::DeprecatedTypeProperties& at::Tensor::type() const’ is deprecated: Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replacement. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations]
   AT_DISPATCH_INDEX_TYPES(
                                                   ^
/home/ai/Desktop/yjoh/git/pytorch/build/aten/src/ATen/core/TensorBody.h:194:1: note: declared here
   DeprecatedTypeProperties & type() const {
 ^ ~~
/home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/cuda/SegmentReduce.cu:54:112: warning: ‘c10::ScalarType detail::scalar_type(const at::DeprecatedTypeProperties&)’ is deprecated: passing at::DeprecatedTypeProperties to an AT_DISPATCH macro is deprecated, pass an at::ScalarType instead [-Wdeprecated-declarations]
   AT_DISPATCH_INDEX_TYPES(
                                                                                                                ^
/home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/Dispatch.h:176:1: note: declared here
 inline at::ScalarType scalar_type(const at::DeprecatedTypeProperties& t) {
 ^~~~~~~~~~~
/home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/cuda/SegmentReduce.cu: In lambda function:
/home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/cuda/SegmentReduce.cu:231:58: warning: ‘at::DeprecatedTypeProperties& at::Tensor::type() const’ is deprecated: Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replacement. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations]
   AT_DISPATCH_INDEX_TYPES(
                                                          ^
/home/ai/Desktop/yjoh/git/pytorch/build/aten/src/ATen/core/TensorBody.h:194:1: note: declared here
   DeprecatedTypeProperties & type() const {
 ^ ~~
/home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/cuda/SegmentReduce.cu:231:119: warning: ‘c10::ScalarType detail::scalar_type(const at::DeprecatedTypeProperties&)’ is deprecated: passing at::DeprecatedTypeProperties to an AT_DISPATCH macro is deprecated, pass an at::ScalarType instead [-Wdeprecated-declarations]
   AT_DISPATCH_INDEX_TYPES(
                                                                                                                       ^
/home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/Dispatch.h:176:1: note: declared here
 inline at::ScalarType scalar_type(const at::DeprecatedTypeProperties& t) {
 ^~~~~~~~~~~
/home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/cuda/SegmentReduce.cu: In lambda function:
/home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/cuda/SegmentReduce.cu:291:51: warning: ‘at::DeprecatedTypeProperties& at::Tensor::type() const’ is deprecated: Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replacement. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations]
   AT_DISPATCH_INDEX_TYPES(
                                                   ^
/home/ai/Desktop/yjoh/git/pytorch/build/aten/src/ATen/core/TensorBody.h:194:1: note: declared here
   DeprecatedTypeProperties & type() const {
 ^ ~~
/home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/cuda/SegmentReduce.cu:291:112: warning: ‘c10::ScalarType detail::scalar_type(const at::DeprecatedTypeProperties&)’ is deprecated: passing at::DeprecatedTypeProperties to an AT_DISPATCH macro is deprecated, pass an at::ScalarType instead [-Wdeprecated-declarations]
   AT_DISPATCH_INDEX_TYPES(
                                                                                                                ^
/home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/Dispatch.h:176:1: note: declared here
 inline at::ScalarType scalar_type(const at::DeprecatedTypeProperties& t) {
 ^~~~~~~~~~~
[51/383] Building NVCC (Device) object...cuda/torch_cuda_generated_SoftMax.cu.o
/home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/sparse/cuda/SoftMax.cu: In function ‘at::Tensor at::native::_GLOBAL__N__42_tmpxft_000014a5_00000000_6_SoftMax_cpp1_ii_75209b9c::get_offsets(const at::Tensor&, const IntArrayRef&, int64_t)’:
/home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/sparse/cuda/SoftMax.cu:240:69: warning: ‘at::GenericPackedTensorAccessor<T, N, PtrTraits, index_t> at::Tensor::packed_accessor() const & [with T = long int; long unsigned int N = 2; PtrTraits = at::DefaultPtrTraits; index_t = long int]’ is deprecated: packed_accessor is deprecated, use packed_accessor32 or packed_accessor64 instead [-Wdeprecated-declarations]
   auto indices_accessor = indices.packed_accessor<int64_t, 2>();
                                                                     ^
/home/ai/Desktop/yjoh/git/pytorch/build/aten/src/ATen/core/TensorBody.h:228:1: note: declared here
   GenericPackedTensorAccessor<T,N,PtrTraits,index_t> packed_accessor() const & {
 ^ ~~~~~~~~~~~~~

.....

../torch/csrc/jit/python/init.cpp: In lambda function:
../torch/csrc/jit/python/init.cpp:492:30: error: cannot bind non-const lvalue reference of type ‘pybind11::detail::accessor<pybind11::detail::accessor_policies::sequence_item>&’ to an rvalue of type ‘pybind11::detail::generic_iterator<pybind11::detail::iterator_policies::sequence_slow_readwrite>::reference {aka pybind11::detail::accessor<pybind11::detail::accessor_policies::sequence_item>}’
             for (auto& obj : inputs) {
                              ^~~~~~
ninja: build stopped: subcommand failed.


### Minified repro

_No response_

### Versions

git clone --recursive --branch v1.10.0 http://github.com/pytorch/pytorch
python3 setup.py bdist_wheel

cc @malfet @seemethere @ezyang @soumith @msaroufim @wconstab @ngimel @bdhirsh