Errors during compile

Changed computers and getting two errors during compile to cmdStan from Matlab:
Error using StanModel/compile (line 908)
error: half args and returns was enabled in PCH file but is currently disabled
error: PCH file was compiled for the target ‘arm64-apple-macosx11.0.0’ but the current translation
unit is being compiled for target ‘x86_64-apple-macosx11.0.0’

I’m guessing the second error is due to trying to migrate the Matlab version to the new computer and hope I’ll be able to solve it with a fresh install.

I’m puzzled by the first one. I don’t know what half args and returns are in this context and not sure how to enable them. I presume this error is related Xcode, but not sure.

If you are reporting a bug (thank you!) please use the issue tracker (github.com/stan-dev/cmdstan/issues) instead of the forums.

code_to_run_your_model(if_applicable)

If possible, add also code to simulate data or attach a (subset of) the dataset you work with.

Please provide this additional information in addition to your question:

  • Operating System:
  • CmdStan Version:
  • Compiler/Toolkit:

Don’t forget to add relevant tags to your topic (top right of this form) especially for application area. Delete this text before posting your topic. Thx!

Looking forward to your topic!

Hi,

you need to rebuild cmdstan when you get an error mentioning PCH.

make clean-all
make build -j4

Looks like I’m running into a serious issues here. Reinstalling Matlab files did not fix anything. In fact, since there is practically no installation (just a download of scripts), I realize now it was silly to expect it would fix anything.

I tried rebuilding the CmdStan (both 2.24.1 and 2.26.0 versions), but to no avail.

The build seems to work, but generates 10 warnings:
ld: warning: cannot export hidden symbol typeinfo for tbb::tbb_exception from task_group_context.o

ld: warning: cannot export hidden symbol typeinfo name for tbb::tbb_exception from task_group_context.o

ld: warning: cannot export hidden symbol typeinfo name for tbb::empty_task from arena.o

ld: warning: cannot export hidden symbol typeinfo for tbb::empty_task from arena.o

ld: warning: cannot export hidden symbol typeinfo name for tbb::empty_task from scheduler.o

ld: warning: cannot export hidden symbol typeinfo name for tbb::tbb_exception from scheduler.o

ld: warning: cannot export hidden symbol typeinfo for tbb::empty_task from scheduler.o

ld: warning: cannot export hidden symbol typeinfo for tbb::tbb_exception from scheduler.o

10 warnings generated.

— CmdStan v2.26.0 built —

murataydin@Murats-MBP3 cmdstan-2.26.0 %

I wonder if the CmdStan has been tested on the Apple M1 chip. I’m getting a sense that this problem might be related to the new laptop not having an Intel chip anymore.

discussion here: Anyone planning on getting an M1 machine to benchmark? - #5 by rok_cesnovar

I made a post under that topic. Perhaps other M1 users encountered similar errors.

I now suspect I’m running into issues because Matlab is x86 and goes through rosetta, but Xcode c++ is arm64.

Perhaps, I can bypass by using an x86 c++. Any suggestions?

That seems plausible yes.

You can use cmdstan directly in the command line or the cmdstanr wrapper for R or cmdstanpy wrapper for python.

2 Likes

CmdStanR will still need Xcode c++ right, R wrapper is arm64 then?

I will try the command line approach first.

We know the CmdStanR approach does work on M1, but the command line approach will be cleanest to start.

There is another twist.

It looks like I did not install the command line tools when I installed Xcode.

My clang++ version is Apple clang-1200.0.32.29.

But I was using GNU make 3.81 to build CmdStan, which may be x86 (I see a note that says built for i386-apple-darwin11.3.0).

The problem had nothing to do with Matlab wrapper in the end. I was able to solve it by building CmdStan from within Xcode.

1 Like