diff --git a/tensorflow/tools/ci_build/pi/build_raspberry_pi.sh b/tensorflow/tools/ci_build/pi/build_raspberry_pi.sh index 0343efa3b74..b3bb368173f 100755 --- a/tensorflow/tools/ci_build/pi/build_raspberry_pi.sh +++ b/tensorflow/tools/ci_build/pi/build_raspberry_pi.sh @@ -50,34 +50,34 @@ fi WORKSPACE_PATH=`pwd` -# Build the OpenBLAS library, which is faster than Eigen on the Pi Zero/One. -# TODO(petewarden) - It would be nicer to move this into the main Bazel build -# process if we can maintain a build file for this. -TOOLCHAIN_INSTALL_PATH=/tmp/toolchain_install/ -sudo rm -rf ${TOOLCHAIN_INSTALL_PATH} -mkdir ${TOOLCHAIN_INSTALL_PATH} -cd ${TOOLCHAIN_INSTALL_PATH} -curl -L https://github.com/rvagg/rpi-newer-crosstools/archive/eb68350c5c8ec1663b7fe52c742ac4271e3217c5.tar.gz -o toolchain.tar.gz -tar xzf toolchain.tar.gz -mv rpi-newer-crosstools-eb68350c5c8ec1663b7fe52c742ac4271e3217c5 tools - -CROSSTOOL_CC=${TOOLCHAIN_INSTALL_PATH}/tools/x64-gcc-6.5.0/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-gcc - -OPENBLAS_SRC_PATH=/tmp/openblas_src/ -sudo rm -rf ${OPENBLAS_SRC_PATH} -git clone https://github.com/xianyi/OpenBLAS ${OPENBLAS_SRC_PATH} -cd ${OPENBLAS_SRC_PATH} -# The commit after this introduced Fortran compile issues. In theory they should -# be solvable using NOFORTRAN=1 on the make command, but my initial tries didn't -# work, so pinning to the last know good version. -git checkout 5a6a2bed9aff0ba8a18651d5514d029c8cae336a -# If this path is changed, you'll also need to update -# cxx_builtin_include_directory in third_party/toolchains/cpus/arm/CROSSTOOL.tpl -OPENBLAS_INSTALL_PATH=/tmp/openblas_install/ -make CC=${CROSSTOOL_CC} FC=${CROSSTOOL_CC} HOSTCC=gcc TARGET=ARMV6 -make PREFIX=${OPENBLAS_INSTALL_PATH} install - if [[ $1 == "PI_ONE" ]]; then + # Build the OpenBLAS library, which is faster than Eigen on the Pi Zero/One. + # TODO(petewarden) - It would be nicer to move this into the main Bazel build + # process if we can maintain a build file for this. + TOOLCHAIN_INSTALL_PATH=/tmp/toolchain_install/ + sudo rm -rf ${TOOLCHAIN_INSTALL_PATH} + mkdir ${TOOLCHAIN_INSTALL_PATH} + cd ${TOOLCHAIN_INSTALL_PATH} + curl -L https://github.com/rvagg/rpi-newer-crosstools/archive/eb68350c5c8ec1663b7fe52c742ac4271e3217c5.tar.gz -o toolchain.tar.gz + tar xzf toolchain.tar.gz + mv rpi-newer-crosstools-eb68350c5c8ec1663b7fe52c742ac4271e3217c5 tools + + CROSSTOOL_CC=${TOOLCHAIN_INSTALL_PATH}/tools/x64-gcc-6.5.0/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-gcc + + OPENBLAS_SRC_PATH=/tmp/openblas_src/ + sudo rm -rf ${OPENBLAS_SRC_PATH} + git clone https://github.com/xianyi/OpenBLAS ${OPENBLAS_SRC_PATH} + cd ${OPENBLAS_SRC_PATH} + # The commit after this introduced Fortran compile issues. In theory they should + # be solvable using NOFORTRAN=1 on the make command, but my initial tries didn't + # work, so pinning to the last know good version. + git checkout 5a6a2bed9aff0ba8a18651d5514d029c8cae336a + # If this path is changed, you'll also need to update + # cxx_builtin_include_directory in third_party/toolchains/cpus/arm/CROSSTOOL.tpl + OPENBLAS_INSTALL_PATH=/tmp/openblas_install/ + make CC=${CROSSTOOL_CC} FC=${CROSSTOOL_CC} HOSTCC=gcc TARGET=ARMV6 + make PREFIX=${OPENBLAS_INSTALL_PATH} install + PI_COPTS="--copt=-march=armv6 --copt=-mfpu=vfp --copt=-DUSE_GEMM_FOR_CONV --copt=-DUSE_OPENBLAS --copt=-isystem --copt=${OPENBLAS_INSTALL_PATH}/include/ diff --git a/third_party/toolchains/cpus/arm/cc_config.bzl.tpl b/third_party/toolchains/cpus/arm/cc_config.bzl.tpl index 6c68660a162..f6981490b8d 100644 --- a/third_party/toolchains/cpus/arm/cc_config.bzl.tpl +++ b/third_party/toolchains/cpus/arm/cc_config.bzl.tpl @@ -347,15 +347,17 @@ def _impl(ctx): flags = [ "-std=c++11", "-isystem", - "%{ARM_COMPILER_PATH}%/lib/gcc/arm-rpi-linux-gnueabihf/6.5.0/include", + "%{ARM_COMPILER_PATH}%/lib/gcc/arm-rpi-linux-gnueabihf/6.5.0/include", "-isystem", "%{ARM_COMPILER_PATH}%/lib/gcc/arm-rpi-linux-gnueabihf/6.5.0/include-fixed", "-isystem", + "%{ARM_COMPILER_PATH}%/arm-rpi-linux-gnueabihf/include/c++/6.5.0/", + "-isystem", "%{ARM_COMPILER_PATH}%/arm-rpi-linux-gnueabihf/sysroot/usr/include/", "-isystem", - "%{ARM_COMPILER_PATH}%/arm-rpi-linux-gnueabihf/include/c++/6.5.0/", - "-isystem", "%{PYTHON_INCLUDE_PATH}%", + "-isystem", + "/usr/include/", ], ), ],