cecilekremer / BMABMDR

R package for bayesian model averaging in benchmark dose estimation
GNU Affero General Public License v3.0
0 stars 3 forks source link

Fix ubuntu build #83

Closed mvarewyck closed 8 months ago

mvarewyck commented 10 months ago

Current error:

ERROR: 'configure' exists but is not executable -- see the 'R Installation and Administration Manual'

Solution:

https://discourse.mc-stan.org/t/rstan-based-package-github-action-error-configure-exists-but-is-not-executable/21352/8

mvarewyck commented 10 months ago

I can't compile the package locally. Building it via the Github action gives me the same error

as: unrecognized option '-mbig-obj'
make: *** [/opt/R/4.3.2/lib/R/etc/Makeconf:200: RcppExports.o] Error 1
ERROR: compilation failed for package ‘BMABMDR’

@cecilekremer Any idea?

mvarewyck commented 10 months ago

I can't compile the package locally. Building it via the Github action gives me the same error

as: unrecognized option '-mbig-obj'
make: *** [/opt/R/4.3.2/lib/R/etc/Makeconf:200: RcppExports.o] Error 1
ERROR: compilation failed for package ‘BMABMDR’

Frome here

you need version 2.30 of GNU binutils (in version 2.25 linking can hang)

mvarewyck commented 10 months ago

I can't compile the package locally. Building it via the Github action gives me the same error

as: unrecognized option '-mbig-obj'
make: *** [/opt/R/4.3.2/lib/R/etc/Makeconf:200: RcppExports.o] Error 1
ERROR: compilation failed for package ‘BMABMDR’

Seems to be triggered by (a Windows thing?) https://github.com/cecilekremer/BMABMDR/blob/c86ef4ab14b20e7fbf605a2cb9e9d6d26daea2df/configure#L5

mvarewyck commented 10 months ago

Now resulting in a new compilation error

/usr/include/c++/9/bits/stl_vector.h:652:13: internal compiler error: Segmentation fault
  652 |  : _Base(__a)
      |             ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions.
make: *** [/usr/local/lib/R/etc/Makeconf:175: stanExports_mG4.o] Error 1
ERROR: compilation failed for package ‘BMABMDR’
JorisChau commented 10 months ago

Created PR #87 to fix this issue

mvarewyck commented 10 months ago

I can install the compiled R package BMABMDR, but fail to run the compiled functions. @jcortinas can run this piece of code on his pc with the compiled version for Windows without error.

> library(BMABMDR)
anydoseThere were 17 warnings (use warnings() to see them)
> anydoseresponseN(dose.a = c(0, 0.5, 5, 50), mean.a = c(7.7, 14.3, 14.9, 15.2), sd.a = c(0.397, 0.794, 0.892, 0.698), n.a = c(20, 20, 20, 20))
Error : Exception: variable does not exist; processing stage=data initialization; variable name=n; base type=double (in 'mH0', line 20, column 2 to column 14)
failed to create the optimizer; optimization not done
Error in abs(sv[2]) : non-numeric argument to mathematical function

I can run the example from the help files of rstan::optimizing() without errors:

> library(rstan)
Loading required package: StanHeaders
Loading required package: ggplot2
rstan (Version 2.21.7, GitRev: 2e1f913d3ca3)
For execution on a local, multicore CPU with excess RAM we recommend calling
options(mc.cores = parallel::detectCores()).
To avoid recompilation of unchanged Stan programs, we recommend calling
rstan_options(auto_write = TRUE)
> m <- stan_model(model_code = 'parameters {real y;} model {y ~ normal(0,1);}')
> f <- optimizing(m, hessian = TRUE)

@JorisChau any clue?

mvarewyck commented 10 months ago

We found it is due to different versions of rstan and other dependencies. The compiled version for linux was with the latest on CRAN (2.32.2) while locally and in docker I had 2.21.7

Currently for the Windows version we overwrite the latest cran versions with specific versions https://github.com/cecilekremer/BMABMDR/blob/main/.github/workflows/build_binary_windows.yml#L71-L81

We are now investigating whether we could install and use the BMABMDR package using the latest versions on CRAN if the compiled version was also built with these latest versions.