[R] grDevices segfault when building R4.4.0 on RHEL 9.1.

Miguel Esteva e@tev@@m @end|ng |rom weh|@edu@@u
Wed Jul 17 04:35:22 CEST 2024


Hi Ivan,

An apology, I was away for quite a bit.

To reproduce the setup:

I have been using the default GCC in RHEL 9.1.

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-host-pie --enable-host-bind-now --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-plugin --enable-initfini-array --without-isl --enable-multilib --with-linker-hash-style=gnu --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_64=x86-64-v2 --with-arch_32=x86-64 --build=x86_64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.1 20230605 (Red Hat 11.4.1-2) (GCC)

I have been building R 4.4.0 and 4.4.1 with Flexiblas and with the built in R BLAS/LAPACK.

R BLAS:
./configure --prefix=/tools/R/$RVER  --enable-R-shlib --enable-memory-profiling  --with-pcre2=/tools/pcre2/10.42

Flexiblas:

PKG_CONFIG_PATH=/tools/flexiblas/3.4.2/lib64/pkgconfig ./configure --prefix=/tools/R/flexiblas/4.4.1  --enable-R-shlib --enable-memory-profiling --with-pcre2=/tools/pcre2/10.42 --with-blas="-lflexiblas -L/tools/flexiblas/3.4.2/lib64" --with-lapack

I realised the build fails when "--with-lapack" is left unspecified, even though the configure output shows this:

  Source directory:            .
  Installation directory:      /tools/R/flexiblas

  C compiler:                  gcc  -g -O2
  Fortran fixed-form compiler: gfortran  -g -O2

  Default C++ compiler:        g++ -std=gnu++17  -g -O2
  C++11 compiler:              g++ -std=gnu++11  -g -O2
  C++14 compiler:              g++ -std=gnu++14  -g -O2
  C++17 compiler:              g++ -std=gnu++17  -g -O2
  C++20 compiler:              g++ -std=gnu++20  -g -O2
  C++23 compiler:              g++ -std=gnu++23  -g -O2
  Fortran free-form compiler:  gfortran  -g -O2
  Obj-C compiler:

  Interfaces supported:        X11, tcltk
  External libraries:          pcre2, readline, BLAS(FlexiBlas), LAPACK(in blas), curl, libdeflate
  Additional capabilities:     PNG, JPEG, TIFF, NLS, cairo, ICU
  Options enabled:             shared R library, R profiling, memory profiling, libdeflate for lazyload

  Capabilities skipped:
  Options not enabled:         shared BLAS

  Recommended packages:        yes

I replaced the "--with-lapack" flag with "--with-lapack='-lflexiblas -L/tools/flexiblas/3.4.2/lib64'" and everything built ok.

>From a quick check in my emails, seems the RHEL9 system lapack packages are broken. Will test a bit more.

If you need a singularity container in the future, I can provide one with the R-dependencies installed. We setup dependencies similar to: https://github.com/rstudio/r-builds/blob/main/builder/Dockerfile.rhel-9

or

subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms
dnf install -y yum-utils
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
yum-builddep -y R

Just bringing this to your attention as the issue is not with R by the looks, as I was unable to reproduce on Rocky Linux 9.1.

Kind regards and thanks!


Miguel Esteva
Senior ITS Research Systems Engineer


The Walter and Eliza Hall Institute of Medical Research
1G Royal Parade
Parkville VIC 3052
Australia

Phone (03) 9345 2909<callto:(03)%209345%202909>

Email esteva.m using wehi.edu.au

Web http://www.wehi.edu.au<http://www.wehi.edu.au/>

________________________________
From: Ivan Krylov <ikrylov using disroot.org>
Sent: Friday, 3 May 2024 9:40 PM
To: Miguel Esteva via R-help <r-help using r-project.org>
Cc: Miguel Esteva <esteva.m using wehi.edu.au>
Subject: Re: [R] grDevices segfault when building R4.4.0 on RHEL 9.1.

Dear Miguel Esteva,

I couldn't get a Red Hat "ubi9" container to install enough
dependencies to build R. Is there a way to reproduce your setup on a
virtual machine somewhere?

On Fri, 3 May 2024 00:42:43 +0000
Miguel Esteva via R-help <r-help using r-project.org> wrote:

>  *** caught segfault ***
>
> address 0x1801fa8f70, cause 'memory not mapped'
>
>
> Traceback:
>
>  1: solve.default(rgb)

This seems to crash inside the BLAS. Which BLAS are you using? Any
custom ./configure arguments? Which compilers are you running?

To find out more information about the crash, try to follow it with a
debugger. Change directory to src/library/grDevices and run:

_R_COMPILE_PKGS_=1 R_COMPILER_SUPPRESS_ALL=1 \
 R_DEFAULT_PACKAGES=NULL LC_ALL=C \
../../../bin/R -d gdb --vanilla --no-echo -e \
 'tools:::makeLazyLoading("grDevices")'

(This assumes building straight from the source directory. Adjust the
paths if you're using a separate build directory.)

Use the "run" command to start the process. One you see a crash, use
"backtrace" to see the state of the call stack at the place of the
crash, or "backtrace full" to include the contents of local variables.
The first few entries are probably the most important ones.

Not sure what to do with this information yet, but it might provide
more clues.

--
Best regards,
Ivan

	[[alternative HTML version deleted]]



More information about the R-help mailing list