[R-pkg-devel] CRAN's mysterious behavior building OS/X binaries for OpenMx

Joshua N Pritikin jpritikin @ending from pobox@com
Tue Sep 25 15:16:41 CEST 2018

We finally figured out why our binaries were failing to build on OS/X, 
after more than a year of misery.

We use C++ exceptions and try/catch blocks like this,

                try {
                     // stuff here
                } catch (const std::exception& e) {

This works great with gcc, but whatever version of clang used by CRAN
doesn't like this code. The exception is not caught. So, instead, we have
to write

                try {
                     // stuff here
                } catch (const std::exception& e) {
                     // gcc gets here
                } catch (...) {
                     // clang gets here

which works on both compilers. I don't know why clang skips the first
catch clause.

Joshua N. Pritikin, Ph.D.
Virginia Institute for Psychiatric and Behavioral Genetics
Virginia Commonwealth University
PO Box 980126
800 E Leigh St, Biotech One, Suite 1-133
Richmond, VA 23219

More information about the R-package-devel mailing list