tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Getting math/R to install?



Hi,

recently I made a change to the math/R package which should give
it a better chance to build on a big-endian NetBSD host by
avoiding conflicts with ntohl / htonl for two files in R, and the
build itself now completes on my NetBSD/macppc 10.0 system.

However, it refuses to install, also on NetBSD/amd64 10.99.12,
with (same as on NetBSD/macppc 10.0):

=> Checking for missing run-time search paths in R-4.4.2nb4
ERROR: lib/R/bin/exec/R: missing library: libR.so
ERROR: lib/R/library/KernSmooth/libs/KernSmooth.so: missing library: libR.so
ERROR: lib/R/library/MASS/libs/MASS.so: missing library: libR.so
ERROR: lib/R/library/Matrix/libs/Matrix.so: missing library: libR.so
ERROR: lib/R/library/class/libs/class.so: missing library: libR.so
ERROR: lib/R/library/cluster/libs/cluster.so: missing library: libR.so
ERROR: lib/R/library/foreign/libs/foreign.so: missing library: libR.so
ERROR: lib/R/library/grDevices/libs/cairo.so: missing library: libR.so
ERROR: lib/R/library/grDevices/libs/grDevices.so: missing library: libR.so
ERROR: lib/R/library/graphics/libs/graphics.so: missing library: libR.so
ERROR: lib/R/library/grid/libs/grid.so: missing library: libR.so
ERROR: lib/R/library/lattice/libs/lattice.so: missing library: libR.so
ERROR: lib/R/library/methods/libs/methods.so: missing library: libR.so
ERROR: lib/R/library/mgcv/libs/mgcv.so: missing library: libR.so
ERROR: lib/R/library/nlme/libs/nlme.so: missing library: libR.so
ERROR: lib/R/library/nnet/libs/nnet.so: missing library: libR.so
ERROR: lib/R/library/parallel/libs/parallel.so: missing library: libR.so
ERROR: lib/R/library/rpart/libs/rpart.so: missing library: libR.so
ERROR: lib/R/library/spatial/libs/spatial.so: missing library: libR.so
ERROR: lib/R/library/splines/libs/splines.so: missing library: libR.so
ERROR: lib/R/library/stats/libs/stats.so: missing library: libR.so
ERROR: lib/R/library/survival/libs/survival.so: missing library: libR.so
ERROR: lib/R/library/tcltk/libs/tcltk.so: missing library: libR.so
ERROR: lib/R/library/tools/libs/tools.so: missing library: libR.so
ERROR: lib/R/library/utils/libs/utils.so: missing library: libR.so
ERROR: lib/R/modules/R_X11.so: missing library: libR.so
ERROR: lib/R/modules/R_de.so: missing library: libR.so
ERROR: lib/R/modules/internet.so: missing library: libR.so
ERROR: lib/R/modules/lapack.so: missing library: libR.so
*** Error code 1

The libR.so file isn't in lib/ directly, but in ...

: {48} find work -name libR.so
work/R-4.4.2/src/main/libR.so
work/R-4.4.2/lib/libR.so
work/.destdir/usr/pkg/lib/R/lib/libR.so
: {49} 

and checking e.g. lib/R/bin/exec/R with "readelf -a" shows

Dynamic section at offset 0x1de0 contains 27 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libR.so]
 0x0000000000000001 (NEEDED)             Shared library: [libgomp.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.12]
 0x000000000000000f (RPATH)              Library rpath: [/usr/pkg/lib:/usr/X11R7/lib]
 0x000000000000000c (INIT)               0x870
 0x000000000000000d (FINI)               0xd10

which is of course insufficient to find the libR.so shared
library.

grep'ing a bit for RPATH finds among others

work/R-4.4.2/src/library/tools/R/install.R

which among other stuff contains this code:

        ## Patch hardcoded paths in shared objects/dynamic libraries
        ## so that they can be moved to a different directory.
        ## Not used on WINDOWS.
        patch_rpaths <- function()
        {
...
            starsmsg(stars, "checking absolute paths in shared objects and dynamic libraries")

            uname <- system("uname -a", intern = TRUE)
            os <- sub(" .*", "", uname)
            have_chrpath <- nzchar(Sys.which("chrpath"))
            have_patchelf <- nzchar(Sys.which("patchelf"))
            have_readelf <- nzchar(Sys.which("readelf"))
            have_macos_clt <- identical(os, "Darwin") &&
                              nzchar(Sys.which("otool")) &&
                              nzchar(Sys.which("install_name_tool"))
            have_solaris_elfedit <- identical(os, "SunOS") &&
                                    nzchar(Sys.which("elfedit"))

            hardcoded_paths <- FALSE
            failed_fix <- FALSE
...

So ... R itself appears to have code to tweak RPATH, but I
suspect none of it is being done on NetBSD because neither
patchelf nor any of those other programs are available in the
restricted path of the pkgsrc build.

Further, we don't appear to support "patchelf" as a tool, by the
looks of it, so I don't see a straight-forward way to make it
available during the build.

Oh, yes, there's also mention of

                    # "\\$ORIGIN/.."

in that script, but that's of course also being suppressed if
passed to the C compiler as part of a flag to set rpath (is it
really worth it to "fight the world and bend it to your will" in
this way?)  Ref. that other discussion about rust, rpath and
$ORIGIN, where I have a rather crude workaround up my sleeve (let
first attempt fail, run patchelf *with* $ORIGIN/../lib as
argument to the stage1 compiler (which isn't being installed...),
and resart the build).

So ... what is the proper avenue to follow to make this build and
install again?

Regards,

- Håvard


Home | Main Index | Thread Index | Old Index