src/README.md

Build notes

libuv

The contents of the libuv/ directory are the canonical libuv sources, with changes as described below.

Step-by-step instructions

To update libuv to a new version, do the following:

Details

Makefile-libuv.mingw

Prior to libuv 1.21.0, it included a Makefile.mingw, for use on MinGW platforms like the one that R uses in Windows. As of libuv 1.21.0, the Makefile.mingw was removed, and the recommended build method on MinGW is to use the configure script. However, the configure script will not run from R CMD INSTALL, because it will try to execute the configure script using cmd.exe, and it will not even be able to find basic things like /bin/sh.

Because it's not possible to run the configure script from R CMD INSTALL, httpuv includes a custom Makefile for libuv. The original version of this resides at tools/Makefile-libuv.mingw, and when the tools/update_libuv.R script is run, it copies it to src/libuv/Makefile-libuv.mingw.

MinGW and unnamed structs

The libuv sources contain unnamed structs, which result in warnings on MinGW's GCC. This in turn causes WARNINGS in R CMD check on Windows. They were converted to named structs.

Empty translation unit

When libuv/src/win/snprintf.c is compiled, the entire content of the file is #ifdef-ed out, so the result is empty. When compiled with the -pedantic flag, as is done on CRAN's win-builder service (and probably the CRAN build machine), this results in a significant warning.

The workaround just adds a dummy typedef statement to suppress the warning.

Solaris support

The Makefile.am file is modified for Solaris support. This is the original line:

libuv_la_CFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500

It has -DSUNOS_NO_IFADDRS added to it. See here for more information.

libuv_la_CFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -DSUNOS_NO_IFADDRS

C-style comments

In src/libuv/include/uv.h, the original file has some C++-style comments, but this raises a significant warning for R CMD check on r-devel-linux-x86_64-debian-gcc (as of 2020-05-15). The fix is to replace with C-style comments.

Avoid ISO C90 forbids mixed declarations and code warning

On CRAN's R-devel Debian machines (as of 2022-09-07), we saw the following significant warning:

* checking whether package ‘httpuv’ can be installed ... [88s/88s] WARNING
Found the following significant warnings:
  ./src/uv-common.h:61:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]

We think that the -Wdeclaration-after-statement compiler flag is set on this system, but when compiling libuv, it results in a warning. There is a libuv issue about this, but it hasn't yet been fixed.

This fix modifies src/libuv/configure.ac by adding the following line:

CC_CHECK_CFLAGS_APPEND([-Wno-declaration-after-statement])

Run autoupdate and autogen.sh

After modifying Makefile.am, run autoupdate and then ./autogen.sh. This requires automake and libtool, and generates the configure script, along with a number of other related files. These generated files are checked into the repository so that other systems to not need automake and libtool to build libuv.

The file libuv/m4/lt~obsolete.m4 (generated by autogen.sh) is renamed to lt_obsolete.m4 because the filename with the ~ causes problems with R CMD check. In the Makevars file, it gets copied to lt~obsolete.m4 so that it's present during the build process.

In Makevars, before running ./configure, it updates the timestamps output files aclocal.m4, Makefile.in, and configure, to make sure they are newer than the input files. Note that order matters: aclocal.m4 must not be newer than the other files. On some platforms (like Solaris), the order in which the files are specified can matter. In our case, we touched aclocal.m4, and copied its date to the other files.

If this is not done, then the configure script may generate a Makefile which tries to find aclocal-1.15 and other autotools-related programs (#124). See this SO question for more information.

The following generated files are checked into the repository:

src/libuv/Makefile.in
src/libuv/aclocal.m4
src/libuv/ar-lib
src/libuv/compile
src/libuv/config.guess
src/libuv/config.sub
src/libuv/configure
src/libuv/depcomp
src/libuv/install-sh
src/libuv/ltmain.sh
src/libuv/m4/libtool.m4
src/libuv/m4/libuv-extra-automake-flags.m4
src/libuv/m4/lt_obsolete.m4    * NOTE: this was renamed
src/libuv/m4/ltoptions.m4
src/libuv/m4/ltsugar.m4
src/libuv/m4/ltversion.m4
src/libuv/missing


rstudio/httpuv documentation built on March 29, 2024, 2:23 p.m.