Menu ▾ ▴

#70 rjags 5-3: jags.version() errors on official macOS JAGS 5.0.0 builds ("invalid version specification")

v1.0_(example)
open
nobody
None
3
2 days ago
5 days ago
Anonymous
No

On the official macOS builds of JAGS 5.0.0, rjags::jags.version() throws an error instead of returning a version:

> rjags::jags.version()
Error: invalid version specification '5.0.0 (vecLib-single-aarch64)'

The macOS build scripts deliberately add the build type to the version string in src/lib/version.cc (JAGS-build-macOS, scripts/jags-compile.sh, line 226):

sed -i '' -e "s/\"$VERSION\";/\"$VERSION ($BLAS-$THREAD-$ARCH)\";/" "src/lib/version.cc"

jags.version() passes that string to numeric_version() and only strips a trailing -beta:

jags.version <- function(){
    vers <- .Call("get_version", PACKAGE="rjags")
    ## Work around bug introduced by 5.0.0-beta as package name
    vers <- sub("-beta$", "", vers)
    return(numeric_version(vers))
}

So every official macOS build of JAGS 5 should be affected, since they all add a (BLAS-THREAD-ARCH) suffix. Any package that records or checks jags.version() then fails. For example, every model fit in the upcoming R package mcp v0.4 errors, because it stores jags.version() in the fitted object.

To reproduce

  1. Install JAGS-5.0.0-vecLib-single-aarch64.pkg from SourceForge (JAGS/5.x/macOS).
  2. Install rjags 5-3 from source (rjags_5-3.tar.gz, rjags/5/Source), with PKG_CONFIG_PATH pointing to the installed jags.pc.
  3. Run rjags::jags.version().

Observed on GitHub Actions macos-latest (arm64), R 4.6.1 (2026-06-24), aarch64-apple-darwin23. Apart from this, rjags 5-3 works: models compile and sample correctly.

Suggested fix

Keep only the leading numeric part, which also covers the -beta case:

jags.version <- function(){
    vers <- .Call("get_version", PACKAGE="rjags")
    ## Drop suffixes such as "-beta" or macOS build descriptions like " (vecLib-single-aarch64)"
    vers <- sub("^([0-9]+(\\.[0-9]+)*).*$", "\\1", vers)
    return(numeric_version(vers))
}

If the build description is useful, it could be kept as an attribute or returned by a separate function.

Discussion

  • Anonymous

    Anonymous - 5 days ago

    FYI, I am Jonas Kristoffer Lindeløv - {mcp} developer without sourceforge account :-) And JAGS fan!

     
    • Martyn Plummer

      Martyn Plummer - 5 days ago

      Thanks Jonas!

       
  • Matt Denwood

    Matt Denwood - 5 days ago

    Thanks for the report - this is already fixed in rjags_5-4 (https://sourceforge.net/p/mcmc-jags/rjags/ci/default/tree/)

     
    • Anonymous

      Anonymous - 2 days ago
      Post awaiting moderation.

Anonymous
Anonymous

Add attachments
Cancel