Closed viking closed 3 years ago
FWIW, I can build this library on my system without any problems (assuming this is where libxlsxwriter comes from): https://github.com/jmcnamara/libxlsxwriter.
Can confirm this error on Gentoo but not Arch with R=3.5.3
Are you compiling with C99?
No
What is your R CMD config CC
? It should have -std=gnu99
.
Try setting CC = gcc -std=gnu99
in your $(R RHOME)/etc/Makeconf
.
> R CMD config CC
x86_64-pc-linux-gnu-gcc
> x86_64-pc-linux-gnu-gcc --version
x86_64-pc-linux-gnu-gcc (Gentoo 8.3.0-r1 p1.1) 8.3.0
No change when adding CC = x86_64-pc-linux-gnu-gcc -std=gnu99
to Makeconf
So it's complaining about the OF()
macro which should be defined in your system zlib in zconf.h
. For example on my macOS I see in /usr/include/zconf.h
:
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
Do you have the same? @jmcnamara have you seen such compilation errors in minizip before?
There is no definition of OF
in my zconf.h
on Gentoo (and there is on Arch).
The corresponding lines on Gentoo are instead:
#ifndef _Z_OF /* function prototypes */
# ifdef STDC
# define _Z_OF(args) args
# else
# define _Z_OF(args) ()
# endif
#endif
This is an issue/feature on Gentoo where they helpfully redefine the zlib OF()
. They have reasons but it just bites everyone.
Libxlsxwriter has a build system work around for this:
https://github.com/jmcnamara/libxlsxwriter/commit/32be6b90f583b4c7c24b1c47dda025aa76c6a330
Here is my previous analysis of the issue when I hit it in libxlsxwriter: https://github.com/jmcnamara/libxlsxwriter/issues/116#issuecomment-321949253
@mschubert I added a workaround, can you try again installing from source?
remotes::install_github("ropensci/writexl")
Your workaround does not compile, unfortunately.
I suspect that something in the Gentoo tool chain
OF
, which is why they renamed it in the first place#if
still does not compile)This is still an issue for me with R 3.6.1. I'm using Gentoo just like @mschubert, which I failed to mention earlier.
$ R CMD config CC
/usr/bin/gcc
$ gcc --version
gcc (Gentoo 8.3.0-r1 p1.1) 8.3.0
I was able to get it to build using the same technique as @jmcnamara. I don't know how portable it is though. https://github.com/viking/writexl/commit/aac41d2b7445a8609c1f060f604409a1ba655787
For future reference:
The gentoo issue: https://bugs.gentoo.org/383179
The temporary fix: devtools::install_github("viking/writexl@issue-34")
The proper fix: change libxslxwriter
to use libminizip
@viking: I suggest you change the title to "libxslxwriter compilation issue in gentoo", and file the bug at libxlsxwriter
instead of here.
I suggest you change the title to "libxslxwriter compilation issue in gentoo", and file the bug at libxlsxwriter instead of here.
@rfaelens Nope. Libxlsxwriter compiles fine on Gentoo and libxlsxwriter already provides a way of compiling with libminizip.
I bumped into this again today. None of the workaround mentioned above worked, but adding to ~/.R/Makevars
does:
CFLAGS += -DOF=_Z_OF
2022-07-31 Note if you find this for a related issue: setting this flag permanently breaks installation of the digest
R package
I'm the author and maintainer of libxlsxwriter and just to let you know that I've put a fix for this issue into the source code rather than the build system to avoid issues like this where the libxlsxwriter build system(s) isn't used on Gentoo or Gentoo derived systems.
So hopefully we can make this issue go away in the near future.
@jeroen I've been using R recently and for my own sake I'd like to fix this and some other maintenance issues, and maybe extend some of the functionality. If you are interested let me know: jmcnamara@cpan.org
@jmcnamara should I just import the latest libxlsxwriter sources from your master branch?
@jeroen Let me see if I can resolve issue https://github.com/jmcnamara/libxlsxwriter/pull/273 as well and then you can pull the fixed code. I'll let you know.
When I try to install writexl in R 3.5.2, I get a compilation error. I noticed that another issue (#21) describes problems with compilation that may have been related to compilation flags, but with no clear resolution. My compilation error is not the same as in that issue, however.