Skip to content

Apache DataFusion SQL Query Engine

ARROW-3758: [R] Build R library and dependencies on Windows in Appveyor CI

Neal Richardson5acb022eb3e1
diff --git a/appveyor.yml b/appveyor.yml
index a4995a89e6..c5eadf6bb5 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -103,8 +103,10 @@ environment:
GO111MODULE: on
GOTOOLDIR: '%GOROOT%\pkg\tool\windows_amd64'
PATH: '%GOPATH%\bin;%GOROOT%\bin;%PATH%'
- - JOB: "R without libarrow"
+ - JOB: "R with libarrow"
USE_CLCACHE: false
+ TEST_R_WITH_ARROW: "TRUE"
+ RWINLIB_LOCAL: '%APPVEYOR_BUILD_FOLDER%\libarrow.zip'
MSVC_DEFAULT_OPTIONS: ON
APPVEYOR_SAVE_CACHE_ON_ERROR: true
@@ -126,7 +128,7 @@ for:
-
matrix:
only:
- - JOB: "R without libarrow"
+ - JOB: "R with libarrow"
init:
ps: |
$ErrorActionPreference = "Stop"
@@ -139,9 +141,9 @@ for:
- cd %APPVEYOR_BUILD_FOLDER%
build_script:
- # TODO: for the version of the R tests that builds, probably can't use this
- # ci script because we need to build with the Rtools toolchain
- # - call ci\appveyor-build.bat
+ - rmdir /s /Q C:\OpenSSL-Win32 C:\OpenSSL-Win64
+ - C:\msys64\usr\bin\pacman --noconfirm --ask 20 --sync --refresh --refresh --sysupgrade --sysupgrade
+ - C:\msys64\usr\bin\bash --login -c "$(cygpath ${APPVEYOR_BUILD_FOLDER})/ci/appveyor-build-r.sh"
- pushd r
- travis-tool.sh install_deps
@@ -155,6 +157,12 @@ for:
NOT_CRAN: true
artifacts:
+ - path: '*.pkg.tar.xz'
+ name: binaries
+
+ - path: 'build\*.zip'
+ name: binaries
+
- path: 'r\*.Rcheck\**\*.log'
name: Logs
diff --git a/ci/PKGBUILD b/ci/PKGBUILD
new file mode 100644
index 0000000000..b760838f5e
--- /dev/null
+++ b/ci/PKGBUILD
@@ -0,0 +1,114 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+_realname=arrow
+pkgbase=mingw-w64-${_realname}
+pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
+pkgver=0.13.0.9000
+pkgrel=8000
+pkgdesc="Apache Arrow is a cross-language development platform for in-memory data (mingw-w64)"
+arch=("any")
+url="https://arrow.apache.org/"
+license=("Apache-2.0")
+depends=("${MINGW_PACKAGE_PREFIX}-boost"
+ "${MINGW_PACKAGE_PREFIX}-double-conversion"
+ "${MINGW_PACKAGE_PREFIX}-thrift"
+ "${MINGW_PACKAGE_PREFIX}-zlib")
+makedepends=("${MINGW_PACKAGE_PREFIX}-cmake"
+ "${MINGW_PACKAGE_PREFIX}-gcc")
+options=("staticlibs" "strip" "!buildflags")
+source_dir=apache-${_realname}-${pkgver}
+source=("${source_dir}"::"git+https://github.com/apache/arrow")
+sha256sums=("SKIP")
+
+cmake_build_type=release
+cpp_build_dir=build-${CARCH}-cpp
+
+pkgver() {
+ cd "$source_dir"
+ grep Version r/DESCRIPTION | cut -d " " -f 2
+}
+
+prepare() {
+ pushd ${source_dir}
+ #patch -p1 -N -i ${srcdir}/3923.patch
+ popd
+}
+
+build() {
+ ARROW_CPP_DIR="$(pwd)/${source_dir}/cpp"
+ [[ -d ${cpp_build_dir} ]] && rm -rf ${cpp_build_dir}
+ mkdir -p ${cpp_build_dir}
+ pushd ${cpp_build_dir}
+
+ # Workaround to fix static libparquet
+ export CXXFLAGS="-DARROW_STATIC"
+
+ export CC="/C/Rtools${MINGW_PREFIX/mingw/mingw_}/bin/gcc"
+ export CXX="/C/Rtools${MINGW_PREFIX/mingw/mingw_}/bin/g++"
+ export PATH="/C/Rtools${MINGW_PREFIX/mingw/mingw_}/bin:$PATH"
+ export CPPFLAGS="-I${MINGW_PREFIX}/include"
+ export LIBS="-L${MINGW_PREFIX}/libs"
+
+ MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
+ ${MINGW_PREFIX}/bin/cmake.exe \
+ ${ARROW_CPP_DIR} \
+ -G "MSYS Makefiles" \
+ -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
+ -DCMAKE_BUILD_TYPE=${cmake_build_type} \
+ -DARROW_BUILD_STATIC=ON \
+ -DARROW_BUILD_SHARED=OFF \
+ -DARROW_BUILD_TESTS=OFF \
+ -DARROW_PARQUET=ON \
+ -DARROW_PLASMA=OFF \
+ -DARROW_HDFS=OFF \
+ -DARROW_PYTHON=OFF \
+ -DARROW_BOOST_USE_SHARED=OFF \
+ -DARROW_WITH_SNAPPY=OFF \
+ -DARROW_WITH_ZSTD=OFF \
+ -DARROW_WITH_LZ4=OFF \
+ -DARROW_JEMALLOC=OFF \
+ -DARROW_WITH_ZLIB=ON \
+ -DARROW_WITH_BROTLI=OFF \
+ -DARROW_USE_GLOG=OFF \
+ -DARROW_BUILD_UTILITIES=ON \
+ -DARROW_TEST_LINKAGE="static" \
+ -Ddouble-conversion_ROOT="${MINGW_PREFIX}" \
+ -DThrift_ROOT="${MINGW_PREFIX}"
+
+ sed -i 's/-fPIC/ /g' flatbuffers_ep-prefix/src/flatbuffers_ep-stamp/flatbuffers_ep-configure-RELEASE.cmake
+
+ make
+ popd
+}
+
+check() {
+ # TODO
+ # make -C ${cpp_build_dir} test
+ :
+}
+
+package() {
+ make -C ${cpp_build_dir} DESTDIR="${pkgdir}" install
+
+ local PREFIX_DEPS=$(cygpath -am ${MINGW_PREFIX})
+ pushd "${pkgdir}${MINGW_PREFIX}/lib/pkgconfig"
+ for pc in *.pc; do
+ sed -s "s|${PREFIX_DEPS}|${MINGW_PREFIX}|g" -i $pc
+ done
+ popd
+}
diff --git a/ci/appveyor-build-r.sh b/ci/appveyor-build-r.sh
new file mode 100644
index 0000000000..85e532e89a
--- /dev/null
+++ b/ci/appveyor-build-r.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -x
+
+pacman --noconfirm -Rcsu mingw-w64-{i686,x86_64}-toolchain gcc pkg-config
+
+wget https://raw.githubusercontent.com/r-windows/rtools-backports/master/pacman.conf
+cp -f pacman.conf /etc/pacman.conf
+
+pacman --noconfirm -Scc
+pacman --noconfirm -Syyu
+pacman --noconfirm --needed -S git base-devel binutils
+
+# Install core build stuff
+pacman --noconfirm --needed -S mingw-w64-{i686,x86_64}-{crt,winpthreads,gcc,libtre,pkg-config,xz}
+
+# Force static linking
+rm -f /mingw32/lib/*.dll.a
+rm -f /mingw64/lib/*.dll.a
+export PKG_CONFIG="/${MINGW_INSTALLS}/bin/pkg-config --static"
+
+cd $APPVEYOR_BUILD_FOLDER
+cp ci/PKGBUILD .
+makepkg-mingw --noconfirm --noprogressbar --skippgpcheck --nocheck --syncdeps --rmdeps --cleanbuild
+
+# Collect the build artifacts and make the shape of zip file that rwinlib expects
+mkdir build
+cp *.xz build
+cd build
+source ../ci/windows-pkg-arrow-for-r.sh
diff --git a/ci/windows-pkg-arrow-for-r.sh b/ci/windows-pkg-arrow-for-r.sh
new file mode 100644
index 0000000000..fdcf7120c1
--- /dev/null
+++ b/ci/windows-pkg-arrow-for-r.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -eu
+
+VERSION=$(grep Version ../r/DESCRIPTION | cut -d " " -f 2)
+DST_DIR="arrow-$VERSION"
+
+# Untar the two builds we made
+ls | xargs -n 1 tar -xJf
+mkdir $DST_DIR
+# Grab the headers from one, either one is fine
+mv mingw64/include $DST_DIR
+
+# Move the 64-bit versions into the expected location
+mkdir -p $DST_DIR/lib-4.9.3/x64
+mv mingw64/lib/*.a $DST_DIR/lib-4.9.3/x64
+# Same for the 32-bit versions
+mkdir -p $DST_DIR/lib-4.9.3/i686
+mv mingw32/lib/*.a $DST_DIR/lib-4.9.3/i686
+
+mkdir deps && cd deps
+# Get these from "backports" so they were compiled with gcc 4.9
+wget https://dl.bintray.com/rtools/backports/mingw-w64-i686-boost-1.67.0-8000-any.pkg.tar.xz
+wget https://dl.bintray.com/rtools/backports/mingw-w64-x86_64-boost-1.67.0-8000-any.pkg.tar.xz
+# wget https://dl.bintray.com/rtools/mingw32/mingw-w64-i686-boost-1.67.0-9002-any.pkg.tar.xz
+# wget https://dl.bintray.com/rtools/mingw64/mingw-w64-x86_64-boost-1.67.0-9002-any.pkg.tar.xz
+wget https://dl.bintray.com/rtools/backports/mingw-w64-i686-thrift-0.12.0-8000-any.pkg.tar.xz
+wget https://dl.bintray.com/rtools/backports/mingw-w64-x86_64-thrift-0.12.0-8000-any.pkg.tar.xz
+# wget https://dl.bintray.com/rtools/mingw32/mingw-w64-i686-thrift-0.12.0-1-any.pkg.tar.xz
+# wget https://dl.bintray.com/rtools/mingw64/mingw-w64-x86_64-thrift-0.12.0-1-any.pkg.tar.xz
+
+# double-conversion is only available in the Rtools4.0 builds, but apparently that's ok
+wget https://dl.bintray.com/rtools/mingw64/mingw-w64-x86_64-double-conversion-3.1.2-1-any.pkg.tar.xz
+wget https://dl.bintray.com/rtools/mingw32/mingw-w64-i686-double-conversion-3.1.2-1-any.pkg.tar.xz
+ls | xargs -n 1 tar -xJf
+cd ..
+
+mkdir -p $DST_DIR/lib/x64
+mkdir -p $DST_DIR/lib/i686
+mv deps/mingw64/lib/*.a $DST_DIR/lib/x64
+mv deps/mingw32/lib/*.a $DST_DIR/lib/i686
+
+# Create build artifact
+zip -r ${DST_DIR}.zip $DST_DIR
+
+# Copy that to a file name/path that does not vary by version number so we
+# can easily find it in the R package tests on Appveyor
+cp ${DST_DIR}.zip ../libarrow.zip