[R-pkg-devel] Please install cmake on macOS builders

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Thu May 11 13:16:19 CEST 2023


On 11 May 2023 at 09:02, Martin Maechler wrote:
| I've been told in private that the above "be happy if"
| may *not* be a good idea,
| or rather even close to impossible as   cmake  seems to not fit
| well, at all, with the quite sophisticated
|     autoconf -> configure -> make
| setup we have with building R + recommended packages
| cross-platform compatibly as well as possible.

Yes, my bad -- it _is_ indeed in Writing R Extensions (albeit with an
actual error, see below) so I now use what it recommended (in the form
pointed out by Reed though) so for me it is

    sh -> make -> cmake

but could be autoconf too.

I presume the macOS systems needs it for cross-compilation or other dances.
Still annoying as hell.  A simple default may be better but I do not know any
of the dragons running around inside macOS.

Dirk


Appendix: Actual Error in Writing R Extensions.

Section 1.2.6 ends on these lines (r-release, and r-devel) I am quoting in full

    One way to work around this is for the package’s ‘configure’ script to
    include
         if test -z "$CMAKE"; then CMAKE="`which cmake`"; fi
         if test -z "$CMAKE"; then CMAKE=/Applications/CMake.app/Contents/bin/cmake; fi
         if test -f "$CMAKE"; then echo "no 'cmake' command found"; exit 1; fi
    and for the second approach to substitute ‘CMAKE’ into ‘src//Makevars’.

The final 'test -f' has to be negated. Demo:

    edd using rob:/tmp$ cat foo.sh 
    ##!/bin/sh
    if test -z "$CMAKE"; then CMAKE="`which cmake`"; fi
    if test -z "$CMAKE"; then CMAKE=/Applications/CMake.app/Contents/bin/cmake; fi
    if test -f "$CMAKE"; then echo "no 'cmake' command found"; exit 1; fi
    echo "** using $CMAKE"
    edd using rob:/tmp$ ./foo.sh 
    no 'cmake' command found
    edd using rob:/tmp$ which cmake
    /usr/bin/cmake
    edd using rob:/tmp$ 

If I change foo.sh to use '! test -f' all is well

    edd using rob:/tmp$ be foo.sh    # be is an alias for emacsclient in tty mode
    edd using rob:/tmp$ ./foo.sh 
    ** using /usr/bin/cmake
    edd using rob:/tmp$ 

-- 
dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org



More information about the R-package-devel mailing list