Skip to content

Compile error on Apple Silicon chip #50

Description

@gaow

Error message

When I run

 devtools::install_github('stephenslab/mixsqp')

on my new Mac with Apple M2 Pro and MacOS 13.2.1, I get:

/Users/gw2411/micromamba/envs/pisces-rabbit/lib/R/library/RcppArmadillo/include/armadillo_bits/fn_misc.hpp:172:21: error: no member named 'Rlog1p' in namespace 'std'; did you mean simply 'Rlog1p'?
    return (log_a + std::log1p(std::exp(negdelta)));
                    ^~~~~~~~~~
                    Rlog1p

It fails to install. This also prevents susieR from installing on my new Mac.

Environment

Compiler:

arm64-apple-darwin20.0.0-clang

R session

sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20.0.0 (64-bit)
Running under: macOS Ventura 13.2.1

Matrix products: default
BLAS/LAPACK: /Users/gw2411/micromamba/envs/pisces-rabbit/lib/libopenblas.0.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/New_York
tzcode source: system (macOS)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] colorout_1.2-2 pacman_0.5.1

loaded via a namespace (and not attached):
 [1] miniUI_0.1.1.1    compiler_4.3.1    crayon_1.5.2      promises_1.2.1    Rcpp_1.0.11       stringr_1.5.0     callr_3.7.3       later_1.3.1       fastmap_1.1.1     mime_0.12
[11] R6_2.5.1          curl_5.0.2        htmlwidgets_1.6.2 desc_1.4.2        profvis_0.3.8     rprojroot_2.0.3   shiny_1.7.5       rlang_1.1.1       cachem_1.0.8      stringi_1.7.12
[21] httpuv_1.6.11     fs_1.6.3          pkgload_1.3.2.1   memoise_2.0.1     cli_3.6.1         magrittr_2.0.3    ps_1.7.5          digest_0.6.33     processx_3.8.2    xtable_1.8-4
[31] remotes_2.4.2.1   devtools_2.4.5    lifecycle_1.0.3   prettyunits_1.2.0 vctrs_0.6.3       glue_1.6.2        urlchecker_1.0.1  sessioninfo_1.2.2 pkgbuild_1.4.2    purrr_1.0.2
[41] usethis_2.2.2     tools_4.3.1       ellipsis_0.3.2    htmltools_0.5.6

Solution

After applying this fix to src/Makevars

--- a/src/Makevars
+++ b/src/Makevars
@@ -1,4 +1,4 @@
 CXX_STD = CXX11
-PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) -DARMA_DONT_PRINT_ERRORS \
+PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) -DARMA_DONT_PRINT_ERRORS -DHAVE_WORKING_LOG1P \
   -DARMA_NO_DEBUG -DARMA_USE_BLAS -DARMA_DONT_USE_OPENMP -DARMA_WARN_LEVEL=1

It works fine. This also works on Linux OS but i'm not sure if this is a proper fix. @pcarbo what do you think --- would you like to try it out and see?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions