denis-cohen / voteswitchR

Data and Methods for Analyzing Comparative Vote Switching Data
5 stars 2 forks source link

Error compiling install #1

Open tguerra opened 7 months ago

tguerra commented 7 months ago

Hi Denis,

I encounter a problem when the compilation occurs during the installation of the package voteswitchR after running the install command:

remotes::install_github("denis-cohen/voteswitchR")

Here are the errors reported:

In file included from stanExports_vclogit_l2_type1.cc:5:
./stanExports_vclogit_l2_type1.h:300:26: error: use of undeclared identifier 'nil_index_list'
        assign(Y_flat__, nil_index_list(), context__.vals_r("Y"),
                         ^
./stanExports_vclogit_l2_type1.h:311:46: error: use of undeclared identifier 'nil_index_list'
                cons_list(index_uni(sym1__), nil_index_list())),
                                             ^
./stanExports_vclogit_l2_type1.h:329:26: error: use of undeclared identifier 'nil_index_list'
        assign(X_flat__, nil_index_list(), context__.vals_r("X"),
                         ^
./stanExports_vclogit_l2_type1.h:340:46: error: use of undeclared identifier 'nil_index_list'
                cons_list(index_uni(sym1__), nil_index_list())),
                                             ^
./stanExports_vclogit_l2_type1.h:362:25: error: use of undeclared identifier 'nil_index_list'
      assign(ones_cats, nil_index_list(), rep_vector(1.0, ncat),
                        ^
./stanExports_vclogit_l2_type1.h:371:22: error: use of undeclared identifier 'nil_index_list'
      assign(ones_D, nil_index_list(), rep_vector(1.0, D),
                     ^
./stanExports_vclogit_l2_type1.h:394:27: error: use of undeclared identifier 'nil_index_list'
      assign(X_transpose, nil_index_list(), transpose(X),
                          ^
./stanExports_vclogit_l2_type1.h:405:25: error: use of undeclared identifier 'nil_index_list'
      assign(X_varying, nil_index_list(),
                        ^
./stanExports_vclogit_l2_type1.h:408:44: error: use of undeclared identifier 'nil_index_list'
            cons_list(index_min_max(1, D), nil_index_list())), "X"),
                                           ^
./stanExports_vclogit_l2_type1.h:419:27: error: use of undeclared identifier 'nil_index_list'
      assign(Y_transpose, nil_index_list(), transpose(Y),
                          ^
./stanExports_vclogit_l2_type1.h:436:45: error: use of undeclared identifier 'nil_index_list'
                    cons_list(index_uni(l), nil_index_list())),
                                            ^
./stanExports_vclogit_l2_type1.h:441:41: error: use of undeclared identifier 'nil_index_list'
                cons_list(index_uni(l), nil_index_list())), 1,
                                        ^
./stanExports_vclogit_l2_type1.h:446:41: error: use of undeclared identifier 'nil_index_list'
                cons_list(index_uni(l), nil_index_list())), 0.0,
                                        ^
./stanExports_vclogit_l2_type1.h:452:41: error: use of undeclared identifier 'nil_index_list'
                cons_list(index_uni(l), nil_index_list())), 0,
                                        ^
./stanExports_vclogit_l2_type1.h:511:22: error: unexpected type name 'local_scalar_t__': expected expression
    stan::io::reader<local_scalar_t__> in__(params_r__, params_i__);
                     ^
./stanExports_vclogit_l2_type1.h:511:15: error: no member named 'reader' in namespace 'stan::io'
    stan::io::reader<local_scalar_t__> in__(params_r__, params_i__);
    ~~~~~~~~~~^
./stanExports_vclogit_l2_type1.h:523:51: error: use of undeclared identifier 'nil_index_list'
        assign(beta, cons_list(index_uni(sym1__), nil_index_list()),
                                                  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
12 warnings and 20 errors generated.
make: *** [stanExports_vclogit_l2_type1.o] Error 1
ERROR: compilation failed for package ‘voteswitchR’
* removing ‘/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/voteswitchR’

I have no problem compiling models with RStan/Cmdstanr/Brms models, so I think my C++ toolchain is correctly installed.

Any ideas? Thanks in advance!

g++ --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
─ Session info ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.3.2 (2023-10-31)
 os       macOS Sonoma 14.4
 system   aarch64, darwin20
 ui       RStudio
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       Europe/Paris
 date     2024-03-08
 rstudio  2023.12.1+402 Ocean Storm (desktop)
 pandoc   NA

─ Packages ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package        * version  date (UTC) lib source
 abind            1.4-5    2016-07-21 [1] CRAN (R 4.3.0)
 backports        1.4.1    2021-12-13 [1] CRAN (R 4.3.0)
 base64enc        0.1-3    2015-07-28 [1] CRAN (R 4.3.0)
 bayesplot        1.11.1   2024-02-15 [1] CRAN (R 4.3.1)
 bridgesampling   1.1-2    2021-04-16 [1] CRAN (R 4.3.0)
 brms             2.20.4   2023-09-25 [1] CRAN (R 4.3.1)
 Brobdingnag      1.2-9    2022-10-19 [1] CRAN (R 4.3.0)
 cachem           1.0.8    2023-05-01 [1] CRAN (R 4.3.0)
 callr            3.7.5    2024-02-19 [1] CRAN (R 4.3.1)
 checkmate        2.3.1    2023-12-04 [1] CRAN (R 4.3.1)
 cli              3.6.2    2023-12-11 [1] CRAN (R 4.3.1)
 coda             0.19-4.1 2024-01-31 [1] CRAN (R 4.3.1)
 codetools        0.2-19   2023-02-01 [1] CRAN (R 4.3.2)
 colorspace       2.1-0    2023-01-23 [1] CRAN (R 4.3.0)
 colourpicker     1.3.0    2023-08-21 [1] CRAN (R 4.3.0)
 crosstalk        1.2.1    2023-11-23 [1] CRAN (R 4.3.1)
 curl             5.2.1    2024-03-01 [1] CRAN (R 4.3.1)
 desc             1.4.3    2023-12-10 [1] CRAN (R 4.3.1)
 devtools         2.4.5    2022-10-11 [1] CRAN (R 4.3.0)
 digest           0.6.34   2024-01-11 [1] CRAN (R 4.3.1)
 distributional   0.4.0    2024-02-07 [1] CRAN (R 4.3.1)
 dplyr            1.1.4    2023-11-17 [1] CRAN (R 4.3.1)
 DT               0.32     2024-02-19 [1] CRAN (R 4.3.1)
 dygraphs         1.1.1.6  2018-07-11 [1] CRAN (R 4.3.0)
 ellipsis         0.3.2    2021-04-29 [1] CRAN (R 4.3.0)
 emmeans          1.10.0   2024-01-23 [1] CRAN (R 4.3.1)
 estimability     1.5      2024-02-20 [1] CRAN (R 4.3.1)
 fansi            1.0.6    2023-12-08 [1] CRAN (R 4.3.1)
 fastmap          1.1.1    2023-02-24 [1] CRAN (R 4.3.0)
 forcats          1.0.0    2023-01-29 [1] CRAN (R 4.3.0)
 fs               1.6.3    2023-07-20 [1] CRAN (R 4.3.0)
 generics         0.1.3    2022-07-05 [1] CRAN (R 4.3.0)
 ggplot2          3.5.0    2024-02-23 [1] CRAN (R 4.3.1)
 glue             1.7.0    2024-01-09 [1] CRAN (R 4.3.1)
 gridExtra        2.3      2017-09-09 [1] CRAN (R 4.3.0)
 gtable           0.3.4    2023-08-21 [1] CRAN (R 4.3.0)
 gtools           3.9.5    2023-11-20 [1] CRAN (R 4.3.1)
 htmltools        0.5.7    2023-11-03 [1] CRAN (R 4.3.1)
 htmlwidgets      1.6.4    2023-12-06 [1] CRAN (R 4.3.1)
 httpuv           1.6.14   2024-01-26 [1] CRAN (R 4.3.1)
 igraph           2.0.2    2024-02-17 [1] CRAN (R 4.3.1)
 inline           0.3.19   2021-05-31 [1] CRAN (R 4.3.0)
 jsonlite         1.8.8    2023-12-04 [1] CRAN (R 4.3.1)
 later            1.3.2    2023-12-06 [1] CRAN (R 4.3.1)
 lattice          0.21-9   2023-10-01 [1] CRAN (R 4.3.2)
 lifecycle        1.0.4    2023-11-07 [1] CRAN (R 4.3.1)
 loo              2.7.0    2024-02-24 [1] CRAN (R 4.3.1)
 magrittr         2.0.3    2022-03-30 [1] CRAN (R 4.3.0)
 markdown         1.12     2023-12-06 [1] CRAN (R 4.3.1)
 MASS             7.3-60   2023-05-04 [1] CRAN (R 4.3.2)
 Matrix           1.6-1.1  2023-09-18 [1] CRAN (R 4.3.2)
 matrixStats      1.2.0    2023-12-11 [1] CRAN (R 4.3.1)
 memoise          2.0.1    2021-11-26 [1] CRAN (R 4.3.0)
 mime             0.12     2021-09-28 [1] CRAN (R 4.3.0)
 miniUI           0.1.1.1  2018-05-18 [1] CRAN (R 4.3.0)
 multcomp         1.4-25   2023-06-20 [1] CRAN (R 4.3.0)
 munsell          0.5.0    2018-06-12 [1] CRAN (R 4.3.0)
 mvtnorm          1.2-4    2023-11-27 [1] CRAN (R 4.3.1)
 nlme             3.1-164  2023-11-27 [1] CRAN (R 4.3.1)
 pillar           1.9.0    2023-03-22 [1] CRAN (R 4.3.0)
 pkgbuild         1.4.3    2023-12-10 [1] CRAN (R 4.3.1)
 pkgconfig        2.0.3    2019-09-22 [1] CRAN (R 4.3.0)
 pkgload          1.3.4    2024-01-16 [1] CRAN (R 4.3.1)
 plyr             1.8.9    2023-10-02 [1] CRAN (R 4.3.1)
 posterior        1.5.0    2023-10-31 [1] CRAN (R 4.3.1)
 processx         3.8.3    2023-12-10 [1] CRAN (R 4.3.1)
 profvis          0.3.8    2023-05-02 [1] CRAN (R 4.3.0)
 promises         1.2.1    2023-08-10 [1] CRAN (R 4.3.0)
 ps               1.7.6    2024-01-18 [1] CRAN (R 4.3.1)
 purrr            1.0.2    2023-08-10 [1] CRAN (R 4.3.0)
 QuickJSR         1.1.3    2024-01-31 [1] CRAN (R 4.3.1)
 R6               2.5.1    2021-08-19 [1] CRAN (R 4.3.0)
 Rcpp             1.0.12   2024-01-09 [1] CRAN (R 4.3.1)
 RcppParallel     5.1.7    2023-02-27 [1] CRAN (R 4.3.0)
 remotes        * 2.4.2.1  2023-07-18 [1] CRAN (R 4.3.0)
 reshape2         1.4.4    2020-04-09 [1] CRAN (R 4.3.0)
 rlang            1.1.3    2024-01-10 [1] CRAN (R 4.3.1)
 rstan            2.32.6   2024-03-05 [1] CRAN (R 4.3.1)
 rstantools       2.4.0    2024-01-31 [1] CRAN (R 4.3.1)
 rstudioapi       0.15.0   2023-07-07 [1] CRAN (R 4.3.0)
 sandwich         3.1-0    2023-12-11 [1] CRAN (R 4.3.1)
 scales           1.3.0    2023-11-28 [1] CRAN (R 4.3.1)
 sessioninfo      1.2.2    2021-12-06 [1] CRAN (R 4.3.0)
 shiny            1.8.0    2023-11-17 [1] CRAN (R 4.3.1)
 shinyjs          2.1.0    2021-12-23 [1] CRAN (R 4.3.0)
 shinystan        2.6.0    2022-03-03 [1] CRAN (R 4.3.0)
 shinythemes      1.2.0    2021-01-25 [1] CRAN (R 4.3.0)
 StanHeaders      2.32.6   2024-03-01 [1] CRAN (R 4.3.1)
 stringi          1.8.3    2023-12-11 [1] CRAN (R 4.3.1)
 stringr          1.5.1    2023-11-14 [1] CRAN (R 4.3.1)
 survival         3.5-7    2023-08-14 [1] CRAN (R 4.3.2)
 tensorA          0.36.2.1 2023-12-13 [1] CRAN (R 4.3.1)
 TH.data          1.1-2    2023-04-17 [1] CRAN (R 4.3.0)
 threejs          0.3.3    2020-01-21 [1] CRAN (R 4.3.0)
 tibble           3.2.1    2023-03-20 [1] CRAN (R 4.3.0)
 tidyselect       1.2.0    2022-10-10 [1] CRAN (R 4.3.0)
 urlchecker       1.0.1    2021-11-30 [1] CRAN (R 4.3.0)
 usethis          2.2.3    2024-02-19 [1] CRAN (R 4.3.1)
 utf8             1.2.4    2023-10-22 [1] CRAN (R 4.3.1)
 V8               4.4.2    2024-02-15 [1] CRAN (R 4.3.1)
 vctrs            0.6.5    2023-12-01 [1] CRAN (R 4.3.1)
 xtable           1.8-4    2019-04-21 [1] CRAN (R 4.3.0)
 xts              0.13.2   2024-01-21 [1] CRAN (R 4.3.1)
 zoo              1.8-12   2023-04-13 [1] CRAN (R 4.3.0)
denis-cohen commented 7 months ago

Hi Tristan, thanks for raising this issue, and apologies for the delay -- I was out of office these past two weeks. I will look into this soon!

denis-cohen commented 7 months ago

Hi Tristan,

I have updated the package and recompiled the Stan programs (along with some other updates; see here). In case you still encounter any Stan-related problems upon running remotes::install_github("denis-cohen/voteswitchR"), I suggest you proceed as follows:

  1. Download the voteswitchR repo
  2. Manually delete the contents of the src/ folder
  3. Open voteswitchR.Rproj in RStudio
  4. Install the package locally by running the following in the RStudio Terminal
cd "../"
R CMD INSTALL voteswitchR --preclean

Hope this helps!

Best, Denis