-
Notifications
You must be signed in to change notification settings - Fork 86
Description
Summary
radian crashes with bus error when loading R packages that have native libraries (e.g., prodlim, survival, e1071) on ARM64 macOS, while the same packages load successfully in standard R.
Environment
- OS: macOS (ARM64/Apple Silicon)
- R Version: 4.5.2 (aarch64-apple-darwin20)
- Python Version: 3.13.7 (also tested with 3.12.0)
- radian Version: 0.6.15
- rchitect Version: 0.4.8
- Architecture: aarch64-apple-darwin20
Steps to Reproduce
- Install radian in ARM64 macOS environment
- Start radian
- Try to load any R package with native libraries:
library(prodlim) # or library(survival), library(e1071), etc.
Expected Behavior
Package should load successfully, as it does in standard R.
Actual Behavior
*** caught bus error ***
address 0x10322e5e8, cause 'invalid alignment'
Traceback:
1: dyn.load(file, DLLpath = DLLpath, ...)
2: library.dynam(lib, package, package.lib)
3: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]])
4: namespaceImport(ns, loadNamespace(i, c(lib.loc, .libPaths()),
versionCheck = vI[[i]]), from = package)
5: loadNamespace(package, lib.loc)
6: doTryCatch(return(expr), name, parentenv, handler)
7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
8: tryCatchList(expr, classes, parentenv, handlers)
9: tryCatch({
attr(package, "LibPath") <- which.lib.loc
ns <- loadNamespace(package, lib.loc)
env <- attachNamespace(ns, pos = pos, deps, exclude, include.only)
}, error = function(e) {
P <- if (!is.null(cc <- conditionCall(e)))
paste(" in", deparse(cc)[1L])
else ""
msg <- gettextf("package or namespace load failed for %s%s:\n %s",
sQuote(package), P, conditionMessage(e))
if (logical.return && !quietly)
message(paste("Error:", msg), domain = NA)
else stop(msg, call. = FALSE, domain = NA)
})
10: library(prodlim)
An irrecoverable exception occurred. R is aborting now ...
Additional Information
Packages Affected
All tested packages with native libraries crash:
prodlim(prodlim.so)survival(survival.so)e1071(e1071.so)Rcpp(Rcpp.so)
Packages Working
R packages without native libraries work fine in radian.
What Works
- Standard R: All packages load successfully
- RStudio: All packages load successfully
- radian on other architectures: Not tested but likely works
Troubleshooting Attempts
- ✅ Rebuilt all packages from source with ARM64-optimized compilation flags
- ✅ Tested multiple Python versions (3.12.0, 3.13.7)
- ✅ Used ARM64-specific rchitect wheel (rchitect-0.4.8-cp313-cp313-macosx_11_0_arm64.whl)
- ✅ Tested different radian versions (0.6.12, 0.6.15)
- ✅ Modified R Makevars with alignment optimizations:
CFLAGS = -O2 -g -fPIC -falign-functions=32 -falign-loops=32 CXXFLAGS = -O2 -g -fPIC -falign-functions=32 -falign-loops=32 - ✅ Tested with various radian flags (
--vanilla,--no-environ, etc.)
Hypothesis
This appears to be a memory alignment issue specific to ARM64 architecture, where radian/rchitect's dynamic library loading mechanism conflicts with the memory layout expectations of R native libraries.
System Details
# Hardware
uname -m: arm64
arch: arm64
# Compiler
gcc --version: gcc (Homebrew GCC 15.2.0) 15.2.0
# R Configuration
R.version$platform: aarch64-apple-darwin20Impact
This issue prevents ARM64 macOS users from using radian with any bioinformatics or statistical packages that include compiled code, significantly limiting radian's usefulness on Apple Silicon Macs.
Request
Could you please investigate this ARM64-specific compatibility issue? I'm happy to provide additional debugging information or test potential fixes.