Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: PCH file uses a newer PCH format that cannot be read #636

Closed
idontgetoutmuch opened this issue Mar 25, 2022 · 2 comments
Closed

error: PCH file uses a newer PCH format that cannot be read #636

idontgetoutmuch opened this issue Mar 25, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@idontgetoutmuch
Copy link

Describe the bug

I am trying to run the example here: https://avehtari.github.io/casestudies/Motorcycle/motorcycle_gpcourse.html#

> model_gpcovf <- cmdstan_model(stan_file = file_gpcovf)
Compiling Stan program...
error: PCH file uses a newer PCH format that cannot be read

1 error generated.

make: *** [make/program:55: /tmp/Rtmp67aYAA/model-17d992624d5b1] Error 1

Error: An error occured during compilation! See the message above for more information.
In addition: Warning message:
CmdStan's precompiled header (PCH) files may need to be rebuilt.
If your model failed to compile please run rebuild_cmdstan().
If the issue persists please open a bug report. 
> rebuild_cmdstan()
rm -f -r test
rm -f 
rm -f 
rm -f 
rm -f 
  removing dependency files
rm -f src/cmdstan/main.d   stan//src/stan/model/model_header.d
rm -f   
rm -f   
  cleaning sundials targets
rm -f stan/lib/stan_math/lib/sundials_5.7.0/lib/libsundials_cvodes.a stan/lib/stan_math/lib/sundials_5.7.0/lib/libsundials_idas.a stan/lib/stan_math/lib/sundials_5.7.0/lib/libsundials_kinsol.a stan/lib/stan_math/lib/sundials_5.7.0/lib/libsundials_nvecserial.a stan/lib/stan_math/lib/sundials_5.7.0/src/cvodes/cvodea.o stan/lib/stan_math/lib/sundials_5.7.0/src/cvodes/cvodea_io.o stan/lib/stan_math/lib/sundials_5.7.0/src/cvodes/cvodes.o stan/lib/stan_math/lib/sundials_5.7.0/src/cvodes/cvodes_bandpre.o stan/lib/stan_math/lib/sundials_5.7.0/src/cvodes/cvodes_bbdpre.o stan/lib/stan_math/lib/sundials_5.7.0/src/cvodes/cvodes_diag.o stan/lib/stan_math/lib/sundials_5.7.0/src/cvodes/cvodes_direct.o stan/lib/stan_math/lib/sundials_5.7.0/src/cvodes/cvodes_io.o stan/lib/stan_math/lib/sundials_5.7.0/src/cvodes/cvodes_ls.o stan/lib/stan_math/lib/sundials_5.7.0/src/cvodes/cvodes_nls.o stan/lib/stan_math/lib/sundials_5.7.0/src/cvodes/cvodes_nls_sim.o stan/lib/stan_math/lib/sundials_5.7.0/src/cvodes/cvodes_nls_stg.o stan/lib/stan_math/lib/sundials_5.7.0/src/cvodes/cvodes_nls_stg1.o stan/lib/stan_math/lib/sundials_5.7.0/src/cvodes/cvodes_spils.o stan/lib/stan_math/lib/sundials_5.7.0/src/idas/idaa.o stan/lib/stan_math/lib/sundials_5.7.0/src/idas/idaa_io.o stan/lib/stan_math/lib/sundials_5.7.0/src/idas/idas.o stan/lib/stan_math/lib/sundials_5.7.0/src/idas/idas_bbdpre.o stan/lib/stan_math/lib/sundials_5.7.0/src/idas/idas_direct.o stan/lib/stan_math/lib/sundials_5.7.0/src/idas/idas_ic.o stan/lib/stan_math/lib/sundials_5.7.0/src/idas/idas_io.o stan/lib/stan_math/lib/sundials_5.7.0/src/idas/idas_ls.o stan/lib/stan_math/lib/sundials_5.7.0/src/idas/idas_nls.o stan/lib/stan_math/lib/sundials_5.7.0/src/idas/idas_nls_sim.o stan/lib/stan_math/lib/sundials_5.7.0/src/idas/idas_nls_stg.o stan/lib/stan_math/lib/sundials_5.7.0/src/idas/idas_spils.o stan/lib/stan_math/lib/sundials_5.7.0/src/kinsol/kinsol.o stan/lib/stan_math/lib/sundials_5.7.0/src/kinsol/kinsol_bbdpre.o stan/lib/stan_math/lib/sundials_5.7.0/src/kinsol/kinsol_direct.o stan/lib/stan_math/lib/sundials_5.7.0/src/kinsol/kinsol_io.o stan/lib/stan_math/lib/sundials_5.7.0/src/kinsol/kinsol_ls.o stan/lib/stan_math/lib/sundials_5.7.0/src/kinsol/kinsol_spils.o stan/lib/stan_math/lib/sundials_5.7.0/src/nvector/serial/nvector_serial.o stan/lib/stan_math/lib/sundials_5.7.0/src/sundials/sundials_band.o stan/lib/stan_math/lib/sundials_5.7.0/src/sundials/sundials_dense.o stan/lib/stan_math/lib/sundials_5.7.0/src/sundials/sundials_direct.o stan/lib/stan_math/lib/sundials_5.7.0/src/sundials/sundials_futils.o stan/lib/stan_math/lib/sundials_5.7.0/src/sundials/sundials_iterative.o stan/lib/stan_math/lib/sundials_5.7.0/src/sundials/sundials_linearsolver.o stan/lib/stan_math/lib/sundials_5.7.0/src/sundials/sundials_math.o stan/lib/stan_math/lib/sundials_5.7.0/src/sundials/sundials_matrix.o stan/lib/stan_math/lib/sundials_5.7.0/src/sundials/sundials_memory.o stan/lib/stan_math/lib/sundials_5.7.0/src/sundials/sundials_nonlinearsolver.o stan/lib/stan_math/lib/sundials_5.7.0/src/sundials/sundials_nvector.o stan/lib/stan_math/lib/sundials_5.7.0/src/sundials/sundials_nvector_senswrapper.o stan/lib/stan_math/lib/sundials_5.7.0/src/sundials/sundials_version.o stan/lib/stan_math/lib/sundials_5.7.0/src/sunlinsol/band/sunlinsol_band.o stan/lib/stan_math/lib/sundials_5.7.0/src/sunlinsol/dense/sunlinsol_dense.o stan/lib/stan_math/lib/sundials_5.7.0/src/sunmatrix/band/sunmatrix_band.o stan/lib/stan_math/lib/sundials_5.7.0/src/sunmatrix/dense/sunmatrix_dense.o stan/lib/stan_math/lib/sundials_5.7.0/src/sunnonlinsol/fixedpoint/sunnonlinsol_fixedpoint.o stan/lib/stan_math/lib/sundials_5.7.0/src/sunnonlinsol/newton/sunnonlinsol_newton.o
  cleaning Intel TBB targets
rm -f -rf stan/lib/stan_math/lib/tbb
rm -f bin/stanc bin/stansummary bin/print bin/diagnose
rm -f -r src/cmdstan/main*.o bin/cmdstan
rm -f stan/src/stan/model/model_header.hpp.gch
rm -f examples/bernoulli/bernoulli examples/bernoulli/bernoulli.o examples/bernoulli/bernoulli.d examples/bernoulli/bernoulli.hpp
rm -f -r 
arch: posix_spawnp: make: Bad CPU type in executable

To Reproduce

Install nix sh <(curl -L https://nixos.org/nix/install) and then nix-shell with a shell.nix:

let

rOverlay = rself: rsuper: {
  rPackages = rsuper.rPackages.override {
    overrides = {

      smcsamplers = (rself.rPackages.buildRPackage {
        name = "smcsamplers";
        src = rself.fetchFromGitHub {
          owner = "pierrejacob";
          repo = "smcsamplers";
          rev = "097192f7d5df520d9b026d442dfec493a3051374";
          sha256 = "00facn1ylcbai4sbcidpp991899csz2ppmmkv0khvqxfncddr0f2";
        };
        propagatedBuildInputs = [ rsuper.rPackages.coda rsuper.rPackages.MASS rsuper.rPackages.mvtnorm rsuper.rPackages.loo rsuper.rPackages.shape rsuper.rPackages.rstan rsuper.rPackages.tidyverse rsuper.rPackages.doParallel rsuper.rPackages.igraph rsuper.rPackages.ggraph rsuper.rPackages.doRNG rsuper.rPackages.reshape2 ];
      });

      cmdstanr = (rself.rPackages.buildRPackage {
        name = "cmdstanr";
        src = rself.fetchFromGitHub {
          owner = "stan-dev";
          repo = "cmdstanr";
          rev = "2e24ec873c5513b41fba90ee59e0dffcd27a479c";
          sha256 = "sha256:0nrqlidsrykszasdypsldsbhv4dcbrj9awyyzq7rb6kc5y8fnhvi";
        };
        propagatedBuildInputs = [ rsuper.rPackages.coda rsuper.rPackages.MASS rsuper.rPackages.mvtnorm rsuper.rPackages.loo rsuper.rPackages.shape rsuper.rPackages.rstan rsuper.rPackages.tidyverse rsuper.rPackages.doParallel rsuper.rPackages.igraph rsuper.rPackages.ggraph rsuper.rPackages.doRNG rsuper.rPackages.reshape2 rsuper.rPackages.data_table rsuper.rPackages.posterior ];
      });

    };
  };
};

in

{ nixpkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/21.11.tar.gz") {
  config.allowBroken = true;
  overlays = [ rOverlay ];
  system = "x86_64-darwin";
}
}:

let
  R-with-my-packages = nixpkgs.rWrapper.override{
    packages = with nixpkgs.rPackages; [
      tidyverse
      plotly
      jqr
      matrixStats
      aws_s3
      DBI
      RPostgres
      gapminder
      gg_gap
      DT
      TTR
      patchwork
      shiny
      shinyjs
      reshape2
      openmetrics
      dplyr
      ggplot2
      readxl
      purrr
      openxlsx

      smcsamplers
      cmdstanr
      tidybayes
      bayesplot
    ]; };

  pkgs = nixpkgs;

in

pkgs.stdenv.mkDerivation {
  name = "xxx";

  buildInputs = with pkgs.rPackages; [
    pkgs.libintlOrEmpty
    R-with-my-packages
    pkgs.darwin.apple_sdk.frameworks.Cocoa
  ];
}

Expected behavior
I would expect the example to run as shown on the website.

Operating system
Apple M1 Max macOS 12.2.1

CmdStanR version number

> packageVersion("cmdstanr")
[1] ‘0.5.0’

Additional context

@idontgetoutmuch idontgetoutmuch added the bug Something isn't working label Mar 25, 2022
@idontgetoutmuch
Copy link
Author

This fixes the problem: NixOS/nixpkgs#165765 and then I don't need system = "x86_64-darwin";.

@rok-cesnovar
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants