3

I want to install MongoDB 4.4 on Alpine 3.11, but it appears that Alpine has removed the MDB package because of BSD license. I have to build the image myself, but I have some errors...

Firstly, I clone de git repository :

git clone --branch v4.4 --single-branch --depth 1 https://github.com/mongodb/mongo.git /tmp/mongo

Then I install some packages :

apk add --no-cache --virtual build-pack \
        boost-build=1.69.0-r1 \
        boost-filesystem=1.71.0-r1 \
        boost-iostreams=1.71.0-r1 \
        boost-program_options=1.71.0-r1 \
        boost-python3=1.71.0-r1 \
        boost-system=1.71.0-r1 \
        build-base=0.5-r1 \
        busybox=1.31.1-r9 \
        curl-dev=7.67.0-r0 \
        cmake=3.15.5-r0 \
        db=5.3.28-r1 \
        isl=0.18-r0 \
        libbz2=1.0.8-r1 \
        libc-dev=0.7.2-r0 \
        libgcc=9.2.0-r4
        libpcrecpp=8.43-r0 \
        libsasl=2.1.27-r5 \
        libssl1.1=1.1.1d-r3 \
        libstdc++=9.2.0-r4 \
        linux-headers=4.19.36-r0 \
        g++=9.2.0-r4 \
        gcc=9.2.0-r4 \
        gmp=6.1.2-r1 \
        jsoncpp=1.9.2-r0  \
        jsoncpp-dev=1.9.2-r0 \
        mpc1=1.1.0-r1 \
        mpfr4=4.0.2-r1 \
        musl=1.1.24-r2 \
        musl-dev=1.1.24-r2 \
        openssl-dev=1.1.1d-r3 \
        pcre=8.43-r0 \
        pkgconf=1.6.3-r0 \
        python3=3.8.2-r0 \
        py3-cheetah=3.2.4-r1 \
        py3-crypto=2.6.1-r5 \
        py3-openssl=19.1.0-r0 \
        py3-psutil=5.6.7-r0 \
        py3-yaml=5.3.1-r0 \
        scons=3.1.1-r0 \
        snappy=1.1.7-r1 \
        xz-libs=5.2.4-r0 \
        yaml-cpp=0.6.3-r0 \
        yaml-cpp-dev=0.6.3-r0 \
        zlib=1.2.11-r3

I have this error when I use this command python3 buildscripts/scons.py MONGO_VERSION=4.4 --prefix=/opt/mongo mongod --disable-warnings-as-errors :

src/mongo/util/processinfo_linux.cpp:50:10: fatal error: gnu/libc-version.h: No such file or directory
...
scons: building terminated because of errors.
build/opt/mongo/util/processinfo_linux.o failed: Error 1

Any idea ?

Thanks.

EDIT : I have tried 4.2.5 version, I have this error message and :

In file included from src/third_party/mozjs-60/platform/x86_64/linux/build/Unified_cpp_js_src29.cpp:11:
src/third_party/mozjs-60/extract/js/src/threading/posix/Thread.cpp: In function 'void js::ThisThread::GetName(char*, size_t)':
src/third_party/mozjs-60/extract/js/src/threading/posix/Thread.cpp:210:8: error: 'pthread_getname_np' was not declared in this scope; did you mean 'pthread_setname_np'?
 210 |   rv = pthread_getname_np(pthread_self(), nameBuffer, len);
     |        ^~~~~~~~~~~~~~~~~~
     |        pthread_setname_np
scons: *** [build/opt/third_party/mozjs-60/platform/x86_64/linux/build/Unified_cpp_js_src29.o] Error 1
scons: building terminated because of errors.
build/opt/third_party/mozjs-60/platform/x86_64/linux/build/Unified_cpp_js_src29.o failed: Error 1

With these packages :

apk add --no-cache --virtual build-pack \
        build-base=0.5-r1 \
        cmake=3.15.5-r0 \
        curl-dev=7.67.0-r0 \
        libgcc=9.2.0-r4 \
        libssl1.1=1.1.1d-r3 \
        libstdc++=9.2.0-r4 \
        linux-headers=4.19.36-r0 \
        g++=9.2.0-r4 \
        gcc=9.2.0-r4 \
        openssl-dev=1.1.1d-r3 \
        musl=1.1.24-r2
        python3=3.8.2-r0 \
        py3-cheetah=3.2.4-r1 \
        py3-crypto=2.6.1-r5 \
        py3-openssl=19.1.0-r0 \
        py3-psutil=5.6.7-r0 \
        py3-yaml=5.3.1-r0 \
        scons=3.1.1-r0 \
        libc-dev=0.7.2-r0
M4kn4sh
  • 540
  • 7
  • 22
  • you're missing some development package(s)... don't know Alpine, but a guess would be something libc-dev or glibc-dev. Or... that's installed but somehow the right env isn't picked up - in pthread.h that function is protected by `#ifdef __USE_GNU` – Mats Wichmann Mar 25 '20 at 13:28
  • Thank you @MatsWichmann. I was tried with libc-dev 0.7.2-r0 but it doesn't works. There is no packages for glibc-dev on Alpine https://pkgs.alpinelinux.org/packages?name=*glibc*&branch=v3.11&arch=x86_64 – M4kn4sh Mar 25 '20 at 14:14
  • I have put some new logs after adding libc-dev=0.7.2-r0 – M4kn4sh Mar 25 '20 at 15:03
  • v4.4 is a development branch, not a release tag. You'll probably have better luck with the latest release at tag `r4.2.5` – Joe Mar 25 '20 at 18:30
  • Ok I have tried de 4.2.5 version but I always have an error. I have edited my question. – M4kn4sh Mar 26 '20 at 09:10
  • I'm not familiar with that error. You might find some information from this question: https://stackoverflow.com/questions/30346649/pthread-setname-np-was-not-declared-in-this-scope. – Joe Mar 26 '20 at 10:44
  • Thank you @Joe, when I try `getconf GNU_LIBC_VERSION` I have this message : `getconf: GNU_LIBC_VERSION: unknown variable` but I have installed musl. – M4kn4sh Mar 26 '20 at 13:04
  • Ok I've found this https://stackoverflow.com/a/52841405 but when I install glibc-2.31, I have this error :( https://pastebin.com/ig3PRCjn – M4kn4sh Mar 26 '20 at 15:33
  • Okay, this really isn't going to be easy, Alpine doesn't use glibc ("Alpine Linux is built around musl libc and busybox"). Either find an old mongo pkg for Alpine from before it was removed and use those instructions to do your own port, or plan to run it in a VM - assuming any of the prepackaged ones will work - could check Vagrant / Bitnami, but does virtualbox run on Alpine? Might be a nonstarter as well. – Mats Wichmann Mar 27 '20 at 15:53
  • Hi @MatsWichmann, I use Docker only and I want the last version of MongoDB. So it's impossible for me to use Alpine and MongoDB :( – M4kn4sh Mar 28 '20 at 16:30
  • Is there an Alpine community you could ask around about this? Seems like the goals of that OS may be a little different than running a massively scalable nosql DB, but I don't know anything about them so that's just me guessing. Don't give up yet, though. – Mats Wichmann Apr 03 '20 at 16:24

1 Answers1

0

Just run:

apk update && apk add openrc
DEV Tiago França
  • 1,271
  • 9
  • 9