# Compilation error, maybe problem with Eigen and StanHeaders (Ubuntu)

**URL:** <https://discourse.mc-stan.org/t/compilation-error-maybe-problem-with-eigen-and-stanheaders-ubuntu/8221>\
**Category:** RStan\
**Created:** [March 25, 2019, 6:24pm UTC](https://discourse.mc-stan.org/t/compilation-error-maybe-problem-with-eigen-and-stanheaders-ubuntu/8221 "2019-03-25T18:24:11Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![max\_farrell](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/max_farrell/32/132_2.png) [@max\_farrell](https://discourse.mc-stan.org/u/max_farrell)\
**Post date:** [March 25, 2019, 6:24pm UTC](https://discourse.mc-stan.org/t/compilation-error-maybe-problem-with-eigen-and-stanheaders-ubuntu/8221/1 "2019-03-25T18:24:11Z")

</div>

Hi, I was working with RStan and brms a few days ago, but for some reason am running into compilation errors now.

Poking around discouse I see ben asking people to run the following code:

```
stancode <- 'data {real y_mean;} parameters {real y;} model {y ~ normal(y_mean,1);}

mod <- stan_model(model_code = stancode, verbose = TRUE)

```

This outputs the following:

```
Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! In file included from /usr/local/lib/R/site-library/RcppEigen/include/Eigen/Core:388:0,
                 from /usr/local/lib/R/site-library/RcppEigen/include/Eigen/Dense:1,
                 from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:4,
                 from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/mat/fun/Eigen_NumTraits.hpp:4,
                 from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/core/matrix_vari.hpp:4,
                 from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/core.hpp:14,
                 from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/mat.hpp:4,
                 from /usr/local/lib/R/site-library/StanHeaders/include/stan/math.hpp:4,
                 from /usr/local/lib/R/site-library/StanHeaders/include/src/stan/model/model_header.hpp:4,
                 from file20c026c4e5

```

When I try to compile my brms model I get what looks like a similar error:

```
Compiling the C++ model
Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! In file included from /usr/local/lib/R/site-library/RcppEigen/include/Eigen/Core:380:0,
                 from /usr/local/lib/R/site-library/RcppEigen/include/Eigen/Dense:1,
                 from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:4,
                 from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/mat/fun/Eigen_NumTraits.hpp:4,
                 from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/core/matrix_vari.hpp:4,
                 from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/core.hpp:14,
                 from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/mat.hpp:4,
                 from /usr/local/lib/R/site-library/StanHeaders/include/stan/math.hpp:4,
                 from /usr/local/lib/R/site-library/StanHeaders/include/src/stan/model/model_header.hpp:4,
                 from file19aa1da2c4
In addition: Warning message:
running command '/usr/lib/R/bin/R CMD SHLIB file19aa1da2c48.cpp 2> file19aa1da2c48.cpp.err.txt' had status 1 

```

I am running Ubuntu 17.10, R 3.4.2, and Rstan 2.17.3.

My Makevars contains:

CXX14FLAGS=-O3 -march=native -mtune=native -fPIC  
CXX14=g++

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [March 25, 2019, 6:29pm UTC](https://discourse.mc-stan.org/t/compilation-error-maybe-problem-with-eigen-and-stanheaders-ubuntu/8221/2 "2019-03-25T18:29:35Z")

</div>

You need to grep for the part of the message that includes the string `error:` and then tell us what that is.

---

<div class="post-metadata">

**Author:** ![max\_farrell](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/max_farrell/32/132_2.png) [@max\_farrell](https://discourse.mc-stan.org/u/max_farrell)\
**Post date:** [March 25, 2019, 6:34pm UTC](https://discourse.mc-stan.org/t/compilation-error-maybe-problem-with-eigen-and-stanheaders-ubuntu/8221/3 "2019-03-25T18:34:30Z")

</div>

Hi Ben, I’m sorry but I’m a bit confused: this is the entire message that is displayed and `error:` does not seem to appear.

Are errors sent to a separate file I’m not aware of?

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [March 25, 2019, 7:45pm UTC](https://discourse.mc-stan.org/t/compilation-error-maybe-problem-with-eigen-and-stanheaders-ubuntu/8221/4 "2019-03-25T19:45:39Z")

</div>

When you do

```
mod <- stan_model(model_code = stancode, verbose = TRUE)

```

there should be tons of output and you usually have to scroll up to get to the part about `error:`.

---

<div class="post-metadata">

**Author:** ![max\_farrell](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/max_farrell/32/132_2.png) [@max\_farrell](https://discourse.mc-stan.org/u/max_farrell)\
**Post date:** [March 27, 2019, 5:30pm UTC](https://discourse.mc-stan.org/t/compilation-error-maybe-problem-with-eigen-and-stanheaders-ubuntu/8221/5 "2019-03-27T17:30:19Z")

</div>

Hi, the line that includes `error:` is:

```
error: ‘enable_both’ is not a member of ‘boost::exception_detail’
     throw exception_detail::enable_both( e );

```

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [March 27, 2019, 9:56pm UTC](https://discourse.mc-stan.org/t/compilation-error-maybe-problem-with-eigen-and-stanheaders-ubuntu/8221/6 "2019-03-27T21:56:51Z")

</div>

OK, if your

```
packageVersion("BH")

```

is not 1.69, then try upgrading to the latest version of the **BH** package.

---

<div class="post-metadata">

**Author:** ![max\_farrell](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/max_farrell/32/132_2.png) [@max\_farrell](https://discourse.mc-stan.org/u/max_farrell)\
**Post date:** [March 28, 2019, 10:30pm UTC](https://discourse.mc-stan.org/t/compilation-error-maybe-problem-with-eigen-and-stanheaders-ubuntu/8221/7 "2019-03-28T22:30:56Z")

</div>

My BH package is version 1.69.0.1

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [March 29, 2019, 1:54am UTC](https://discourse.mc-stan.org/t/compilation-error-maybe-problem-with-eigen-and-stanheaders-ubuntu/8221/8 "2019-03-29T01:54:31Z")

</div>

> [@max\_farrell](#):
>
> throw exception\_detail::enable\_both( e );

This seems to be coming from  
[https://www.boost.org/doc/libs/1\_69\_0/boost/throw\_exception.hpp](https://www.boost.org/doc/libs/1_69_0/boost/throw_exception.hpp)  
Do you have anything about `-DBOOST_EXCEPTION_DISABLE` in your Makevars file?

---

<div class="post-metadata">

**Author:** ![max\_farrell](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/max_farrell/32/132_2.png) [@max\_farrell](https://discourse.mc-stan.org/u/max_farrell)\
**Post date:** [March 29, 2019, 1:55pm UTC](https://discourse.mc-stan.org/t/compilation-error-maybe-problem-with-eigen-and-stanheaders-ubuntu/8221/9 "2019-03-29T13:55:36Z")

</div>

No, and I tried resetting the Makevars as per the Linux Rstan installation guide. My Makevars is:

```
CXX14FLAGS=-03 -march=native -mtune=native -fPIC
CXX14=g++

```

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [March 29, 2019, 4:50pm UTC](https://discourse.mc-stan.org/t/compilation-error-maybe-problem-with-eigen-and-stanheaders-ubuntu/8221/10 "2019-03-29T16:50:50Z")

</div>

It is possible that there are incompatibilities between RStan 2.17.3 and some combination of StanHeaders 2.18.x and Boost 1.69. I would upgrade the RStan.

---

<div class="post-metadata">

**Author:** ![max\_farrell](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/max_farrell/32/132_2.png) [@max\_farrell](https://discourse.mc-stan.org/u/max_farrell)\
**Post date:** [April 1, 2019, 3:48pm UTC](https://discourse.mc-stan.org/t/compilation-error-maybe-problem-with-eigen-and-stanheaders-ubuntu/8221/11 "2019-04-01T15:48:51Z")

</div>

This worked! Thanks Ben, I’m not sure what changed to make the incompatibility show up, maybe updating of a different package plus dependencies…
