-
Notifications
You must be signed in to change notification settings - Fork 991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling of zlib fwrite dependency #3872
Comments
It seems to do so we should add a
|
Could we compile without zlib support if it is not present? Then fwrite would error when attempting to use gz. This reduce OS software dependency, this is very important to stay lightweight. |
We had a similar problem in (py) datatable, and ended up just shipping the |
@st-pasha way of shipping zlib together with data.table is another option. Definitely better than current error. Yet IMO it is better to not ship it together, but escape support of gz fwrite when zlib was not present during compilation. I can imagine that not every user uses fwrite, and among them not many uses gz, ultimately zlib might be needed by a tiny fraction of data.table users. |
Agree w Jan it's best if we can essentially make https://github.com/MichaelChirico/data.table/tree/zlib_suggests |
I don't think that including zlib headers is a good idea because distribution binaries from zlib and included headers in data.table may be incompatibles. In this case, data.table must include headers and source of the zlib library. I think Another advantage of I don't know how to write a |
ZLIB_PRESENT must be defined if zlib (lib and headers) is present on the system. If not, ZLIB_PRESENT is undefined and data.table is compiled without zlib support. Normally ZLIB_PRESENT (or an equivalent) will be defined (or not) by a configure script. See issue #3872.
HAVE_LIBZ must be defined if zlib (lib and headers) is present on the system. If not, HAVE_LIBZ is undefined and data.table is compiled without zlib support. Normally HAVE_LIBZ (or an equivalent) will be defined (or not) by a configure script (see ax_check_zlib). See issue Rdatatable#3872.
This branch is an attempt to write a configure script to detect zlib. Feel free to test. Not a PR because it introduces changes in current data.table build process. |
@philippechataignon any chance for a unit test? It has to be conditionally escaped of course. |
I can't go further on the branch fwrite_zlib_present et for me it's OK but perhaps too late/too dangerous for 1.12.4. I've replaced warning by stop as suggests. I've manually tested fwrite on data.table compiled with/without HAVE_ZLIB flag forced in fwrite.c and it's OK but I don't know how to write a unit test to verify the message error when there's no zlib headers on the machine. |
@jangorecki I think this is something Gitlab builds would have to do... as I see it @philippechataignon currently on
Is it possible for this to be a warning & allow installation to continue? I see |
There was a |
Looks great. Agree it's a bit risky/late for 1.12.4 so postponing to next release as suggested. |
By postponding to 1.13.0 we can also get insight if there are many affected users. Assuming that zlib should be installed as r-base-dev dependency then we should consider this situation as abnormal. IMO it might not be worth to introduce configure script just to cover that abnormal situation, unless of course it affects many users. |
has zlib always been a dependency for R? I'm not sure how to check |
Here for R 3.3.0 (may 2016) : The previously included versions of zlib, bzip2, xz and PCRE have been removed, so suitable external (usually system) versions are required. In R 3.2.0 (april 2015): configure options --with-system-zlib, --with-system-bzlib and --with-system-pcre are now the default. For the time being there is fallback to the versions included in the R sources if no system versions are found or (unlikely) if they are too old. Linux users should check that the -devel or -dev versions of packages zlib, bzip2/libbz2 and pcre as well as xz-devel/liblzma-dev (or similar names) are installed Commit 2001-04-06 69db71eb0c has log message "require and build zlib and libzml (not built yet)" : zlib is a dependency for R since the beginning but R source includes zlib source if there is not system zlib. |
OK so noting based on the clarification from rocker-org/rocker-versioned#161 In order for users to be missing |
For the sake of clarity, when people speak of "zlib" library, they could mean 3 different things:
|
I think this is covered by Philippe's first note from R NEWS: |
NEWS says that zlib headers are required to compile R but when you install R from a binary package (very usual) there no need to have zlib headers present. |
R-base-dev brings some tools with it so to ensure you can compile basic programmes. And it also pulls in zlib1g-dev as on Debian/Ubuntu systems So just install r-base-dev along with r-base-core should be enough The 'zlib1g-dev' missing is an indication of r-base-dev not installed, and the first step (on Debian and Ubuntu) before building packages from source should be to haev r-base-dev. Please mention this step in news section on wiki page |
@vikram-rawat data.table has a
For others finding this in future, only those installing from source need this. Windows and MacOS users who install the CRAN binary do not compile the package so they don't need this. |
#include <zlib.h>
might fail on some machines. In this case it would be helpful to fail more helpfully.Currently on
rocker/r-ver:3.5.3
(e.g.), we get the following installation failure for devdata.table
:(this doesn't affect the CRAN version since there's no
fwrite+gz
support there yet)By contrast, here's how
units
package fails:Quite useful & actionable!
I'm not sure how ubiquitous
zlib
is in the wild...The text was updated successfully, but these errors were encountered: