r-system-requirements icon indicating copy to clipboard operation
r-system-requirements copied to clipboard

s2 build issue

Open michaelmayer2 opened this issue 6 months ago • 3 comments

Seems like we don't have any story around Abseil as OS dependency.

There is a bug in the s2 package where they try to detect cmake which would trigger an internal build of the OS dependencies (cf. https://github.com/r-spatial/s2/blob/ff3f7273fe3e52fd12fcc4a9a4c44ec4452af843/tools/build_absl.sh#L22 ff.). They try to detect cmake via the env variable CMAKE and if it is empty, they will first set to which cmake but in Line 23 they set it to the MacOS equivalent without any OS check.

In any case I will provide a PR so we can get this dependency sorted.

Full installation output:
* installing *source* package ‘s2’ ...
** package ‘s2’ successfully unpacked and MD5 sums checked
staged installation is only possible with locking
** using non-staged installation
Found OpenSSL pkg-config cflags and libs!
Testing compiler OpenSSL configuration using PKG_CFLAGS=
** Using PKG_CONFIG_PATH=:/tmp/Rtmp6E2yoY/R.INSTALL609e133db3bd/s2/tools/pkgconfig
** Building abseil-cpp using cmake
Warning message:
In readRenviron("~/.R/Makevars") :
  file '/root/.R/Makevars' cannot be opened for reading
GNU Make 4.3
Built for x86_64-redhat-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Using MAKE=make 
/usr/bin/which: no cmake in (/root/.local/bin:/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin)
tools/build_absl.sh: line 24: /Applications/CMake.app/Contents/bin/cmake: No such file or directory
cmake not found
** CMake build of Abseil failed
** Abseil can be installed with:
** - apt-get install libabsl-dev
** - dnf install abseil-cpp-devel
** - brew install abseil
** If a system install of Abseil is not possible, cmake is required to build
** the internal vendored copy.
ERROR: configuration failed for package ‘s2’
* removing ‘/tmp/RtmpKlSMjh/pkg-lib60471d5bdd5/s2’
Type .Last.error to see the more details.
> 

michaelmayer2 avatar May 22 '25 11:05 michaelmayer2

Thanks, I was looking at this a bit yesterday too.

Even if we had Abseil installed, does the bug mean that the build would still fail if cmake wasn't present? I tried to install abseil yesterday but still saw the cmake error.

And do you know if s2 is planning a CRAN release soon with this fix? If not, we can probably work around this in the PPM binary builds since it's preventing sf from being built right now.

glin avatar May 22 '25 21:05 glin

FYI, fixed here: https://github.com/r-spatial/s2/pull/277

gaborcsardi avatar May 22 '25 22:05 gaborcsardi

https://github.com/rstudio/r-system-requirements/pull/211 will add the appropriate system deps and make the lengthy cmake build obsolete.

michaelmayer2 avatar May 23 '25 07:05 michaelmayer2