Compiling error after upgrading to MacOS Big Sur

Hello,

I’ve been using PySTAN for over a year. However, I started getting compilation errors right after I performed Apple’s software update (upgrade to Big Sur):

command 'x86_64-apple-darwin13.4.0-clang++' failed with exit status 1

I tried many solution suggestions such as uninstalling and reinstalling anaconda, followed by:

conda create -n stan_env python=3.7 -c conda-forge
conda activate stan_env
conda install pystan -c conda-forge

conda install clang_osx-64 clangxx_osx-64 -c conda-forge
export CC=x86_64-apple-darwin13.4.0-clang
export CXX=x86_64-apple-darwin13.4.0-clang++

but to no avail, just changing the exit status to 1 which was something like 240 before…

I’m using this setup:

  • MacOS Big Sur 11.0.1 (I was using MacOS Catalina 10.15.7 before the upgrade)
  • Python 3.7.6
  • PyStan 2.19.1.1

Thank you in advance.

1 Like

Thanks for the info.

Can you first try pip install pystan in that env?

(CmdStanR has been working normally --> CmdStanPy should work)

This might be some error with compiler or python+compiler.

If you use verbose=True, do you see any C++ errors (see terminal if you use jupyter)

I first tried pip install pystan as you suggested, but the resulting error message is the same.

Even when I use verbose=False, there are so many lines flowing on the screen while compiling which I have never seen before even though as I said before I’m rigorously using pystan for more than a year. This is the last few lines when I switch to verbose=True:

152 warnings generated. x86_64-apple-darwin13.4.0-clang++ -bundle -undefined dynamic_lookup -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/opt/anaconda3/envs/stan_env/lib -L/opt/anaconda3/envs/stan_env/lib -flto -Wl,-export_dynamic -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/opt/anaconda3/envs/stan_env/lib -L/opt/anaconda3/envs/stan_env/lib -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/opt/anaconda3/envs/stan_env/lib -L/opt/anaconda3/envs/stan_env/lib -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /opt/anaconda3/envs/stan_env/include -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -isystem /opt/anaconda3/envs/stan_env/include -arch x86_64 /var/folders/5h/05bld9s94p9f2yts8__07jtwp00nfd/T/pystan__h6c4o3z/var/folders/5h/05bld9s94p9f2yts8__07jtwp00nfd/T/pystan__h6c4o3z/stanfit4anon_model_5944b02c79788fa0db5b3a93728ca2bf_7451425786530191539.o -o /var/folders/5h/05bld9s94p9f2yts8__07jtwp00nfd/T/pystan__h6c4o3z/stanfit4anon_model_5944b02c79788fa0db5b3a93728ca2bf_7451425786530191539.cpython-37m-darwin.so ld: warning: -pie being ignored. It is only used when linking a main executable ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd' for architecture x86_64 clang-10: error: linker command failed with exit code 1 (use -v to see invocation)

That clang-10:error is the only thing I saw with ‘error’ in it, so I’m not sure I’m seeing any C++ errors. I skimmed through the output in the terminal and it’s full of things like this:

/opt/anaconda3/envs/stan_env/lib/python3.7/site-packages/pystan/stan/src/stan/services/experimental/advi/meanfield.hpp:87:20: note: in instantiation of member function 'stan::variational::advi<anon_model_5944b02c79788fa0db5b3a93728ca2bf_namespace::anon_model_5944b02c79788fa0db5b3a93728ca2bf, stan::variational::normal_meanfield, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >::run' requested here cmd_advi.run(eta, adapt_engaged, adapt_iterations, ^ /opt/anaconda3/envs/stan_env/lib/python3.7/site-packages/pystan/stan_fit.hpp:1388:15: note: in instantiation of function template specialization 'stan::services::experimental::advi::meanfield<anon_model_5944b02c79788fa0db5b3a93728ca2bf_namespace::anon_model_5944b02c79788fa0db5b3a93728ca2bf>' requested here ::meanfield(model, *init_context_ptr, ^ /opt/anaconda3/envs/stan_env/lib/python3.7/site-packages/pystan/stan_fit.hpp:1649:15: note: in instantiation of function template specialization 'pystan::(anonymous namespace)::command<anon_model_5944b02c79788fa0db5b3a93728ca2bf_namespace::anon_model_5944b02c79788fa0db5b3a93728ca2bf, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >' requested here ret = command(args, model_, holder, names_oi_tidx_, ^ /var/folders/5h/05bld9s94p9f2yts8__07jtwp00nfd/T/pystan__h6c4o3z/stanfit4anon_model_5944b02c79788fa0db5b3a93728ca2bf_7451425786530191539.cpp:9486:34: note: in instantiation of member function 'pystan::stan_fit<anon_model_5944b02c79788fa0db5b3a93728ca2bf_namespace::anon_model_5944b02c79788fa0db5b3a93728ca2bf, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >::call_sampler' requested here __pyx_t_15 = __pyx_v_fitptr->call_sampler((*__pyx_v_argsptr), (*__pyx_v_holderptr)); ^ In file included from /var/folders/5h/05bld9s94p9f2yts8__07jtwp00nfd/T/pystan__h6c4o3z/stanfit4anon_model_5944b02c79788fa0db5b3a93728ca2bf_7451425786530191539.cpp:702: In file included from /opt/anaconda3/envs/stan_env/lib/python3.7/site-packages/pystan/py_var_context.hpp:12: In file included from /opt/anaconda3/envs/stan_env/lib/python3.7/site-packages/pystan/stan/src/stan/io/dump.hpp:6: In file included from /opt/anaconda3/envs/stan_env/lib/python3.7/site-packages/pystan/stan/lib/stan_math/stan/math/prim/mat.hpp:336: In file included from /opt/anaconda3/envs/stan_env/lib/python3.7/site-packages/pystan/stan/lib/stan_math/stan/math/prim/mat/prob/poisson_log_glm_log.hpp:5: /opt/anaconda3/envs/stan_env/lib/python3.7/site-packages/pystan/stan/lib/stan_math/stan/math/prim/mat/prob/poisson_log_glm_lpmf.hpp:64:59: warning: unused typedef 'T_alpha_val' [-Wunused-local-typedef] typename partials_return_type<T_alpha>::type>::type T_alpha_val;

Again, these are things that I’ve never encountered in Stan before.

Ok, something wrong with the xcode commandline tools.

I’m not sure if there are any instructions for Big Sur, but maybe this could help https://stackoverflow.com/questions/63592445/ld-unsupported-tapi-file-type-tapi-tbd-in-yaml-file

2 Likes

Spot on diagnosis! Thank you! Doing the following as it’s suggested in the link you sent:

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

then a clean installation of Anaconda and PyStan solved the issue.

Thank you so much!

3 Likes