Discussion:
[Rcpp-devel] Request for an update of BH
Jordi Molins
2018-10-23 14:19:11 UTC
Permalink
Hello,

I am trying to use eigen and boost at the same time, in R (Windows). The
reason is that eigen allows now data types such as float128.

What happens is that this link between eigen and boost is new (boost 1.68).
I believe BH uses boost 1.66.

I received an answer in stackoverflow:

https://stackoverflow.com/questions/52871038/using-boost-multiprecision-with-rcppeigen/52887046?noredirect=1#comment92801003_52887046

of how to install boost 1.68 without needing BH. I have tried to implement
that solution, but it does not work: I get an error message such as
"c:/rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
cannot find -lgfortran collect2.exe: error: ld returned 1 exit status". And
now I do not know how to solve this "cannot find -lgfortran" issue (note:
this could be entangled with the fact that I substituted the gcc 4.9
compiler in Rtools for gcc 8.1, since I could not compile a single
sourceCpp with gcc 4.9, but yes with gcc 8.1; I can perfectly compile Rcpp
projects, though).

So, I would like to kindly ask if BH could be updated to boost 1.68. I
understand that updating BH must be a big work, and we all have many things
to do. But I see usually BH is updated twice per year, and this year there
has been one update so far. Also, the union of BH and eigen is possibly a
source of happiness for this community, since AFAIK, so far BH and eigen
were completely separated.

Of course, if this request cannot be executed, I am happy too. I am just
asking in case somebody could do it without too much work, and in fact, he
was thinking in doing it anyway.

Best regards

Jordi Molins i Coronado
+34 69 38 000 59
Jordi Molins
2018-10-23 15:10:26 UTC
Permalink
An update: it really seems the problem was in updating gcc to 8.1. I have
installed Rtools again, and now, following the steps in the link above, I
have been able to successfully compile code with the line " #include
<boost/multiprecision/eigen.hpp> ". I will check now if I can use code
(there is nothing of boost in the code, so far, apart from the include).

So, my request is not urgent now. Of course, I will be delighted with a new
BH version.

Jordi Molins i Coronado
+34 69 38 000 59


On Tue, Oct 23, 2018 at 4:19 PM Jordi Molins <
Post by Jordi Molins
Hello,
I am trying to use eigen and boost at the same time, in R (Windows). The
reason is that eigen allows now data types such as float128.
What happens is that this link between eigen and boost is new (boost
1.68). I believe BH uses boost 1.66.
https://stackoverflow.com/questions/52871038/using-boost-multiprecision-with-rcppeigen/52887046?noredirect=1#comment92801003_52887046
of how to install boost 1.68 without needing BH. I have tried to implement
cannot find -lgfortran collect2.exe: error: ld returned 1 exit status".
And now I do not know how to solve this "cannot find -lgfortran" issue
(note: this could be entangled with the fact that I substituted the gcc 4.9
compiler in Rtools for gcc 8.1, since I could not compile a single
sourceCpp with gcc 4.9, but yes with gcc 8.1; I can perfectly compile Rcpp
projects, though).
So, I would like to kindly ask if BH could be updated to boost 1.68. I
understand that updating BH must be a big work, and we all have many things
to do. But I see usually BH is updated twice per year, and this year there
has been one update so far. Also, the union of BH and eigen is possibly a
source of happiness for this community, since AFAIK, so far BH and eigen
were completely separated.
Of course, if this request cannot be executed, I am happy too. I am just
asking in case somebody could do it without too much work, and in fact, he
was thinking in doing it anyway.
Best regards
Jordi Molins i Coronado
+34 69 38 000 59
Jordi Molins
2018-10-24 08:37:45 UTC
Permalink
An update on this thread:

I successfully compiled a function with the line " #include
<boost/multiprecision/eigen.hpp> ". I have also been able to compile a
(non-exported) function that gives as an output a
"Eigen::Matrix<boost::multiprecision::float128, Eigen::Dynamic, 4>".

However, when I try to export an auxiliary function that casts the float128
into a double, I get an error message saying "RcppExports.cpp:11:108:
error: 'boost' was not declared in this scope".

So, it seems that in RcppExports, the compiler does not "understand" that
boost exists. Since I have not used BH, since BH uses boost 1.66, and only
boost 1.68 has the include that combines eigen and boost, I assume that the
problem is that, in some unknown way to me, I should tell the compiler that
at RcppExports it should use the includes of boost in my cpp file:

#include <boost/multiprecision/float128.hpp>
#include <boost/multiprecision/eigen.hpp>

But RcppExports only have:

#include <RcppArmadillo.h>#include <RcppEigen.h>#include <Rcpp.h>

What should I do, in order to tell the compiler that in RcppExports, boost
should be "understood"?

The question has also been posted in stackoverflow, since my initial
question was posted there, but I think that rcppdevel is probably a better
place to ask this question:

https://stackoverflow.com/questions/52964042/boost-is-not-recognized-in-r-when-exporting

Best

Jordi Molins i Coronado
+34 69 38 000 59


On Tue, Oct 23, 2018 at 5:10 PM Jordi Molins <
Post by Jordi Molins
An update: it really seems the problem was in updating gcc to 8.1. I have
installed Rtools again, and now, following the steps in the link above, I
have been able to successfully compile code with the line " #include
<boost/multiprecision/eigen.hpp> ". I will check now if I can use code
(there is nothing of boost in the code, so far, apart from the include).
So, my request is not urgent now. Of course, I will be delighted with a
new BH version.
Jordi Molins i Coronado
+34 69 38 000 59
On Tue, Oct 23, 2018 at 4:19 PM Jordi Molins <
Post by Jordi Molins
Hello,
I am trying to use eigen and boost at the same time, in R (Windows). The
reason is that eigen allows now data types such as float128.
What happens is that this link between eigen and boost is new (boost
1.68). I believe BH uses boost 1.66.
https://stackoverflow.com/questions/52871038/using-boost-multiprecision-with-rcppeigen/52887046?noredirect=1#comment92801003_52887046
of how to install boost 1.68 without needing BH. I have tried to
implement that solution, but it does not work: I get an error message such
cannot find -lgfortran collect2.exe: error: ld returned 1 exit status".
And now I do not know how to solve this "cannot find -lgfortran" issue
(note: this could be entangled with the fact that I substituted the gcc 4.9
compiler in Rtools for gcc 8.1, since I could not compile a single
sourceCpp with gcc 4.9, but yes with gcc 8.1; I can perfectly compile Rcpp
projects, though).
So, I would like to kindly ask if BH could be updated to boost 1.68. I
understand that updating BH must be a big work, and we all have many things
to do. But I see usually BH is updated twice per year, and this year there
has been one update so far. Also, the union of BH and eigen is possibly a
source of happiness for this community, since AFAIK, so far BH and eigen
were completely separated.
Of course, if this request cannot be executed, I am happy too. I am just
asking in case somebody could do it without too much work, and in fact, he
was thinking in doing it anyway.
Best regards
Jordi Molins i Coronado
+34 69 38 000 59
Dirk Eddelbuettel
2018-10-24 10:44:01 UTC
Permalink
On 24 October 2018 at 10:37, Jordi Molins wrote:
| So, it seems that in RcppExports, the compiler does not "understand" that
| boost exists. Since I have not used BH, since BH uses boost 1.66, and only
| boost 1.68 has the include that combines eigen and boost, I assume that the
| problem is that, in some unknown way to me, I should tell the compiler that
| at RcppExports it should use the includes of boost in my cpp file:
|
| #include <boost/multiprecision/float128.hpp>
| #include <boost/multiprecision/eigen.hpp>
|
| But RcppExports only have:
|
| #include <RcppArmadillo.h>#include <RcppEigen.h>#include <Rcpp.h>
|
| What should I do, in order to tell the compiler that in RcppExports, boost
| should be "understood"?

See the Rcpp Attributes vignette, Section 2.5 'Types in Generated Code':
You can use a file inst/include/yourpackagename_types.h to declare this.
Substitute yourpackagename for the name of your package.

Dirk
--
http://dirk.eddelbuettel.com | @eddelbuettel | ***@debian.org
Jordi Molins
2018-10-24 12:52:44 UTC
Permalink
Thank you, this answer has been helpful, now it works.

I have also deleted the corresponding post in stackoverflow, to avoid
duplications.


Jordi Molins i Coronado
+34 69 38 000 59
Post by Dirk Eddelbuettel
| So, it seems that in RcppExports, the compiler does not "understand" that
| boost exists. Since I have not used BH, since BH uses boost 1.66, and only
| boost 1.68 has the include that combines eigen and boost, I assume that the
| problem is that, in some unknown way to me, I should tell the compiler that
|
| #include <boost/multiprecision/float128.hpp>
| #include <boost/multiprecision/eigen.hpp>
|
|
| #include <RcppArmadillo.h>#include <RcppEigen.h>#include <Rcpp.h>
|
| What should I do, in order to tell the compiler that in RcppExports, boost
| should be "understood"?
You can use a file inst/include/yourpackagename_types.h to declare this.
Substitute yourpackagename for the name of your package.
Dirk
--
Dirk Eddelbuettel
2018-10-24 11:20:04 UTC
Permalink
On 23 October 2018 at 16:19, Jordi Molins wrote:
| So, I would like to kindly ask if BH could be updated to boost 1.68. I

This is open source. We do not hide anything from you.

There is even some documentation in the README.md of the repo about how to
update to at least create a local repo:

If needed, the script local/script/CreateBoost.sh can be used to update a
forked version to a newer version of Boost.

You could try that.

I will update BH to 1.68 (or 1.69 or ...) but I don't see a pressing need
just yet.

Dirk
--
http://dirk.eddelbuettel.com | @eddelbuettel | ***@debian.org
Continue reading on narkive:
Loading...