Skip to content

Build compilation errors on macos #165

@goldingn

Description

@goldingn

G'day. This is very non-urgent. I've worked around this by using another machine, and I see this is all work in progress still, so I'd be happy with a 'your system is weird', and closing the issue. Just flagging in case it is remotely helpful.

I have been trying to install dust2 on my mac (2022, M2 chip, Ventura 13.1) following the installation instructions in the readme and it errors with a bunch of CPP compilation stuff. dust (v1) compiles fine with equivalent instructions.

Details

Here's the noise, session info down the bottom

install.packages(
  "dust2",
  type = "source",
  repos = c("https://mrc-ide.r-universe.dev", "https://cloud.r-project.org"))
trying URL 'https://mrc-ide.r-universe.dev/src/contrib/sha256-b1ef74f9db893653add87d187a2ef03f17695e1fa532c0f995fcd42a2f939730'
Content type 'application/gzip' length 1378259 bytes (1.3 MB)
==================================================
downloaded 1.3 MB

* installing *source* package ‘dust2’ ...
** using staged installation
** libs
clang++ -arch arm64 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/cpp11/include' -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/monty/include' -I/opt/R/arm64/include  -I../inst/include -DHAVE_INLINE  -fPIC  -falign-functions=64 -Wall -g -O2  -c cpp11.cpp -o cpp11.o
clang++ -arch arm64 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/cpp11/include' -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/monty/include' -I/opt/R/arm64/include  -I../inst/include -DHAVE_INLINE  -fPIC  -falign-functions=64 -Wall -g -O2  -c logistic.cpp -o logistic.o
In file included from logistic.cpp:3:
In file included from ../inst/include/dust2/common.hpp:7:
../inst/include/dust2/array.hpp:16:16: error: constexpr variable cannot have non-literal type 'const dust2::array::(anonymous namespace)::(lambda at ../inst/include/dust2/array.hpp:16:23)'
constexpr auto min2 = [](auto a, auto b) { return a < b ? a : b; };
               ^
../inst/include/dust2/array.hpp:16:23: note: lambda closure types are non-literal types before C++17
constexpr auto min2 = [](auto a, auto b) { return a < b ? a : b; };
                      ^
../inst/include/dust2/array.hpp:17:16: error: constexpr variable cannot have non-literal type 'const dust2::array::(anonymous namespace)::(lambda at ../inst/include/dust2/array.hpp:17:23)'
constexpr auto max2 = [](auto a, auto b) { return a > b ? a : b; };
               ^
../inst/include/dust2/array.hpp:17:23: note: lambda closure types are non-literal types before C++17
constexpr auto max2 = [](auto a, auto b) { return a > b ? a : b; };
                      ^
../inst/include/dust2/array.hpp:177:63: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
  static_assert("reduction over 5d arrays not yet implemented");
                                                              ^
                                                              , ""
../inst/include/dust2/array.hpp:183:63: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
  static_assert("reduction over 6d arrays not yet implemented");
                                                              ^
                                                              , ""
../inst/include/dust2/array.hpp:189:63: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
  static_assert("reduction over 7d arrays not yet implemented");
                                                              ^
                                                              , ""
../inst/include/dust2/array.hpp:195:63: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
  static_assert("reduction over 8d arrays not yet implemented");
                                                              ^
                                                              , ""
In file included from logistic.cpp:85:
In file included from ../inst/include/dust2/r/continuous/system.hpp:3:
In file included from ../inst/include/dust2/r/helpers.hpp:7:
../inst/include/dust2/properties.hpp:16:40: error: no template named 'void_t' in namespace 'std'; did you mean '__void_t'?
struct test_has_build_internal<T, std::void_t<decltype(T::build_internal)>>: std::true_type {};
                                  ~~~~~^~~~~~
                                       __void_t
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:525:8: note: '__void_t' declared here
struct __void_t { typedef void type; };
       ^
In file included from logistic.cpp:85:
In file included from ../inst/include/dust2/r/continuous/system.hpp:3:
In file included from ../inst/include/dust2/r/helpers.hpp:7:
../inst/include/dust2/properties.hpp:21:42: error: no template named 'void_t' in namespace 'std'; did you mean '__void_t'?
struct test_has_packing_gradient<T, std::void_t<decltype(T::packing_gradient)>>: std::true_type {};
                                    ~~~~~^~~~~~
                                         __void_t
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:525:8: note: '__void_t' declared here
struct __void_t { typedef void type; };
       ^
In file included from logistic.cpp:85:
In file included from ../inst/include/dust2/r/continuous/system.hpp:3:
In file included from ../inst/include/dust2/r/helpers.hpp:7:
../inst/include/dust2/properties.hpp:26:36: error: no template named 'void_t' in namespace 'std'; did you mean '__void_t'?
struct test_has_zero_every<T, std::void_t<decltype(T::zero_every)>>: std::true_type {};
                              ~~~~~^~~~~~
                                   __void_t
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:525:8: note: '__void_t' declared here
struct __void_t { typedef void type; };
       ^
In file included from logistic.cpp:85:
In file included from ../inst/include/dust2/r/continuous/system.hpp:3:
In file included from ../inst/include/dust2/r/helpers.hpp:7:
../inst/include/dust2/properties.hpp:31:32: error: no template named 'void_t' in namespace 'std'; did you mean '__void_t'?
struct test_has_update<T, std::void_t<decltype(T::update)>>: std::true_type {};
                          ~~~~~^~~~~~
                               __void_t
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:525:8: note: '__void_t' declared here
struct __void_t { typedef void type; };
       ^
In file included from logistic.cpp:85:
In file included from ../inst/include/dust2/r/continuous/system.hpp:3:
In file included from ../inst/include/dust2/r/helpers.hpp:7:
../inst/include/dust2/properties.hpp:36:29: error: no template named 'void_t' in namespace 'std'; did you mean '__void_t'?
struct test_has_rhs<T, std::void_t<decltype(T::rhs)>>: std::true_type {};
                       ~~~~~^~~~~~
                            __void_t
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:525:8: note: '__void_t' declared here
struct __void_t { typedef void type; };
       ^
In file included from logistic.cpp:85:
In file included from ../inst/include/dust2/r/continuous/system.hpp:3:
In file included from ../inst/include/dust2/r/helpers.hpp:7:
../inst/include/dust2/properties.hpp:42:32: error: no template named 'void_t' in namespace 'std'; did you mean '__void_t'?
struct test_has_output<T, std::void_t<decltype(T::output)>>: std::true_type {};
                          ~~~~~^~~~~~
                               __void_t
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:525:8: note: '__void_t' declared here
struct __void_t { typedef void type; };
       ^
In file included from logistic.cpp:85:
In file included from ../inst/include/dust2/r/continuous/system.hpp:3:
In file included from ../inst/include/dust2/r/helpers.hpp:7:
../inst/include/dust2/properties.hpp:47:33: error: no template named 'void_t' in namespace 'std'; did you mean '__void_t'?
struct test_has_special<T, std::void_t<decltype(T::size_special)>>: std::true_type {};
                           ~~~~~^~~~~~
                                __void_t
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:525:8: note: '__void_t' declared here
struct __void_t { typedef void type; };
       ^
In file included from logistic.cpp:85:
In file included from ../inst/include/dust2/r/continuous/system.hpp:3:
In file included from ../inst/include/dust2/r/helpers.hpp:7:
../inst/include/dust2/properties.hpp:52:32: error: no template named 'void_t' in namespace 'std'; did you mean '__void_t'?
struct test_has_delays<T, std::void_t<decltype(T::delays)>>: std::true_type {};
                          ~~~~~^~~~~~
                               __void_t
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:525:8: note: '__void_t' declared here
struct __void_t { typedef void type; };
       ^
In file included from logistic.cpp:85:
In file included from ../inst/include/dust2/r/continuous/system.hpp:3:
In file included from ../inst/include/dust2/r/helpers.hpp:7:
../inst/include/dust2/properties.hpp:57:32: error: no template named 'void_t' in namespace 'std'; did you mean '__void_t'?
struct test_has_events<T, std::void_t<decltype(T::events)>>: std::true_type {};
                          ~~~~~^~~~~~
                               __void_t
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:525:8: note: '__void_t' declared here
struct __void_t { typedef void type; };
       ^
In file included from logistic.cpp:85:
In file included from ../inst/include/dust2/r/continuous/system.hpp:3:
In file included from ../inst/include/dust2/r/helpers.hpp:7:
../inst/include/dust2/properties.hpp:62:45: error: no template named 'is_invocable' in namespace 'std'; did you mean '__invokable'?
using test_rhs_signature_uses_delays = std::is_invocable<decltype(T::rhs), typename T::real_type, typename T::real_type*, typename T::shared_state&, typename T::internal_state&, typename dust2::ode::delay_result_type<typename T::real_type>&, typename T::real_type*>;
                                       ~~~~~^~~~~~~~~~~~
                                            __invokable
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:3955:1: note: '__invokable' declared here
using __invokable = __invokable_r<void, _Fp, _Args...>;
^
In file included from logistic.cpp:85:
In file included from ../inst/include/dust2/r/continuous/system.hpp:3:
In file included from ../inst/include/dust2/r/helpers.hpp:7:
../inst/include/dust2/properties.hpp:65:48: error: no template named 'is_invocable' in namespace 'std'; did you mean '__invokable'?
using test_output_signature_uses_delays = std::is_invocable<decltype(T::output), typename T::real_type, typename T::real_type*, typename T::shared_state&, typename T::internal_state&, typename dust2::ode::delay_result_type<typename T::real_type>&>;
                                          ~~~~~^~~~~~~~~~~~
                                               __invokable
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:3955:1: note: '__invokable' declared here
using __invokable = __invokable_r<void, _Fp, _Args...>;
^
In file included from logistic.cpp:85:
In file included from ../inst/include/dust2/r/continuous/system.hpp:3:
In file included from ../inst/include/dust2/r/helpers.hpp:7:
../inst/include/dust2/properties.hpp:76:6: warning: constexpr if is a C++17 extension [-Wc++17-extensions]
  if constexpr (test_has_delays<T>::value && test_has_output<T>::value) {
     ^
../inst/include/dust2/properties.hpp:85:6: warning: constexpr if is a C++17 extension [-Wc++17-extensions]
  if constexpr (test_has_delays<T>::value) {
     ^
../inst/include/dust2/properties.hpp:133:6: warning: constexpr if is a C++17 extension [-Wc++17-extensions]
  if constexpr (properties<T>::has_special::value) {
     ^
../inst/include/dust2/properties.hpp:142:6: warning: constexpr if is a C++17 extension [-Wc++17-extensions]
  if constexpr (properties<T>::has_output::value) {
     ^
In file included from logistic.cpp:85:
In file included from ../inst/include/dust2/r/continuous/system.hpp:8:
In file included from ../inst/include/dust2/continuous/system.hpp:12:
../inst/include/dust2/continuous/solver.hpp:190:22: warning: decomposition declarations are a C++17 extension [-Wc++17-extensions]
          const auto [had_event, t_next] = apply_events(t, h, y, events, internals);
                     ^~~~~~~~~~~~~~~~~~~
In file included from logistic.cpp:85:
In file included from ../inst/include/dust2/r/continuous/system.hpp:8:
../inst/include/dust2/continuous/system.hpp:96:8: warning: constexpr if is a C++17 extension [-Wc++17-extensions]
    if constexpr (properties<T>::is_mixed_time::value) {
       ^
../inst/include/dust2/continuous/system.hpp:380:10: warning: constexpr if is a C++17 extension [-Wc++17-extensions]
      if constexpr (rhs_uses_delays_) {
         ^
../inst/include/dust2/continuous/system.hpp:399:10: warning: constexpr if is a C++17 extension [-Wc++17-extensions]
      if constexpr (output_uses_delays_) {
         ^
../inst/include/dust2/continuous/system.hpp:419:8: warning: constexpr if is a C++17 extension [-Wc++17-extensions]
    if constexpr (has_delays_) {
       ^
13 warnings and 13 errors generated.
make: *** [logistic.o] Error 1
ERROR: compilation failed for package ‘dust2’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/dust2’
Warning in install.packages :
  installation of package ‘dust2’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/pw/9ts48jn53r14c5dldx03_5mw0000gq/T/RtmpoD4sCx/downloaded_packages’
# dust2 installation
install.packages(
  "dust2",
  type = "source",
  repos = c("https://mrc-ide.r-universe.dev", "https://cloud.r-project.org"))
#> Warning in install.packages("dust2", type = "source", repos =
#> c("https://mrc-ide.r-universe.dev", : installation of package 'dust2' had
#> non-zero exit status

devtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.2.2 (2022-10-31)
#>  os       macOS Ventura 13.1
#>  system   aarch64, darwin20
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       Australia/Perth
#>  date     2025-11-25
#>  pandoc   3.1.1 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version date (UTC) lib source
#>  cachem        1.0.7   2023-02-24 [1] CRAN (R 4.2.0)
#>  callr         3.7.3   2022-11-02 [1] CRAN (R 4.2.0)
#>  cli           3.6.5   2025-04-23 [1] CRAN (R 4.2.2)
#>  crayon        1.5.2   2022-09-29 [1] CRAN (R 4.2.0)
#>  devtools      2.4.5   2022-10-11 [1] CRAN (R 4.2.0)
#>  digest        0.6.31  2022-12-11 [1] CRAN (R 4.2.0)
#>  ellipsis      0.3.2   2021-04-29 [1] CRAN (R 4.2.0)
#>  evaluate      0.20    2023-01-17 [1] CRAN (R 4.2.0)
#>  fastmap       1.1.1   2023-02-24 [1] CRAN (R 4.2.0)
#>  fs            1.6.4   2024-04-25 [1] CRAN (R 4.2.3)
#>  glue          1.8.0   2024-09-30 [1] CRAN (R 4.2.2)
#>  htmltools     0.5.8.1 2024-04-04 [1] CRAN (R 4.2.3)
#>  htmlwidgets   1.6.4   2023-12-06 [1] CRAN (R 4.2.3)
#>  httpuv        1.6.9   2023-02-14 [1] CRAN (R 4.2.0)
#>  knitr         1.42    2023-01-25 [1] CRAN (R 4.2.0)
#>  later         1.3.0   2021-08-18 [1] CRAN (R 4.2.0)
#>  lifecycle     1.0.3   2022-10-07 [1] CRAN (R 4.2.0)
#>  magrittr      2.0.3   2022-03-30 [1] CRAN (R 4.2.0)
#>  memoise       2.0.1   2021-11-26 [1] CRAN (R 4.2.0)
#>  mime          0.12    2021-09-28 [1] CRAN (R 4.2.0)
#>  miniUI        0.1.1.1 2018-05-18 [1] CRAN (R 4.2.0)
#>  pkgbuild      1.4.0   2022-11-27 [1] CRAN (R 4.2.0)
#>  pkgload       1.3.2   2022-11-16 [1] CRAN (R 4.2.0)
#>  prettyunits   1.1.1   2020-01-24 [1] CRAN (R 4.2.0)
#>  processx      3.8.0   2022-10-26 [1] CRAN (R 4.2.0)
#>  profvis       0.3.8   2023-05-02 [1] CRAN (R 4.2.0)
#>  promises      1.2.0.1 2021-02-11 [1] CRAN (R 4.2.0)
#>  ps            1.8.0   2024-09-12 [1] CRAN (R 4.2.2)
#>  purrr         1.0.2   2023-08-10 [1] CRAN (R 4.2.0)
#>  R6            2.5.1   2021-08-19 [1] CRAN (R 4.2.0)
#>  Rcpp          1.0.13  2024-07-17 [1] CRAN (R 4.2.2)
#>  remotes       2.4.2   2021-11-30 [1] CRAN (R 4.2.0)
#>  reprex        2.0.2   2022-08-17 [1] CRAN (R 4.2.0)
#>  rlang         1.1.6   2025-04-11 [1] CRAN (R 4.2.2)
#>  rmarkdown     2.20    2023-01-19 [1] CRAN (R 4.2.0)
#>  rstudioapi    0.16.0  2024-03-24 [1] CRAN (R 4.2.3)
#>  sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.2.0)
#>  shiny         1.7.4   2022-12-15 [1] CRAN (R 4.2.0)
#>  stringi       1.7.12  2023-01-11 [1] CRAN (R 4.2.0)
#>  stringr       1.5.0   2022-12-02 [1] CRAN (R 4.2.0)
#>  urlchecker    1.0.1   2021-11-30 [1] CRAN (R 4.2.0)
#>  usethis       2.1.6   2022-05-25 [1] CRAN (R 4.2.0)
#>  vctrs         0.6.5   2023-12-01 [1] CRAN (R 4.2.3)
#>  withr         2.5.0   2022-03-03 [1] CRAN (R 4.2.0)
#>  xfun          0.43    2024-03-25 [1] CRAN (R 4.2.3)
#>  xtable        1.8-4   2019-04-21 [1] CRAN (R 4.2.0)
#>  yaml          2.3.7   2023-01-23 [1] CRAN (R 4.2.0)
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────

Created on 2025-11-25 with reprex v2.0.2

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