Comments (6)
Okay, this is what happens:
R stores an absolute path to <prefix>/bin/which
in byte code, and that byte code is compressed. It can be retrieved like this:
$ ./bin/R --quiet -e 'readRDS("./rlib/R/library/base/R/base.rdx")$variables$Sys.which' 2>/dev/null
> readRDS("./rlib/R/library/base/R/base.rdx")$variables$Sys.which
[1] 133838 2044
meaning the serialized stuff for Sys.which
is stored at offset 133838
with length 2044
in base.rdb
. That itself starts with a 4 byte integer, so those have to be skipped. Then a zlib header follows:
$ dd if=./rlib/R/library/base/R/base.rdb bs=1 skip=133842 count=2044 status=none | zlib-flate -uncompress
...
/home/software/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeh/linux-ubuntu18.04-x86_64_v3/gcc-7.5.0/which-2.21-3j5ymd5gybivcdmkxy53tdgq5vzuk5ys/bin/which
...
So in short: a string we need to relocate is stored as compressed, serialized byte code in some sort of database for serialized objects. In principle it's possible to decompress the blocks in base.rdb
, rewrite strings, store again, and update the offsets in base.rdx
-- but that's pretty involved.
Hopefully R can use which
from PATH instead of an absolute path?
from spack.
Submitted a small patch to R that uses indirection through a symlink to make relocation of which
work.
from spack.
I think the issue is that R compresses the original install prefix and decompresses at runtime, strace
shows it tries to execute <old prefix>/bin/which
for example.
from spack.
Hopefully R can use
which
from PATH instead of an absolute path?
AC_PATH_PROGS(WHICH, which, which)
if test "${WHICH}" = which ; then
## needed to build and run R
## ends up hard-coded in the utils package
AC_MSG_ERROR([[which is required but missing]])
fi
looks like we can't.
Another alternative is to look if we can disable compression of byte code. (Edit: looks like you can, but now idk where the source code for Sys.which
is coming from...)
from spack.
Disabling byte compilation doesn't help, it still stores something compressed & serialized in base.rdb
. The file is smaller, so I guess there's a difference between byte code and compiled byte code.
Further options:
- Easiest is to patch the R build system to allow
WHICH=which
and expect it to be inPATH
. - Disabling compression of
rdb
entries (probably a bad idea) - Ask R people to create a symlink to
which
in their prefix, have them register that in their R sources, so no absolute paths are registered in bytecode.
from spack.
@haampie I can't thank you enough for getting to the root cause. I've tested installing R from a buildcache to a new location and the default packages are now successfully found at start-up. Also, with the addition of gcc-runtime
, R is, as far as I can tell, fully relocatable! Thanks!
from spack.
Related Issues (20)
- Installation issue: gperftools when `build_system=cmake` HOT 9
- Avoid storing binary blobs as test files for sz compression HOT 4
- Installation issue: openmpi (Spack v0.21 & v0.22) with compiler [email protected] HOT 6
- Spec matrix: concretization failures when matrixing MPI dependency HOT 3
- Concretizer error for Python variant (+tkinter) HOT 2
- Installation issue: HIP package sets excessive environment variables in dependent package modulefiles
- cuda: `nvcc` is unable to find `-lcupti`
- Installation issue: [email protected]%[email protected]
- Installation issue: glibc iconv incomplete by default on fedora, needs libiconv HOT 11
- Environments: root specs are not always marked explicit HOT 5
- Add an option to shorten git.[commit] version in Spec.format() HOT 3
- Installation issue: `seacas 2022-10-14:2023-05-30` with `fmt@9` when `gcc` mixed with `apple-clang` HOT 5
- Installation issue: `vtk@9%gcc14` HOT 4
- Cannot use `config:shared_linking:bind:true` anymore HOT 1
- Cannot install musl HOT 2
- Installation issue: abinit HOT 1
- Installation issue: gh
- Installation issue: kentutils HOT 2
- Spec syntax: semantic for `%` and `^` for compiler as deps
- Installation issue: [email protected] +cuda ~rocm fails to build HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spack.