[R-pkg-devel] BH windows compilation issues in R devel

Frantisek Bartos |@b@rto@96 @end|ng |rom gm@||@com
Tue Jan 19 23:35:30 CET 2021


thanks for the quick response Dirk,

I did more digging and found that the error is caused by a single line (in
bold bellow, commenting it out and defining log_lik = 0 does not trigger
the error) but I have absolutely no idea why it is creating the problems

#include "DTboost.h"
#include <util/nainf.h>
#include <cmath>
#include <rng/RNG.h>
#include <boost/math/distributions/non_central_t.hpp>

using std::vector;
using std::log;
using boost::math::non_central_t;
using boost::math::pdf;

namespace jags {
namespace weightedt {

DTboost::DTboost() : VectorDist("dnt_boost", 3) {}

// some additional functions

double DTboost::logDensity(double const *x, unsigned int length, PDFType
type,
 vector<double const *> const &par,
 vector<unsigned int> const &len,
 double const *lower, double const *upper) const
{
  // the sigma parameter is ignored
  double ncp   = *par[0];
  double df    = *par[2];

  // create the boost distribution
  non_central_t t_dist(df, ncp);

  // compute the log likelihood
*  double log_lik = log(pdf(t_dist, *x));*

  return log_lik;
}

// some additional functions

On Tue, 19 Jan 2021 at 22:32, Dirk Eddelbuettel <edd using debian.org> wrote:

>
> On 19 January 2021 at 21:51, Frantisek Bartos wrote:
> | I wanted to submit a new version of my package and I encountered issues
> | with boost when compiling it on R devel version for windows. (Please
> excuse
> | my stupidity, but I'm a complete noob in regards to compilers and C++)
> |
> | A full error stack is accessible here (the Debian one worked without
> | issues):
> |
> https://win-builder.r-project.org/incoming_pretest/RoBMA_1.2.0_20210119_161819/Windows/00install.out
>
> It's actually a _linker_ error, see the 'multiple definitions' hint:
>
> D:/Compiler/rtools40/mingw32/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe:
> D:/Compiler/rtools40/mingw32/bin/../lib/gcc/i686-w64-mingw32/8.3.0/libstdc++.a(cow-stdexcept.o):(.text$_ZNSt13runtime_errorC2ERKS_+0x0):
> multiple definition of
> `std::runtime_error::runtime_error(std::runtime_error const&)';
> distributions/DTboost.o:DTboost.cc:(.text$_ZNSt13runtime_errorC2ERKS_[__ZNSt13runtime_errorC2ERKS_]+0x0):
> first defined here
>
> I have had similar issues when including something twice or more times that
> was meant to be included only once. It could also be a setup issue. Bit
> hard
> to tell but I don't have spare cycles to dig deeper now.
>
> Dirk
>
> | I checked that removing all C++ code that contains anything boost related
> | resolves the issue, however, I did not encounter this error before.
> |
> | An updated version of the code is accessible at GitHub
> | https://github.com/FBartos/RoBMA
> |
> | Thanks,
> | Frantisek
> |
> |       [[alternative HTML version deleted]]
> |
> | ______________________________________________
> | R-package-devel using r-project.org mailing list
> | https://stat.ethz.ch/mailman/listinfo/r-package-devel
>
> --
> https://dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org
>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list