"error: unknown type name 'Dl_info'": Another CmdStan installation issue on Mac (Ventura, Intel)

Hi all, I’m trying to install CmdStan for the first time for a course. I’ve run into a problem and I can’t find anything useful in the documentation, here at discourse.mc-stan.org, or at StackOverflow, and it’s stumped my supervisor as well. Any guidance that those here could provide would be greatly appreciated.

The installation is on a 2019 16" MacBook Pro, with Intel i9 CPU, and MacOS Ventura 13.1. I am running R 4.2.2 (2022-10-31) in RStudio 2022.12.0+353.

I used

cmdstanr::install_cmdstan()

to install CmdStan 2.31.0. It indicated that “The C++ toolchain required for CmdStan is setup properly!” and built part way before failing. I can provide the full output if that would be useful, but the part immediately preceding the error is:

clang++ -o concurrent_hash_map.o -c -MMD -O2 -DUSE_PTHREAD -DDO_ITT_NOTIFY -stdlib=libc++ -m64 -mrtm -mmacosx-version-min=10.11  -fPIC  -D__TBB_BUILD=1 -Wall -Wno-non-virtual-dtor -Wno-dangling-else -Wno-unknown-warning-option -Wno-deprecated-copy   -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -std=c++1y  -I../tbb_2020.3/src -I../tbb_2020.3/src/rml/include -I../tbb_2020.3/include ../tbb_2020.3/src/tbb/concurrent_hash_map.cpp
clang++ -o concurrent_queue.o -c -MMD -O2 -DUSE_PTHREAD -DDO_ITT_NOTIFY -stdlib=libc++ -m64 -mrtm -mmacosx-version-min=10.11  -fPIC  -D__TBB_BUILD=1 -Wall -Wno-non-virtual-dtor -Wno-dangling-else -Wno-unknown-warning-option -Wno-deprecated-copy   -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -std=c++1y  -I../tbb_2020.3/src -I../tbb_2020.3/src/rml/include -I../tbb_2020.3/include ../tbb_2020.3/src/tbb/concurrent_queue.cpp
clang++ -o concurrent_vector.o -c -MMD -O2 -DUSE_PTHREAD -DDO_ITT_NOTIFY -stdlib=libc++ -m64 -mrtm -mmacosx-version-min=10.11  -fPIC  -D__TBB_BUILD=1 -Wall -Wno-non-virtual-dtor -Wno-dangling-else -Wno-unknown-warning-option -Wno-deprecated-copy   -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -std=c++1y  -I../tbb_2020.3/src -I../tbb_2020.3/src/rml/include -I../tbb_2020.3/include ../tbb_2020.3/src/tbb/concurrent_vector.cpp
clang++ -o dynamic_link.o -c -MMD -O2 -DUSE_PTHREAD -DDO_ITT_NOTIFY -stdlib=libc++ -m64 -mrtm -mmacosx-version-min=10.11  -fPIC  -D__TBB_BUILD=1 -Wall -Wno-non-virtual-dtor -Wno-dangling-else -Wno-unknown-warning-option -Wno-deprecated-copy   -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -std=c++1y  -I../tbb_2020.3/src -I../tbb_2020.3/src/rml/include -I../tbb_2020.3/include ../tbb_2020.3/src/tbb/dynamic_link.cpp
../tbb_2020.3/src/tbb/dynamic_link.cpp:300:9: error: unknown type name 'Dl_info'
        Dl_info dlinfo;
        ^
../tbb_2020.3/src/tbb/dynamic_link.cpp:436:9: error: unknown type name 'Dl_info'
        Dl_info info;
        ^
2 errors generated.
make[1]: *** [dynamic_link.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [stan/lib/stan_math/lib/tbb/tbb.def] Error 2

Warning message:
There was a problem during installation. See the error message(s) above. 

Since dynamic links appear to be the issue, I should note that I did get clang warnings with each of the lines that (if I’m reading the output properly) built stansummary, print, and diagnose, to the effect:

clang: warning: -Wl,-L,/PATH/TO/.cmdstan/cmdstan-2.31.0/stan/lib/stan_math/lib/tbb: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -Wl,-rpath,/PATH/TO/.cmdstan/cmdstan-2.31.0/stan/lib/stan_math/lib/tbb: 'linker' input unused [-Wunused-command-line-argument]

I have tried make clean-all/make build from the Terminal, but that failed almost immediately:

cp bin/mac-stanc bin/stanc
chmod +x bin/stanc
xattr -d com.apple.quarantine bin/stanc
xattr: bin/stanc: No such xattr: com.apple.quarantine
make: [bin/stanc] Error 1 (ignored)
clang++ -pipe   -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT  -O3 -I stan/lib/stan_math/lib/sundials_6.1.1/include -I stan/lib/stan_math/lib/sundials_6.1.1/src/sundials -DNO_FPRINTF_OUTPUT     -O3  -c -x c -include stan/lib/stan_math/lib/sundials_6.1.1/include/stan_sundials_printf_override.hpp stan/lib/stan_math/lib/sundials_6.1.1/src/nvector/serial/nvector_serial.c -o stan/lib/stan_math/lib/sundials_6.1.1/src/nvector/serial/nvector_serial.o
clang++ -pipe   -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT  -O3 -I stan/lib/stan_math/lib/sundials_6.1.1/include -I stan/lib/stan_math/lib/sundials_6.1.1/src/sundials -DNO_FPRINTF_OUTPUT     -O3  -c -x c -include stan/lib/stan_math/lib/sundials_6.1.1/include/stan_sundials_printf_override.hpp stan/lib/stan_math/lib/sundials_6.1.1/src/sundials/sundials_math.c -o stan/lib/stan_math/lib/sundials_6.1.1/src/sundials/sundials_math.o
ar -rs stan/lib/stan_math/lib/sundials_6.1.1/lib/libsundials_nvecserial.a stan/lib/stan_math/lib/sundials_6.1.1/src/nvector/serial/nvector_serial.o stan/lib/stan_math/lib/sundials_6.1.1/src/sundials/sundials_math.o
ar: creating archive stan/lib/stan_math/lib/sundials_6.1.1/lib/libsundials_nvecserial.a
ar: temporary file: No such file or directory
make: *** [stan/lib/stan_math/lib/sundials_6.1.1/lib/libsundials_nvecserial.a] Error 1

I have also tried reinstalling using

cmdstanr::install_cmdstan(overwrite = T)

and that gave the same results as the first time, breaking at the same point.

Despite the fact that the check on the toolchain said it was OK, we’re suspicious that something in that may be the problem. I had initially tried using macos-rtools-4.0.0 to install the toolchain, but that had failed, so I set it up following the manual procedure. It did work for the purposes of RStan, however, as the example stan_model compiled properly.

I’ve also just noticed (while pulling up info for this post) that the platform listed for my R session is “x86_64-apple-darwin17.0 (64-bit)”, while the target for my clang (and the actual kernel version running) is “x86_64-apple-darwin22.2.0”. I don’t know if that might make any difference.

If I have neglected to provide any needed information, my apologies in advance, and please let me know.

Many thanks for any help you can provide.