Making a pytorch wheel for armv7

username: roland
cooked: <p>I have a Raspberry Pi Compute Module 3 and would like to run pytorch (cpu only) on it. I tried following <a href="https://wormtooth.com/20180617-pytorch-on-raspberrypi/" rel="nofollow noopener">this guide</a>, but I don’t have enough space left on the device to increase the swap, so the compiling just freezes along the way…<br>
But I had an idea of building a pytorch wheel made for arm. I downloaded the <a href="https://github.com/raspberrypi/tools" rel="nofollow noopener">rpi toolchain</a> and set the compiler flag to</p>
<p><code>export CC="/home/me/gits/rpi_tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc"</code></p>
<p>I also set cuda and no distributed to false</p>
<pre><code class="lang-auto">export NO_CUDA=1
export NO_DISTRIBUTED=1
</code></pre>
<p>but when I tried running</p>
<p><code>python3 setup.py sdist bdist_wheel</code></p>
<p>I got gcc error saying</p>
<pre><code class="lang-auto">warning: check: missing required meta-data: url

warning: check: missing meta-data: either (author and author_email) or (maintainer and maintainer_email) must be supplied

+ USE_CUDA=0
+ USE_ROCM=0
+ USE_NNPACK=0
+ USE_MKLDNN=0
+ USE_GLOO_IBVERBS=0
+ USE_DISTRIBUTED_MW=0
+ FULL_CAFFE2=0
+ [[ 4 -gt 0 ]]
+ case "$1" in
+ USE_NNPACK=1
+ shift
+ [[ 3 -gt 0 ]]
+ case "$1" in
+ break
+ CMAKE_INSTALL='make install'
+ USER_CFLAGS=
+ USER_LDFLAGS=
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
++ uname
+ '[' Linux == Darwin ']'
++ dirname tools/build_pytorch_libs.sh
+ cd tools/..
+++ pwd
++ printf '%q\n' /home/me/gits/pytorch
+ PWD=/home/me/gits/pytorch
+ BASE_DIR=/home/me/gits/pytorch
+ TORCH_LIB_DIR=/home/me/gits/pytorch/torch/lib
+ INSTALL_DIR=/home/me/gits/pytorch/torch/lib/tmp_install
+ THIRD_PARTY_DIR=/home/me/gits/pytorch/third_party
+ CMAKE_VERSION=cmake
+ C_FLAGS=' -I"/home/me/gits/pytorch/torch/lib/tmp_install/include"   -I"/home/me/gits/pytorch/torch/lib/tmp_install/include/TH" -I"/home/me/gits/pytorch/torch/lib/tmp_install/include/THC"   -I"/home/me/gits/pytorch/torch/lib/tmp_install/include/THS" -I"/home/me/gits/pytorch/torch/lib/tmp_install/include/THCS"   -I"/home/me/gits/pytorch/torch/lib/tmp_install/include/THNN" -I"/home/me/gits/pytorch/torch/lib/tmp_install/include/THCUNN"'
+ C_FLAGS=' -I"/home/me/gits/pytorch/torch/lib/tmp_install/include"   -I"/home/me/gits/pytorch/torch/lib/tmp_install/include/TH" -I"/home/me/gits/pytorch/torch/lib/tmp_install/include/THC"   -I"/home/me/gits/pytorch/torch/lib/tmp_install/include/THS" -I"/home/me/gits/pytorch/torch/lib/tmp_install/include/THCS"   -I"/home/me/gits/pytorch/torch/lib/tmp_install/include/THNN" -I"/home/me/gits/pytorch/torch/lib/tmp_install/include/THCUNN" -DOMPI_SKIP_MPICXX=1'
+ LDFLAGS='-L"/home/me/gits/pytorch/torch/lib/tmp_install/lib" '
+ LD_POSTFIX=.so
++ uname
+ [[ Linux == \D\a\r\w\i\n ]]
+ LDFLAGS='-L"/home/me/gits/pytorch/torch/lib/tmp_install/lib"  -Wl,-rpath,$ORIGIN'
+ CPP_FLAGS=' -std=c++11 '
+ GLOO_FLAGS=
+ THD_FLAGS=
+ NCCL_ROOT_DIR=/home/me/gits/pytorch/torch/lib/tmp_install
+ [[ 0 -eq 1 ]]
+ [[ 0 -eq 1 ]]
+ [[ 0 -eq 1 ]]
+ CWRAP_FILES='/home/me/gits/pytorch/torch/lib/ATen/Declarations.cwrap;/home/me/gits/pytorch/torch/lib/THNN/generic/THNN.h;/home/me/gits/pytorch/torch/lib/THCUNN/generic/THCUNN.h;/home/me/gits/pytorch/torch/lib/ATen/nn.yaml'
+ CUDA_NVCC_FLAGS=' -I"/home/me/gits/pytorch/torch/lib/tmp_install/include"   -I"/home/me/gits/pytorch/torch/lib/tmp_install/include/TH" -I"/home/me/gits/pytorch/torch/lib/tmp_install/include/THC"   -I"/home/me/gits/pytorch/torch/lib/tmp_install/include/THS" -I"/home/me/gits/pytorch/torch/lib/tmp_install/include/THCS"   -I"/home/me/gits/pytorch/torch/lib/tmp_install/include/THNN" -I"/home/me/gits/pytorch/torch/lib/tmp_install/include/THCUNN" -DOMPI_SKIP_MPICXX=1'
+ [[ -z '' ]]
+ CUDA_DEVICE_DEBUG=0
+ '[' -z 8 ']'
+ BUILD_TYPE=Release
+ [[ -n '' ]]
+ [[ -n '' ]]
+ echo 'Building in Release mode'
+ mkdir -p torch/lib/tmp_install
+ for arg in "$@"
+ [[ caffe2 == \n\c\c\l ]]
+ [[ caffe2 == \g\l\o\o ]]
+ [[ caffe2 == \c\a\f\f\e\2 ]]
+ pushd /home/me/gits/pytorch
+ build_caffe2
+ [[ -z '' ]]
+ EXTRA_CAFFE2_CMAKE_FLAGS=()
+ [[ -n '' ]]
+ [[ -n /usr/lib/python3/dist-packages ]]
+ EXTRA_CAFFE2_CMAKE_FLAGS+=("-DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH")
+ mkdir -p build
+ pushd build
+ cmake .. -DBUILDING_WITH_TORCH_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_CAFFE2=0 -DBUILD_ATEN=ON -DBUILD_PYTHON=0 -DBUILD_BINARY=OFF -DBUILD_SHARED_LIBS=ON -DONNX_NAMESPACE=onnx_torch -DUSE_CUDA=0 -DCAFFE2_STATIC_LINK_CUDA= -DUSE_ROCM=0 -DUSE_NNPACK=1 -DCUDNN_INCLUDE_DIR= -DCUDNN_LIB_DIR= -DCUDNN_LIBRARY= -DUSE_MKLDNN=0 -DMKLDNN_INCLUDE_DIR= -DMKLDNN_LIB_DIR= -DMKLDNN_LIBRARY= -DCMAKE_INSTALL_PREFIX=/home/me/gits/pytorch/torch/lib/tmp_install -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_C_FLAGS= -DCMAKE_CXX_FLAGS= '-DCMAKE_EXE_LINKER_FLAGS=-L"/home/me/gits/pytorch/torch/lib/tmp_install/lib"  -Wl,-rpath,$ORIGIN ' '-DCMAKE_SHARED_LINKER_FLAGS=-L"/home/me/gits/pytorch/torch/lib/tmp_install/lib"  -Wl,-rpath,$ORIGIN ' -DCMAKE_PREFIX_PATH=/usr/lib/python3/dist-packages
CMake Error at cmake/MiscCheck.cmake:29 (message):
  Please use GCC 6 or higher on Ubuntu 17.04 and higher.  For more
  information, see: https://github.com/caffe2/caffe2/issues/1633
Call Stack (most recent call first):
  CMakeLists.txt:172 (include)
</code></pre>
<p>Gcc version of the selected toolchain is</p>
<pre><code class="lang-auto">$ cc --version
arm-bcm2708-linux-gnueabi-gcc (crosstool-NG 1.15.2) 4.7.1 20120402 (prerelease)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
</code></pre>
<p>What am I doing wrong?</p>

username: Mr-AniP
cooked: <p>You need to update gcc from 4.7.1 to a higher version (above 6).</p>
<p>Read the Error</p>