PaddlePaddle / Paddle

PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器学习高性能单机、分布式训练和跨平台部署)
http://www.paddlepaddle.org/
Apache License 2.0
22.26k stars 5.6k forks source link

archlinux下安装出错 #44711

Open Seele-Vollerei32 opened 2 years ago

Seele-Vollerei32 commented 2 years ago

问题描述 Issue Description

使用ABS构建CPU型paddle时报错


/home/kevin/python-paddlepaddle/src/build/third_party/gloo/src/extern_gloo/gloo/transport/tcp/device.cc:152:39: 错误:聚合‘std::array<char, 64> hostname’类型不完全,无法被定义
  152 |       std::array<char, HOST_NAME_MAX> hostname;
      |                                       ^~~~~~~~
make[5]: *** [gloo/CMakeFiles/gloo.dir/build.make:496:gloo/CMakeFiles/gloo.dir/transport/tcp/device.cc.o] 错误 1
make[5]: 离开目录“/home/kevin/python-paddlepaddle/src/build/third_party/gloo/src/extern_gloo/build”
make[4]: *** [CMakeFiles/Makefile2:184:gloo/CMakeFiles/gloo.dir/all] 错误 2
make[4]: 离开目录“/home/kevin/python-paddlepaddle/src/build/third_party/gloo/src/extern_gloo/build”
make[3]: *** [Makefile:136:all] 错误 2
make[3]: 离开目录“/home/kevin/python-paddlepaddle/src/build/third_party/gloo/src/extern_gloo/build”
make[2]: *** [CMakeFiles/extern_gloo.dir/build.make:86:third_party/gloo/src/extern_gloo-stamp/extern_gloo-build] 错误 2
make[2]: 离开目录“/home/kevin/python-paddlepaddle/src/build”
make[1]: *** [CMakeFiles/Makefile2:4948:CMakeFiles/extern_gloo.dir/all] 错误 2
make[1]: 离开目录“/home/kevin/python-paddlepaddle/src/build”
make: *** [Makefile:136:all] 错误 2
make: 离开目录“/home/kevin/python-paddlepaddle/src/build”
==> 错误: 在 build() 中发生一个错误。
    正在放弃...

### 版本&环境信息 Version & Environment Information

PaddlePaddle: 2.3.1
CPU: Intel-CORE i5 8265U
GPU: 无
system: Arch Linux 5.18.14-zen1-1-zen
python: 3.10
PKGBUILD:
``` # cuda 11 supports Pascal, Volta,Turing, Ampere
# see also https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards
# adjust this list according to your target device
_CUDA_ARCH_LIST="60;61;62;70;72;75;80;86;86+PTX"
_pkgname=Paddle
pkgname=('python-paddlepaddle' 'python-paddlepaddle-cuda')
pkgver=2.3.1
pkgrel=1
pkgdesc='PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice'
provides=(paddlepaddle)
conflicts=(paddlepaddle-gpu)
arch=('x86_64')
url='http://www.paddlepaddle.org'
license=('Apache2.0')
depends=(
  blas
  python-astor
  python-decorator
  python-numpy
  python-pillow
  python-protobuf
  python-requests
  python-six
)
makedepends=(
  cmake
  git
  patchelf
  python-pip
  python-setuptools
  python-wheel
  swig
  wget
)
source=("${_pkgname}::git+https://github.com/PaddlePaddle/Paddle.git#tag=v${pkgver}")
sha512sums=('SKIP')

get_pyver() {
  python -c 'import sys; print(str(sys.version_info[0]) + "." + str(sys.version_info[1]))'
}

prepare() {
  # improve the file descriptors limit to avoid "Too many open files" error
  ulimit -n 4096
  # use the same version of system's protobuf
  # always check https://github.com/PaddlePaddle/Paddle/blob/v2.2.1/cmake/external/protobuf.cmake
  # to make sure which protobuf git commit is used
  # if you set other config that might affect this
  _protobuf_version=$(protoc --version|cut -f 2 -d ' ')
  sed -i "s,9f75c5aa851cd877fb0d93ccc31b8567a6706546,v${_protobuf_version}," "${_pkgname}/cmake/external/protobuf.cmake"
  # set CUDA_HOME for dgc building
  sed -i 's,BUILD_COMMAND make -j $(nproc),BUILD_COMMAND make CUDA_HOME=/opt/cuda,' "${_pkgname}/cmake/external/dgc.cmake"
  # fix std::move error, see also https://github.com/PaddlePaddle/Paddle/issues/26878
  find "${_pkgname}" -type f -name CMakeLists.txt -exec sed -i -e '$aset(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=pessimizing-move")' {} \;
  # fix range-loop-construct
  find "${_pkgname}" -type f -name CMakeLists.txt -exec sed -i -e '$aset(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=range-loop-construct")' {} \;
  # fix #include <cstddef>
  sed -i 's,#include <cstdint>,#include <cstdint>\n#include <cstddef>,' "${_pkgname}/paddle/fluid/memory/detail/memory_block.h"
}

build() {
  # WITH_DISTRIBUTE=ON is not working now
  # maybe we could build it with gcc 8
  # for more related issue, report it to upstream
  cmake_opts=(
    -DCMAKE_INSTALL_PREFIX=/usr
    -DCMAKE_SKIP_INSTALL_RPATH=ON
    -DWITH_AVX=ON
    -DWITH_DISTRIBUTE=OFF
    -DWITH_MKL=OFF
    -DWITH_PYTHON=ON
    -DWITH_SYSTEM_BLAS=ON
    -DWITH_TESTING=OFF
)

  # building without CUDA
  cmake -B "${srcdir}/build" \
    -S "${srcdir}/${_pkgname}" \
    ${cmake_opts[@]} \
    -DWITH_GPU=OFF
  make -C "${srcdir}/build"
}

package_python-paddlepaddle() {
  PIP_CONFIG_FILE=/dev/null find "${srcdir}/build" -type f -name "*.whl" -exec pip install --isolated --root="${pkgdir}" --ignore-installed --no-deps {} \;
  python -O -m compileall "${pkgdir}"
  # remove unneeded libs
  rm -rfv "${pkgdir}/usr/lib/python$(get_pyver)/site-packages/paddle/libs"
  rm -vf ${pkgdir}/usr/lib/python$(get_pyver)/site-packages/_foo.*
  # remove rpath
  find "${pkgdir}/usr/lib" -type f -name "*.so" -exec patchelf --remove-rpath {} \;
}
Seele-Vollerei32 commented 2 years ago

在此issue中发现类似情况和可能解决方法