diff --git a/.appveyor.yml b/.appveyor.yml index 19ed1dd6e4..ea8711a2b6 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -30,7 +30,7 @@ environment: - R_VERSION: release # the single Windows.zip binary (both 32bit/64bit) that users following dev version of installation instructions should click -# - R_VERSION: devel # temporarily off pending R-devel fix of slowdown from 5min to 20-30min (slowing down data.table dev) in July 2019 possibly due to r76734. + - R_VERSION: devel # temporarily off pending R-devel fix of slowdown from 5min to 20-30min (slowing down data.table dev) in July 2019 possibly due to r76734. before_build: - cmd: ECHO no Revision metadata added to DESCRIPTION diff --git a/.dev/CRAN_Release.cmd b/.dev/CRAN_Release.cmd index 863b023b5c..543ea1c339 100644 --- a/.dev/CRAN_Release.cmd +++ b/.dev/CRAN_Release.cmd @@ -48,6 +48,9 @@ grep "Rprintf" ./src/init.c grep "nearest *=" ./src/*.c # none grep "class *=" ./src/*.c # quite a few but none global +# ensure no use of z_const from zconf.h; #3939 +grep "z_const" ./src/*.[hc] # none other than the comment + # No undefined type punning of the form: *(long long *)&REAL(column)[i] # Failed clang 3.9.1 -O3 due to this, I think. grep "&REAL" ./src/*.c @@ -149,6 +152,7 @@ system.time(test.data.table(script="*.Rraw")) # apx 8h = froll 3h + nafill 1m + # Upload to win-builder: release, dev & old-release # Turn on Travis OSX; it's off in dev until it's added to GLCI (#3326) as it adds 17min after 11min Linux. +# Turn on r-devel in Appveyor; it may be off in dev for similar dev cycle speed reasons ############################################### diff --git a/NEWS.md b/NEWS.md index db035bd941..fb10f4f81a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -10,6 +10,8 @@ 1. `shift()` on a `nanotime` with the default `fill=NA` now fills a `nanotime` missing value correctly, [#3945](https://github.com/Rdatatable/data.table/issues/3945). Thanks to @mschubmehl for reporting and fixing in PR [#3942](https://github.com/Rdatatable/data.table/pull/3942). +2. Compilation failed on CRAN's MacOS due to an older version of `zlib.h/zconf.h` which did not have `z_const` defined, [#3939](https://github.com/Rdatatable/data.table/issues/3939). Other open-source projects unrelated to R have experienced this problem on MacOS too. We have followed the common practice of removing `z_const` to support the older `zlib` versions, and data.table's release procedures have gained a `grep` to ensure `z_const` isn't used again by accident in future. The library `zlib` is used for `fwrite`'s new feature of multithreaded compression on-the-fly; see item 3 of 1.12.4 below. + ## NOTES diff --git a/configure b/configure new file mode 100755 index 0000000000..76024fcfe4 --- /dev/null +++ b/configure @@ -0,0 +1,32 @@ +#!/bin/sh +# Let's keep this simple. If pkg-config is available, use it. Otherwise print +# the helpful message to aid user if compilation does fail. Note 25 of R-exts: +# "[pkg-config] is available on the machines used to produce the CRAN binary packages" + +if ! hash pkg-config 2>/dev/null; then + echo "*** pkg-config is not installed. It is used to check that zlib is installed. Compilation" + echo "*** will now be attempted and if it works you can ignore this message. If it fails and" + echo "*** and you cannot install pkg-config, try: locate zlib.h zconf.h. If they are not found" + echo "*** then try installing zlib1g-dev (Debian/Ubuntu), zlib-devel (Fedora) or zlib (OSX)" + exit 0 # now that the advice has been printed, exit with success and continue +fi + +if ! `pkg-config --exists zlib`; then + echo "pkg-config did not detect zlib is installed. Try installing:" + echo "* deb: zlib1g-dev (Debian, Ubuntu, ...)" + echo "* rpm: zlib-devel (Fedora, EPEL, ...)" + echo "* brew: zlib (OSX)" + exit 1 # nothing more to do; zlib is required currently +fi + +version=`pkg-config --modversion zlib` +echo "zlib ${version} is available ok" + +lib=`pkg-config --libs zlib` +if test $lib != "-lz"; then + echo "zlib is linked using ${lib} not the expected standard -lz. Please report to data.table issue tracker on GitHub." + exit 1 +fi + +exit 0 + diff --git a/src/fwrite.c b/src/fwrite.c index 0ed9f2184a..e5a7b68190 100644 --- a/src/fwrite.c +++ b/src/fwrite.c @@ -1,4 +1,3 @@ -#include "fwriteLookups.h" #include #include // for access() #include @@ -7,6 +6,7 @@ #include // isfinite, isnan #include // abs #include // strlen, strerror +#include // for compression to .gz #ifdef WIN32 #include @@ -19,8 +19,8 @@ #define CLOSE close #endif -#include "zlib.h" // for writing gzip file #include "myomp.h" +#include "fwriteLookups.h" #include "fwrite.h" #define NUM_SF 15 @@ -566,7 +566,7 @@ int compressbuff(z_stream *stream, void* dest, size_t *destLen, const void* sour stream->next_out = dest; stream->avail_out = *destLen; - stream->next_in = (z_const Bytef *)source; + stream->next_in = (Bytef *)source; // don't use z_const anywhere; #3939 stream->avail_in = sourceLen; err = deflate(stream, Z_FINISH);