popgenmethods / smcpp

SMC++ infers population history from whole-genome sequence data.
GNU General Public License v3.0
149 stars 34 forks source link

Install libbz2-dev and liblzma-dev in the Docker image #220

Closed martin-g closed 2 years ago

martin-g commented 2 years ago

Without those the build (docker build -t smcpp:latest .) fails with errors like:

...
checking for lzma_easy_buffer_encode in -llzma... no
configure: error: liblzma development files not found

The CRAM format may use LZMA2 compression, which is implemented in HTSlib
by using compression routines from liblzma <http://tukaani.org/xz/>.

Building HTSlib requires liblzma development files to be installed on the
build machine; you may need to ensure a package such as liblzma-dev (on Debian
or Ubuntu Linux), xz-devel (on RPM-based Linux distributions or Cygwin), or
xz (via Homebrew on macOS) is installed; or build XZ Utils from source.

Either configure with --disable-lzma (which will make some CRAM files
produced elsewhere unreadable) or resolve this error to build HTSlib.
error: [Errno 2] No such file or directory: 'make'
# pysam: htslib configure options: None
The command '/bin/sh -c python3 setup.py install' returned a non-zero code: 1

If the changes are accepted then maybe the extra dependencies should be added to the README too ?!

martin-g commented 2 years ago

I've faced these errors while trying to build the Docker image on Linux ARM64 but they are not specific to ARM64. Same errors happen on x86_64 as well.

Related-to: #218

martin-g commented 2 years ago

But even with these extra packages the build still fails with:

...
Searching for pysam>=0.18
Reading https://pypi.org/simple/pysam/
Downloading https://files.pythonhosted.org/packages/a0/10/f6d705984838f8620ff597dd99d3904aea7727b4824bee22de8f44b4ebd4/pysam-0.19.1.tar.gz#sha256=dee403cbdf232170c1e11cc24c76e7dd748fc672ad38eb0414f3b9d569b1448f
Best match: pysam 0.19.1
Processing pysam-0.19.1.tar.gz
Writing /tmp/easy_install-ocwma16t/pysam-0.19.1/setup.cfg
Running pysam-0.19.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ocwma16t/pysam-0.19.1/egg-dist-tmp-v_f9ua82
# pysam: cython is available - using cythonize if necessary
# pysam: htslib mode is shared
# pysam: HTSLIB_CONFIGURE_OPTIONS=None
# pysam: (sysconfig) CC=aarch64-linux-gnu-gcc -pthread
# pysam: (sysconfig) CFLAGS=-Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g   -fstack-protector-strong -Wformat -Werror=format-security  -g -fwrapv -O2   
# pysam: (sysconfig) LDFLAGS=-Wl,-Bsymbolic-functions  -Wl,-z,relro -g -fwrapv -O2   
checking for gcc... aarch64-linux-gnu-gcc -pthread
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether aarch64-linux-gnu-gcc -pthread accepts -g... yes
checking for aarch64-linux-gnu-gcc -pthread option to accept ISO C89... none needed
checking for ranlib... ranlib
checking for grep that handles long lines and -e... /usr/bin/grep
checking for C compiler warning flags... unknown
checking for pkg-config... no
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking shared library type for unknown-Linux... plain .so
checking whether the compiler accepts -fvisibility=hidden... yes
checking how to run the C preprocessor... aarch64-linux-gnu-gcc -pthread -E
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... yes
checking for getpagesize... yes
checking for working mmap... yes
checking for gmtime_r... yes
checking for fsync... yes
checking for drand48... yes
checking for srand48_deterministic... no
checking whether fdatasync is declared... yes
checking for fdatasync... yes
checking for library containing log... -lm
checking for zlib.h... yes
checking for inflate in -lz... yes
checking for library containing recv... none required
checking for bzlib.h... yes
checking for BZ2_bzBuffToBuffCompress in -lbz2... yes
checking for lzma.h... yes
checking for lzma_easy_buffer_encode in -llzma... yes
checking whether htscodecs files are present... yes
checking for libdeflate.h... no
checking for libdeflate_deflate_compress in -ldeflate... no
checking for curl/curl.h... yes
checking for curl_easy_pause in -lcurl... yes
checking for CCHmac... no
checking for library containing HMAC... -lcrypto
checking for library containing regcomp... none required
checking whether PTHREAD_MUTEX_RECURSIVE is declared... yes
configure: creating ./config.status
config.status: creating config.mk
config.status: creating htslib.pc.tmp
config.status: creating config.h
config.status: linking htscodecs_bundled.mk to htscodecs.mk
# pysam: htslib configure options: --enable-libcurl
error: [Errno 2] No such file or directory: 'make'
The command '/bin/sh -c python3 setup.py install' returned a non-zero code: 1

Any hint what is going wrong is welcome!

martin-g commented 2 years ago

https://github.com/popgenmethods/smcpp/pull/220/commits/c17fd2138a5abe5cab197203e604894141d3104e fixes the last problem. With this PR I am able to build the Docker image on both Linux x86_64 and aarch64!

If accepted I could create a new PR for adding a Github Actions based CI/CD for building and uploading the image to https://hub.docker.org

terhorst commented 2 years ago

Looks good martin, thank you for looking into this! I'm surprised I ever got the build working without including make, ha!

martin-g commented 2 years ago

Thanks, @terhorst !

I will propose a PR that pushes a multi-platform Docker image to hub.docker.com via Github Actions in the coming days!