Unable to install Rhtslib on ubuntu-20.04 runners at GHA

Dear GitHub Support Community members,

I tried to test my R package at GitHub Actions using the following workflows:

(adapted from leekgroup/derfinderPlot/blob/master/.github/workflows/check-bioc.yml)

(adapted from r-lib/actions/tree/master/examples#standard-ci-workflow and r-lib/actions/tree/v1/examples#tidyverse-ci-workflow)

The first workflow worked fine. The second workflow passed on MacOS and Windows runners, but failed on Ubuntu runners. The reason was that dependency Rhtslib could not be properly compiled and installed:

  • installing source package ‘Rhtslib’ …

** using non-staged installation via StagedInstall field

** libs

cd “htslib-1.7” && make -f “/opt/R/4.0.3/lib/R/etc/Makeconf” -f “Makefile.Rhtslib”

make[1]: Entering directory ‘/tmp/RtmpskCjP4/R.INSTALL3dfc2df43d1d/Rhtslib/src/htslib-1.7’

Makefile.Rhtslib:128: warning: overriding recipe for target ‘.c.o’

/opt/R/4.0.3/lib/R/etc/Makeconf:172: warning: ignoring old recipe for target ‘.c.o’

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o kfunc.o kfunc.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o knetfile.o knetfile.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o kstring.o kstring.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o bcf_sr_sort.o bcf_sr_sort.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o bgzf.o bgzf.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o errmod.o errmod.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o faidx.o faidx.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o hfile.o hfile.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o hfile_net.o hfile_net.c

echo ‘#define HTS_VERSION “1.7”’ > version.h

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o hts.o hts.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o hts_os.o hts_os.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o md5.o md5.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o multipart.o multipart.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o probaln.o probaln.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o realn.o realn.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o regidx.o regidx.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o sam.o sam.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o synced_bcf_reader.o synced_bcf_reader.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o vcf_sweep.o vcf_sweep.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o tbx.o tbx.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o textutils.o textutils.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o thread_pool.o thread_pool.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o vcf.o vcf.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o vcfutils.o vcfutils.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_codecs.o cram/cram_codecs.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_decode.o cram/cram_decode.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_encode.o cram/cram_encode.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_external.o cram/cram_external.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_index.o cram/cram_index.c

In file included from /usr/include/string.h:495,

from cram/cram_index.c:57:

In function ‘memcpy’,

inlined from ‘kputsn’ at ./htslib/kstring.h:148:2,

inlined from ‘kputs’ at ./htslib/kstring.h:156:9,

inlined from ‘cram_index_build’ at cram/cram_index.c:571:9:

/usr/include/x86_64-linux-gnu/bits/string_fortified.h:34:10: warning: ‘__builtin_memcpy’ specified bound 18446744073709551614 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]


| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_io.o cram/cram_io.c

cram/cram_io.c: In function ‘cram_populate_ref’:

cram/cram_io.c:2178:27: warning: ‘.tmp_’ directive writing 5 bytes into a region of size between 1 and 4096 [-Wformat-overflow=]


| ^~~~~

cram/cram_io.c:2178:24: note: using the range [0, 4294967295] for directive argument


| ^~~~~~~~~~~~~~~~~

cram/cram_io.c:2178:24: note: using the range [0, 4294967295] for directive argument

In file included from /usr/include/stdio.h:867,

from cram/cram_io.c:49:

/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 11 and 4134 bytes into a destination of size 4096

36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,

| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_samtools.o cram/cram_samtools.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_stats.o cram/cram_stats.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/files.o cram/files.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/mFILE.o cram/mFILE.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/open_trace_file.o cram/open_trace_file.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/pooled_alloc.o cram/pooled_alloc.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/rANS_static.o cram/rANS_static.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/sam_header.o cram/sam_header.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/string_alloc.o cram/string_alloc.c

gcc -g -O2 -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o hfile_libcurl.o hfile_libcurl.c

hfile_libcurl.c:45:10: fatal error: curl/curl.h: No such file or directory

45 | #include <curl/curl.h>

| ^~~~~~~~~~~~~

compilation terminated.

make[1]: *** [Makefile.Rhtslib:128: hfile_libcurl.o] Error 1

make: *** [Makevars.common:24: htslib] Error 2

make[1]: Leaving directory ‘/tmp/RtmpskCjP4/R.INSTALL3dfc2df43d1d/Rhtslib/src/htslib-1.7’

ERROR: compilation failed for package ‘Rhtslib’

removing ‘/home/runner/work/_temp/Library/Rhtslib’

How was this issue related to libcurl? Do I need to set up additional Linux dependencies besides dependencies listed in this action?

  - name: Install Linux system dependencies
    if: runner.os == 'Linux'
    run: |
      sysreqs=$(Rscript -e 'cat("apt-get update -y && apt-get install -y", paste(gsub("apt-get install -y ", "", remotes::system_requirements("ubuntu", "20.04")), collapse = " "))')
      echo $sysreqs
      sudo -s eval "$sysreqs"
  - name: Install macOS system dependencies
    if: matrix.config.os == 'macOS'
    run: |
      ## Enable installing XML from source if needed
      brew install libxml2
      echo "XML_CONFIG=/usr/local/opt/libxml2/bin/xml2-config" >> $GITHUB_ENV
      ## Required to install magick as noted at
      ## https://github.com/r-lib/usethis/commit/f1f1e0d10c1ebc75fd4c18fa7e2de4551fd9978f#diff-9bfee71065492f63457918efcd912cf2
      brew install imagemagick@6
      ## For textshaping, required by ragg, and required by pkgdown
      brew install harfbuzz fribidi
      ## For installing usethis's dependency gert
      brew install libgit2


The error message looks like a libcurl header file that the build needs isn’t available. You’ll need to install one of the packages libcurl4-openssl-dev, libcurl4-nss-dev, or libcurl4-gnutls-dev to make it available. The choice between those three depends on the crypto library you want libcurl to use.

Thanks @airtower-luna!

This means that I need to install one of these, and change action Install Linux system dependencies like this?

1 Like

Basically yes! You shouldn’t need the -s for sudo in that case, though.