ChristopherWilks / megadepth

BigWig and BAM utilities
Other
92 stars 9 forks source link

[Feature Request] Alpine support #18

Open ConYel opened 3 months ago

ConYel commented 3 months ago

relevant issue: https://github.com/LieberInstitute/megadepth/issues/6

I am trying to build megadepth on alpine container in order to have a "slimmer" image in the end. I get various issues from compiling. the image currently:

FROM docker.io/rhub/r-minimal:4.4.1-patched as builder

RUN apk update
RUN apk add --no-cache --update-cache \
    --repository http://nl.alpinelinux.org/alpine/v3.20/main \
    autoconf=2.72-r0 \
    automake=1.16.5-r2 \
    bash tzdata libcurl git zlib gcc musl-dev xz-dev gcompat

RUN echo "America/Edmonton" > /etc/timezone
WORKDIR /home/hello
RUN git clone https://github.com/ChristopherWilks/megadepth.git
WORKDIR /home/hello/megadepth

CMD [ /bin/sh ]

Then I run inside the container :

 ./build_megadepth.sh
.
.
.
.
/home/hello/megadepth/htslib /home/hello/megadepth
+ autoheader
+ autoconf
+ make clean
expr: warning: '^\([0-9.]*\)$': using '^' as the first character
of a basic regular expression is not portable; it is ignored
rm -f test/*.tmp test/*.tmp.* test/longrefs/*.tmp.* test/tabix/*.tmp.* test/tabix/FAIL* header-exports.txt shlib-exports-so.txt
rm -f *.o *.pico cram/*.o cram/*.pico test/*.o test/*.dSYM version.h
rm -f hts-object-files
rm -f libhts.so libhts.so.*
rm -f libhts.a bgzip htsfile tabix  test/hts_endian test/fieldarith test/hfile test/pileup test/plugins-dlhts test/sam test/test_bgzf test/test_kfunc test/test_kstring test/test_realn test/test-regidx test/test_str2int test/test_view test/test_index test/test-vcf-api test/test-vcf-sweep test/test-bcf-sr test/fuzz/hts_open_fuzzer.o test/test-bcf-translate test/test-parse-reg test/thrash_threads1 test/thrash_threads2 test/thrash_threads3 test/thrash_threads4 test/thrash_threads5 test/thrash_threads6 test/thrash_threads7
+ [[ linux == \l\i\n\u\x ]]
+ [[ '' == \h\b\b ]]
+ ./configure --disable-libcurl --disable-bz2 --disable-lzma --with-libdeflate
configure: error: cannot find required auxiliary files: config.guess config.sub

Then I use

cd htslib
autoreconf --install
cd ..
./build_megadepth.sh
+ build_type=
++ perl -e '$bt=""; if($bt=~/static/i) { print "megadepth_static"; } else { print "megadepth_dynamic"; }'
+ bc=megadepth_dynamic
+ git submodule update --init --recursive
+ export SUBMODULE=1
+ SUBMODULE=1
+ ln -fs CMakeLists.txt.ci CMakeLists.txt
+ rm -rf zlib htslib libBigWig libdeflate build-release-temp
+ [[ -n '' ]]
+ [[ ! -s libdeflate_ci/libdeflate.a ]]
+ ln -fs libdeflate_ci libdeflate
+ htslib_to_link=htslib_ci
+ [[ -n '' ]]
+ [[ ! -s htslib_ci/libhts.so ]]
+ [[ htslib_ci != \h\t\s\l\i\b\_\s\t\a\t\i\c ]]
+ export CPPFLAGS=-I../libdeflate
+ CPPFLAGS=-I../libdeflate
+ export 'LDFLAGS=-L../libdeflate -ldeflate'
+ LDFLAGS='-L../libdeflate -ldeflate'
+ [[ htslib_ci == \h\t\s\l\i\b\_\s\t\a\t\i\c ]]
+ [[ -n 1 ]]
+ ln -fs htslib_ci htslib
+ ./get_htslib.sh linux
+ compiler=linux
+ platform=
+ target_dir=htslib
+ [[ -n '' ]]
+ VER=1.11
+ [[ -z 1 ]]
+ pushd htslib
/home/hello/megadepth/htslib /home/hello/megadepth
+ autoheader
+ autoconf
+ make clean
expr: warning: '^\([0-9.]*\)$': using '^' as the first character
of a basic regular expression is not portable; it is ignored
rm -f test/*.tmp test/*.tmp.* test/longrefs/*.tmp.* test/tabix/*.tmp.* test/tabix/FAIL* header-exports.txt shlib-exports-so.txt
rm -f *.o *.pico cram/*.o cram/*.pico test/*.o test/*.dSYM version.h
rm -f hts-object-files
rm -f libhts.so libhts.so.*
rm -f libhts.a bgzip htsfile tabix  test/hts_endian test/fieldarith test/hfile test/pileup test/plugins-dlhts test/sam test/test_bgzf test/test_kfunc test/test_kstring test/test_realn test/test-regidx test/test_str2int test/test_view test/test_index test/test-vcf-api test/test-vcf-sweep test/test-bcf-sr test/fuzz/hts_open_fuzzer.o test/test-bcf-translate test/test-parse-reg test/thrash_threads1 test/thrash_threads2 test/thrash_threads3 test/thrash_threads4 test/thrash_threads5 test/thrash_threads6 test/thrash_threads7
+ [[ linux == \l\i\n\u\x ]]
+ [[ '' == \h\b\b ]]
+ ./configure --disable-libcurl --disable-bz2 --disable-lzma --with-libdeflate
checking for gcc... gcc
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 the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking for ranlib... ranlib
checking for grep that handles long lines and -e... /bin/grep
checking for C compiler warning flags... -Wall
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for gcc option to enable large file support... none needed
checking shared library type for unknown-Linux... plain .so
checking whether the compiler accepts -fvisibility=hidden... yes
checking build system type... x86_64-pc-linux-musl
checking host system type... Invalid configuration 'unknown-Linux': machine 'unknown-unknown' not recognized
configure: error: /bin/sh ./config.sub unknown-Linux failed
ChristopherWilks commented 3 months ago

Hi @ConYel,

I'd suggest it's better to just download a pre-compiled static version of megadepth into your container which I can compile pretty easily for the lastest 1.2.0 version---instead of you trying to compile it yourself, since that is far from easy (as you've found).

What architecture are you on (I'm assuming either x86_64 or aarch64, if it's something else I might have difficulty compiling for that)?

Chris

ConYel commented 3 months ago

Dear @ChristopherWilks , thank you for your prompt reply and of course for the tool!

I understand your concerns but my point here is to manage to compile it in an alpine docker container. I am working on reproducibility and afterwards I will try to make reproducible binaries. Yes I am working on x86_64. Is the htslib the main problem?