Skip to content

Conversation

@nealrichardson
Copy link
Member

This is very much a work-in-progress for running the R package tests on Appveyor. It's an attempt to bring in the "standard" R Appveyor build tooling (https://github.com/krlmlr/r-appveyor, Apache 2.0 licensed) into Arrow's configuration.

I currently have the C++ library building and installing, and R and all R package dependencies installing, and R checks beginning, but they fail. This is because https://github.com/apache/arrow/blob/master/r/tools/winlibs.R is configured only to build with a released [sic] version of the arrow C++ binaries pre-built and hosted on rwinlib. Two immediate to-dos are:

  1. get the package to install and check without libarrow at all (as ARROW-5488: [R] Workaround when C++ lib not available #4471 now allows)
  2. get the package to find the libarrow we built locally from source

After that, I can reverse-engineer what appveyor does and document it for any Windows developers (https://issues.apache.org/jira/browse/ARROW-3758).

There's obviously some mess I've made of appveyor.yml that I'll clean up before I'm done, and I'll do my best to document and refactor some of the non-obvious features of the setup that I've discovered (e.g. that ci/appveyor-cpp-build-mingw.bat also installs GLib and Ruby and runs their test suites too) while I'm at it so that the next person might be able to pick things up faster.

cc @romainfrancois @javierluraschi

@romainfrancois
Copy link
Contributor

#4471 is driven by the configure script, which is ignored on windows

@nealrichardson
Copy link
Member Author

This is ready for review now. This adds the foundations for building the R package on Windows and on Appveyor, and it adds an Appveyor job to check the R package without the C++ library. This includes some refactoring of the configure script (adding configure.win) and the tools/winlibs.R script that will be necessary for the package to work even on the happy path where there's a build binary on rwinlibs, now that there's the new ARROW_R_WITH_ARROW flag. I.e. without this change, if we did a repeat of the Windows build process described here, we wouldn't get a functioning package.

Getting the R package to use the C++ library built from source will require integrating the scripts and workflow described there; IIUC we can't just use the C++ library that our current appveyor scripts build and have to compile with the Rtools toolchain. Given that that will be a bit of work, I'd like to separate that effort and get this piece merged now.

@fsaintjacques fsaintjacques self-requested a review June 14, 2019 17:19
Copy link
Member

@wesm wesm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall seems OK, the title of the PR is a bit misleading since the R unit tests aren't actually being run in Appveyor yet

["-VERSION = #{@release_version}",
"+VERSION = #{@release_version}.9000"],
],
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these changes about?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 00-prepare.sh does not modify Makevars.win anymore, the generation of this file is now deferred at installation (@nealrichardson please confirm) via the added configure.win.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This patch makes Makevars.win be generated dynamically, so there's no longer a file that needs to be updated in the release scripts.

@nealrichardson nealrichardson changed the title WIP ARROW-3759: [R][CI] Build and test on Windows in Appveyor ARROW-3759: [R][CI] Build and test (no libarrow) on Windows in Appveyor Jun 17, 2019
@nealrichardson
Copy link
Member Author

Title revised--that was the ticket title and original scope, but as I got into it, it made sense to stop short of the grand goal in this iteration. FTR it is running the R package checks, including tests; all tests that require libarrow are skipped, but we are testing that conditional skipping behavior and that the package successfully builds if libarrow isn't found. This fallback behavior is not working on Windows on master, and this PR fixes that. It is important that this behavior work, if for no other reason than to prevent a flaky build failure (on CRAN or elsewhere).

echo "*** Writing Makevars.win"
sed -e "s|@cflags@|$PKG_CFLAGS|" -e "s|@libs@|$PKG_LIBS|" src/Makevars.in > src/Makevars.win
# Success
exit 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small bash nit, exit 0 does not need to be explicited since it's implicit that a script returns 0.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is copypasta from r/configure 🤷‍♂

["-VERSION = #{@release_version}",
"+VERSION = #{@release_version}.9000"],
],
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 00-prepare.sh does not modify Makevars.win anymore, the generation of this file is now deferred at installation (@nealrichardson please confirm) via the added configure.win.

VERSION=$(grep ^Version DESCRIPTION | sed s/Version:\ //)
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "tools/winlibs.R" $VERSION

if [ $? -ne 0 ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this expected? And should you exit immediately if this failure is encountered.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tools/winlibs.R will exit nonzero if https://github.com/apache/arrow/pull/4538/files/328bc376f9adb2717d1505f96d8d7452ee9d8212#diff-48db18073973d5ea65a7f0023f920145R22 fails to find and download a prebuilt binary. This triggers the fallback build-package-without-libarrow behavior (see #4471).

I can add some comments to explain.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok now I understand more clearly. I think this warrants a comment or clearer message, e.g.

"Failed to download and extract libarrow runtime and dependencies. The R arrow package will compile with shim methods. Please run arrow::install_arrow() to install required runtime libraries and recompile this package with proper support."

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or separate this message in half, one for users, and a comment for maintainers.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just pushed some comments

# specific language governing permissions and limitations
# under the License.

VERSION = 0.13.0.9000
Copy link
Contributor

@fsaintjacques fsaintjacques Jun 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kou did something go wrong, I'd expect the version to be 0.14.0.9000. This is the values Rust and Java uses for example. This should apply to DESCRIPTION.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.13.0.9000 is "correct" (here at least) for the dev version after 0.13 before 0.14.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, so the inverse of Java?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently so? IDK, the version math makes more sense to me the way that this is done in the R community, 0.13.0 < 0.13.0.9000 < 0.14.0. I'm not familiar with how Java handles this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.13.0.9000 is correct.

See also: https://issues.apache.org/jira/browse/ARROW-4113?focusedCommentId=16728608&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16728608

Rust and Java use 0.14.0-SNAPSHOT. They don't use 0.14.0.9000.

We use X.Y.Z-SNAPSHOT for languages that support PRE release by tag ("SNAPSHOT").
R doesn't support tag. So we use ".9000". ".9000" is commonly used in R.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cf. http://r-pkgs.had.co.nz/release.html for the R convention.

@fsaintjacques
Copy link
Contributor

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants