stan-dev / stan-dev/rstan

Building R package with integrate_ode_bdf() results in `Symbol not found: _CVode`

Open
#825 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
1.1k
Forks
266
Avg merge
2h 56m
Merged PRs (30d)
1

Description

Summary:

If I try to build an R package that uses rstan and includes the BDF ODE solver (integrate_ode_bdf), I receive the error Symbol not found: _CVode.

Description:
  • I am unable to build R packages that use the integrate_ode_bdf ODE solver using the set up as built by rstantools.
  • The integrate_ode_rk45 ODE solver works.
  • I can also build rstan models that use integrate_ode_bdf through rstan::stan_model or rstan::stan outside of an R package structure.
  • I have posted a minimal R package in a GitHub repo below as an example.
  • I'm not sure if this is an rstan or rstantools issue. If this should be an rstantools issue this could be moved there or this can be closed and I will repost.
Reproducible Steps:

Try to install this minimal package I put together using rstantools::rstan_create_package() and an example from the Stan manual:

remotes::install_github("seananderson/testBDF")
Current Output:
Error: package or namespace load failed for ‘testBDF’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-testBDF/00new/testBDF/libs/testBDF.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-testBDF/00new/testBDF/libs/testBDF.so, 6): Symbol not found: _CVode
  Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-testBDF/00new/testBDF/libs/testBDF.so
  Expected in: flat namespace
 in /Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-testBDF/00new/testBDF/libs/testBDF.so
Error: loading failed
Execution halted

I assume the important error is Symbol not found: _CVode

The above was on OS X as described below. On Windows R 3.6.2 I've been told the error is:

undefined reference to `CVodeFree' collect2.exe: error: ld returned 1 exit status
Expected Output:

The package to build and install. The package will build and install if integrate_ode_bdf is replaced with integrate_ode_rk45.

RStan Version:

rstan: 2.21.2
StanHeaders: 2.21.0.5
rstantools: 2.1.1 or 2.1.1.9000

R Version:

R version 4.0.2 (2020-06-22)

(Also tested on Windows R 3.6.2)

Operating System:

OS X 10.15.6

(Also tested on Windows 10 1909)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure by installing the minimal testBDF package generated with rstantools::rstan_create_package(), using integrate_ode_bdf and then integrate_ode_rk45 for comparison. Trace the package build and linking setup around the missing CVode and CVodeFree symbols on macOS and Windows; done means the BDF-based package builds and installs successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.