yfukasawa / LongQC

LongQC is a tool for the data quality control of the PacBio and ONT long reads.
MIT License
148 stars 18 forks source link

docker build failed on macos #73

Open DENGARDEN opened 4 months ago

DENGARDEN commented 4 months ago

I encountered the following error related to SIMD library, while building a docker image with the current version of Dockerfile.

[+] Building 4.0s (9/11)                                                                                                     docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                         0.0s
 => => transferring dockerfile: 1.34kB                                                                                                       0.0s
 => [internal] load .dockerignore                                                                                                            0.0s
 => => transferring context: 2B                                                                                                              0.0s
 => [internal] load metadata for docker.io/continuumio/miniconda3:latest                                                                     1.2s
 => [1/7] FROM docker.io/continuumio/miniconda3@sha256:0fe3d011c129245af1f631d19c6b7c4f34b61650c1c7881980f266cdaa44ed1b                      0.0s
 => https://api.github.com/repos/yfukasawa/longqc/git/refs/heads/minimap2_update                                                             0.5s
 => CACHED [2/7] RUN apt-get clean all &&     apt-get update &&     apt-get upgrade -y &&     apt-get install -y      git     build-essenti  0.0s
 => CACHED [3/7] ADD https://api.github.com/repos/yfukasawa/longqc/git/refs/heads/minimap2_update version.json                               0.0s
 => CACHED [4/7] RUN git clone https://github.com/yfukasawa/LongQC.git $HOME/LongQC                                                          0.0s
 => ERROR [5/7] RUN cd $HOME/LongQC/minimap2-coverage && make                                                                                2.2s
------
 > [5/7] RUN cd $HOME/LongQC/minimap2-coverage && make:
0.132 cc -c -g -O2 -Wall -Wc++-compat -DHAVE_KALLOC  minimap2-coverage.c -o minimap2-coverage.o
0.154 minimap2-coverage.c: In function ‘main’:
0.154 minimap2-coverage.c:429:84: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 7 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
0.154   429 |         fprintf(stderr, "[M::%s::%.3f*%.2f] loaded %d sequence(s). Total m_cnt: %llu (Peak RSS: %.3f GB) \n",
0.154       |                                                                                 ~~~^
0.154       |                                                                                    |
0.154       |                                                                                    long long unsigned int
0.154       |                                                                                 %lu
0.154   430 |                 __func__, realtime() - mm_realtime0, cputime() / (realtime() - mm_realtime0), i, tot, peakrss() / 1024.0 / 1024.0 / 1024.0);
0.154       |                                                                                                  ~~~
0.154       |                                                                                                  |
0.154       |                                                                                                  uint64_t {aka long unsigned int}
0.155 minimap2-coverage.c:484:44: warning: variable ‘tot_cnt’ set but not used [-Wunused-but-set-variable]
0.155   484 |         uint64_t *b; int32_t n_b; uint64_t tot_cnt;
0.155       |                                            ^~~~~~~
0.336 cc -c -g -O2 -Wall -Wc++-compat -DHAVE_KALLOC  kthread.c -o kthread.o
0.381 cc -c -g -O2 -Wall -Wc++-compat -DHAVE_KALLOC  kalloc.c -o kalloc.o
0.428 cc -c -g -O2 -Wall -Wc++-compat -DHAVE_KALLOC  misc.c -o misc.o
0.502 cc -c -g -O2 -Wall -Wc++-compat -DHAVE_KALLOC  bseq.c -o bseq.o
0.619 cc -c -g -O2 -Wall -Wc++-compat -DHAVE_KALLOC  sketch.c -o sketch.o
0.703 cc -c -g -O2 -Wall -Wc++-compat -DHAVE_KALLOC  sdust.c -o sdust.o
0.815 cc -c -g -O2 -Wall -Wc++-compat -DHAVE_KALLOC  index.c -o index.o
1.014 cc -c -g -O2 -Wall -Wc++-compat -DHAVE_KALLOC  chain.c -o chain.o
1.099 cc -c -g -O2 -Wall -Wc++-compat -DHAVE_KALLOC  align.c -o align.o
1.429 cc -c -g -O2 -Wall -Wc++-compat -DHAVE_KALLOC  hit.c -o hit.o
1.627 cc -c -g -O2 -Wall -Wc++-compat -DHAVE_KALLOC  map.c -o map.o
1.865 cc -c -g -O2 -Wall -Wc++-compat -DHAVE_KALLOC  format.c -o format.o
2.055 cc -c -g -O2 -Wall -Wc++-compat -DHAVE_KALLOC  pe.c -o pe.o
2.161 cc -c -g -O2 -Wall -Wc++-compat -DHAVE_KALLOC  esterr.c -o esterr.o
2.227 cc -c -g -O2 -Wall -Wc++-compat -DHAVE_KALLOC  ksw2_ll_sse.c -o ksw2_ll_sse.o
2.236 ksw2_ll_sse.c:4:10: fatal error: emmintrin.h: No such file or directory
2.236     4 | #include <emmintrin.h>
2.236       |          ^~~~~~~~~~~~~
2.236 compilation terminated.
2.237 make: *** [Makefile:34: ksw2_ll_sse.o] Error 1
------
Dockerfile:26
--------------------
  24 |     ADD https://api.github.com/repos/yfukasawa/longqc/git/refs/heads/minimap2_update version.json
  25 |     RUN git clone https://github.com/yfukasawa/LongQC.git $HOME/LongQC
  26 | >>> RUN cd $HOME/LongQC/minimap2-coverage && make
  27 |     RUN cd $HOME/LongQC && \
  28 |         sed -i \
--------------------
ERROR: failed to solve: process "/bin/sh -c cd $HOME/LongQC/minimap2-coverage && make" did not complete successfully: exit code: 2

As I am on macOS 14.5 23F79 arm64, I tweaked the Dockerfile and command to build properly.

# build minimap2-coverage
FROM continuumio/miniconda3

### MAINTAINER ###
MAINTAINER Yoshinori Fukasawa <yoshinori.fukasawa@kaust.edu.sa>
### LABELS ###
LABEL base_image="miniconda3"
LABEL software="LongQC docker"
LABEL software.version="1.2"

### Update the Dockerfile to use the libmamba solver ###
RUN conda install -n base conda-libmamba-solver
RUN conda config --set solver libmamba

### Basic dependency ###
RUN apt-get clean all && \
    apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y  \
    git \
    build-essential \
    libc6-dev \
    zlib1g-dev && \
    apt-get clean && \
    apt-get purge

### LongQC installation ###
ADD https://api.github.com/repos/yfukasawa/longqc/git/refs/heads/minimap2_update version.json
RUN git clone https://github.com/yfukasawa/LongQC.git $HOME/LongQC

RUN cd $HOME/LongQC/minimap2-coverage && make
RUN cd $HOME/LongQC && \
    sed -i \
    -e '1{s;^;#!/opt/conda/bin/python\n;}' \
    longQC.py && \
    chmod +x longQC.py

### install LongQC's dependency ###
RUN conda config --add channels conda-forge && \
    conda config --add channels bioconda
RUN conda install --solver=libmamba -y \
    python=3.9 \
    numpy \
    pandas'>=0.24.0' \
    scipy \
    jinja2 \
    h5py \
    matplotlib'>=2.1.2' \
    scikit-learn && \
    conda install -y -c bioconda \
    edlib \
    pysam \
    python-edlib

### Define PATH ###
ENV PATH="/root/LongQC:$PATH"

### Entry point
ENTRYPOINT ["longQC.py"]
docker buildx build --platform linux/amd64 -t longqc:latest --load .
kchibs commented 3 months ago

My error occurred at the seventh command, so this might not help, but I added the following line for the solver: conda install -n base libarchive -c main --force-reinstall --solver classic && \

Found it here: https://stackoverflow.com/questions/77617946/solve-conda-libmamba-solver-libarchive-so-19-error-after-updating-conda-to-23