Skip to content

Commit

Permalink
Add a gcc-12 Ubuntu R-devel build and try ATLAS with that
Browse files Browse the repository at this point in the history
No cigar, still.
  • Loading branch information
gaborcsardi committed Jan 18, 2023
1 parent 2f28082 commit 0574b17
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 7 deletions.
14 changes: 7 additions & 7 deletions containers/atlas/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,35 @@ FROM ubuntu:22.04
RUN apt-get update -y && \
apt-get install -y curl && \
cd /tmp && \
curl -LO "https://github.com/r-hub/containers/releases/download/latest/r-rstudio-ubuntu-2204-devel_1_$(dpkg --print-architecture).deb" && \
curl -LO "https://github.com/r-hub/containers/releases/download/latest/r-rstudio-ubuntu-2204-devel-gcc12_1_$(dpkg --print-architecture).deb" && \
apt install -y ./r-*.deb && \
apt-get clean

# ------------------------------------------------------------------------------------
# Put R on PATH
# AUto-install system requirements

ENV PATH="/opt/R/devel/bin:${PATH}"
ENV PATH="/opt/R/devel-gcc12/bin:${PATH}"
ENV PKG_SYSREQS=true

# ------------------------------------------------------------------------------------
# Set CRAN repo, use P3M on x86_64

RUN echo 'options(repos =c(CRAN = "https://cran.rstudio.com"))' \
>> /opt/R/devel/lib/R/library/base/R/Rprofile
>> /opt/R/devel-gcc12/lib/R/library/base/R/Rprofile
RUN if [ "$(uname -p)" = "x86_64" ]; then \
echo 'options(repos = c(RSPM="https://packagemanager.posit.co/cran/__linux__/jammy/latest", getOption("repos")))' \
>> /opt/R/devel/lib/R/library/base/R/Rprofile; \
>> /opt/R/devel-gcc12/lib/R/library/base/R/Rprofile; \
curl -s https://api.r-hub.io/rversions/r-release | \
sed 's/^.*version":"\([0-9.][0-9.]*\)".*$/\1/' >/tmp/rver; \
echo 'options(HTTPUserAgent = sprintf("R/'$(cat /tmp/rver)' (ubuntu-22.04) R ('$(cat /tmp/rver)' %s)", paste(R.version$platform, R.version$arch, R.version$os)))' \
>> /opt/R/devel/lib/R/library/base/R/Rprofile; \
>> /opt/R/devel-gcc12/lib/R/library/base/R/Rprofile; \
fi

# ------------------------------------------------------------------------------------
# Install pak

RUN /opt/R/devel/bin/R -q -e \
RUN /opt/R/devel-gcc12/bin/R -q -e \
'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/%s/%s/%s/%s", "devel", .Platform$pkgType, R.Version()$os, R.Version()$arch))'

# ------------------------------------------------------------------------------------
Expand All @@ -52,7 +52,7 @@ ENV LANG en_US.UTF-8
# ------------------------------------------------------------------------------------
# Use user's package library for the rest

RUN /opt/R/devel/bin/R -q -e 'dir.create(Sys.getenv("R_LIBS_USER"), showWarnings = FALSE, recursive = TRUE)'
RUN /opt/R/devel-gcc12/bin/R -q -e 'dir.create(Sys.getenv("R_LIBS_USER"), showWarnings = FALSE, recursive = TRUE)'

# ------------------------------------------------------------------------------------
# Copy check script
Expand Down
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,16 @@ services:
image: rhub/ubuntu-2204-nold:latest
volumes:
- ./integration/tmp:/tmp/output
ubuntu-2204-gcc12:
command: ./build.sh
environment:
- R_VERSION=devel
- R_TYPE=-gcc12
- XCONFIGURE_OPTIONS=CC=gcc-12 CXX=g++-12 FC=gfortran-12
- LOCAL_STORE=/tmp/output
build:
context: .
dockerfile: dockerfiles/Dockerfile.ubuntu-2204-gcc12
image: rhub/ubuntu-2204-gcc12:latest
volumes:
- ./integration/tmp:/tmp/output
29 changes: 29 additions & 0 deletions dockerfiles/Dockerfile.ubuntu-2204-gcc12
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM ubuntu:jammy

ENV OS_IDENTIFIER ubuntu-2204

RUN set -x \
&& sed -i "s|# deb-src|deb-src|g" /etc/apt/sources.list \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get install -y curl libcurl4-openssl-dev libicu-dev libopenblas-base libpcre2-dev wget python3-pip \
&& apt-get build-dep -y r-base \
&& apt-get install -y gcc-12 g++-12 gfortran-12

RUN pip3 install awscli

RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(dpkg --print-architecture).deb" && \
apt install -y "./nfpm_$(dpkg --print-architecture).deb" && \
rm "nfpm_$(dpkg --print-architecture).deb"

RUN chmod 0777 /opt

# Override the default pager used by R
ENV PAGER /usr/bin/pager

# R 3.x requires PCRE2 for Pango support on Ubuntu 22
ENV INCLUDE_PCRE2_IN_R_3 yes

COPY dockerfiles/package.ubuntu-2204-gcc12 /package.sh
COPY build.sh .
ENTRYPOINT ./build.sh
70 changes: 70 additions & 0 deletions dockerfiles/package.ubuntu-2204-gcc12
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/bin/bash

if [[ ! -d /tmp/output/${OS_IDENTIFIER} ]]; then
mkdir -p "/tmp/output/${OS_IDENTIFIER}"
fi

# R 3.x requires PCRE1. On Ubuntu 22, R 3.x also requires PCRE2 for Pango support.
pcre_libs='- libpcre2-dev'
if [[ "${R_VERSION}" =~ ^3 ]]; then
pcre_libs='- libpcre2-dev
- libpcre3-dev'
fi

cat <<EOF > /tmp/nfpm.yml
name: r-${R_VERSION}${R_TYPE}
version: 1
version_schema: none
section: universe/math
priority: optional
arch: $(dpkg --print-architecture)
maintainer: Posit Software, PBC <https://github.com/rstudio/r-builds>
description: |
GNU R statistical computation and graphics system
vendor: Posit Software, PBC
homepage: https://www.r-project.org
license: GPL-2
deb:
fields:
Bugs: https://github.com/rstudio/r-builds/issues
depends:
- g++-12
- gcc-12
- gfortran-12
- libbz2-dev
- libc6
- libcairo2
- libcurl4
- libglib2.0-0
- libgomp1
- libicu-dev
- libjpeg8
- liblzma-dev
- libopenblas-dev
- libpango-1.0-0
- libpangocairo-1.0-0
- libpaper-utils
${pcre_libs}
- libpng16-16
- libreadline8
- libtcl8.6
- libtiff5
- libtk8.6
- libx11-6
- libxt6
- make
- ucf
- unzip
- zip
- zlib1g-dev
contents:
- src: /opt/R/${R_VERSION}${R_TYPE}
dst: /opt/R/${R_VERSION}${R_TYPE}
EOF

nfpm package \
-f /tmp/nfpm.yml \
-p deb \
-t "/tmp/output/${OS_IDENTIFIER}"

export PKG_FILE=$(ls /tmp/output/${OS_IDENTIFIER}/r-${R_VERSION}${R_TYPE}*.deb | head -1)

0 comments on commit 0574b17

Please sign in to comment.