cmdstanpy icon indicating copy to clipboard operation
cmdstanpy copied to clipboard

Setting `CXXFLAGS` breaks compilation

Open WardBrian opened this issue 2 years ago • 0 comments

Summary:

>>> stan_file = os.path.join(cmdstan_path(), 'examples', 'bernoulli', 'bernoulli.stan')
>>> model = CmdStanModel(stan_file=stan_file, force_compile=True, cpp_options={"CXXFLAGS":"-march=native"})

Description:

We invoke this like make CXXFLAGS=-march=native bernoulli, but it seems the way CmdStan's makefiles are set up, this means none of the default flags are set up. Using += doesn't make it work, either.

On the command line, make CXXFLAGS=-march=native examples/bernoulli/bernoulli does not work CXXFLAGS+=-march=native make examples/bernoulli/bernoulli works

A workaround seems to be using CXXFLAGS_PROGRAM instead. This is handled by cmdstan's makefiles differently.

Additional Information:

Current Version:

1.2, CmdStan 2.34

WardBrian avatar Jan 29 '24 15:01 WardBrian