Skip to content

🐛 Can't build with MacOS on CRAN using CMake #44

@serkor1

Description

@serkor1

The error on ARM and non-ARM builds:

installing *source* package ‘talib’ ...
** this is package ‘talib’ version ‘0.9-0’
** package ‘talib’ successfully unpacked and MD5 sums checked
** using staged installation

Configure for {talib} v0.9-0

 [0;34mBuild-step: [0m Checking for  [0;34mR_HOME [0m [ [0;32mOK [0m]
 [0;34mBuild-step: [0m Compiling C-program with R CMD SHLIB [ [0;32mOK [0m]
 [0;34mBuild-step: [0m Compiling TA-Lib program with system headers [ [0;33mFailed [0m]
  [0;31mBuild-error: [0m
CMake not found on PATH==========================================================================
Install CMake:
  Linux:
    Debian/Ubuntu: sudo apt-get update && sudo apt-get install -y cmake
    Fedora/RHEL/CentOS: sudo dnf install -y cmake
    Arch: sudo pacman -S --needed cmake
    openSUSE: sudo zypper install -y cmake

  macOS:
    Homebrew: brew install cmake
    MacPorts: sudo port install cmake

Alternatively download the installer: https://cmake.org/download/
After installation, restart the shell or add CMake to PATH
==========================================================================
Submit bug-reports here:  [0;34mhttps://github.com/serkor1/ta-lib-R [0m

ERROR: configuration failed for package ‘talib’
* removing ‘/Volumes/Builds/packages/big-sur-arm64/results/4.5/talib.Rcheck/talib’

The fix is to fallback on autoconf from the original configure-file on UNIX, or use the old configure from 4a65234 which used autoconf and libtools.

Update: It might not be necessary to change the build-chain (From 'Writing R Extensions'):

A complication is that on macOS cmake (where installed) is commonly not on the path but at /Applications/CMake.app/Contents/bin/cmake. 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. This also applies to the ancillary command ctest, if used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions