MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.08k stars 21.13k forks source link

add chroot example for Alpine Linux - TTS #121445

Open Baklap4 opened 2 months ago

Baklap4 commented 2 months ago

The current repo says: https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/ai-services/speech-service/includes/quickstarts/platform/linux-distributions.md

To use the Speech SDK in Alpine Linux, create a Debian chroot environment as documented in the Alpine Linux Wiki on running glibc programs. Then follow the Debian instructions here.

sudo apt-get update sudo apt-get install build-essential libssl-dev ca-certificates libasound2 wget

I've followed the Alpine Linux Wiki but can't seem to get this working.

My Dockerfile looks like this:

FROM mcr.microsoft.com/dotnet/aspnet:7.0.17-alpine3.19

WORKDIR /src

COPY publish .

ENV ASPNETCORE_URLS="http://0.0.0.0:5000"
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
ENV LD_LIBRARY_PATH=/root/chroot/lib64:/root/chroot/lib

EXPOSE 5000

RUN apk add --no-cache wget zip libuuid libunwind gcompat icu-libs debootstrap \
    && mkdir ~/chroot \
    && debootstrap bullseye ~/chroot https://deb.debian.org/debian/ \
    && mkdir -p ~/chroot/lib64 \
    && ln -s ~/chroot/lib/x86_64-linux-gnu/ld-2.31.so ~/chroot/lib64 \
    && printf '/lib/x86_64-linux-gnu\n/usr/lib/x86_64-linux-gnu\n' > ~/chroot/etc/ld.so.conf \
    && chroot ~/chroot /sbin/ldconfig \
    && chroot ~/chroot /bin/bash -c 'apt update && apt install -y build-essential libssl-dev ca-certificates libasound2 wget' \
    && rm -rf ~/chroot/var/lib/apt/lists/*

CMD ["dotnet", "MyAwesomeApplication.dll"] 

Within the API we're generating TextToSpeech and this works flawlessly with Debian, but not with Alpine and chrooted debian.

I'd love to get a minimal example (preferably in docker) to get this working.

Other info

/src # ldd /src/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so
        /lib/ld-musl-x86_64.so.1 (0x7f5bf5787000)
        libdl.so.2 => /lib/ld-musl-x86_64.so.1 (0x7f5bf5787000)
        libpthread.so.0 => /lib/ld-musl-x86_64.so.1 (0x7f5bf5787000)
        libuuid.so.1 => /lib/libuuid.so.1 (0x7f5bf50ea000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7f5bf4e51000)
        libm.so.6 => /lib/ld-musl-x86_64.so.1 (0x7f5bf5787000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7f5bf4e2d000)
        libc.so.6 => /lib/ld-musl-x86_64.so.1 (0x7f5bf5787000)
        ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x7f5bf4e26000)
Error relocating /src/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so: __vsnprintf_chk: symbol not found
Error relocating /src/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so: __fprintf_chk: symbol not found
Error relocating /src/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so: backtrace_symbols: symbol not found
Error relocating /src/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so: __memcpy_chk: symbol not found
Error relocating /src/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so: __strcpy_chk: symbol not found
Error relocating /src/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so: __vprintf_chk: symbol not found
Error relocating /src/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so: __printf_chk: symbol not found
Error relocating /src/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so: backtrace: symbol not found
Error relocating /src/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so: __sprintf_chk: symbol not found
Error relocating /src/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so: __snprintf_chk: symbol not found 
cat ~/chroot/etc/ld.so.conf
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
/src #
ls -la ~/chroot/
total 68
drwxr-xr-x   17 root     root          4096 Apr  9 13:21 .
drwx------    1 root     root          4096 Apr  9 13:29 ..
lrwxrwxrwx    1 root     root             7 Apr  9 13:19 bin -> usr/bin
drwxr-xr-x    2 root     root          4096 Jan 28 21:20 boot
drwxr-xr-x    4 root     root          4096 Apr  9 13:19 dev
drwxr-xr-x   52 root     root          4096 Apr  9 13:21 etc
drwxr-xr-x    2 root     root          4096 Jan 28 21:20 home
lrwxrwxrwx    1 root     root             7 Apr  9 13:19 lib -> usr/lib
lrwxrwxrwx    1 root     root             9 Apr  9 13:19 lib64 -> usr/lib64
drwxr-xr-x    2 root     root          4096 Apr  9 13:19 media
drwxr-xr-x    2 root     root          4096 Apr  9 13:19 mnt
drwxr-xr-x    2 root     root          4096 Apr  9 13:19 opt
drwxr-xr-x    2 root     root          4096 Jan 28 21:20 proc
drwx------    2 root     root          4096 Apr  9 13:19 root
drwxr-xr-x    3 root     root          4096 Apr  9 13:19 run
lrwxrwxrwx    1 root     root             8 Apr  9 13:19 sbin -> usr/sbin
drwxr-xr-x    2 root     root          4096 Apr  9 13:19 srv
drwxr-xr-x    2 root     root          4096 Jan 28 21:20 sys
drwxrwxrwt    2 root     root          4096 Apr  9 13:21 tmp
drwxr-xr-x   12 root     root          4096 Apr  9 13:19 usr
drwxr-xr-x   11 root     root          4096 Apr  9 13:19 var
# ls -la ~/chroot/lib64/
total 8
drwxr-xr-x    2 root     root          4096 Apr  9 13:21 .
drwxr-xr-x   12 root     root          4096 Apr  9 13:19 ..
lrwxrwxrwx    1 root     root            44 Apr  9 13:21 ld-2.31.so -> /root/chroot/lib/x86_64-linux-gnu/ld-2.31.so
lrwxrwxrwx    1 root     root            32 Jan 28 22:58 ld-linux-x86-64.so.2 -> /lib/x86_64-linux-gnu/ld-2.31.so
TPavanBalaji commented 2 months ago

@Baklap4 It would be great if you could add a link to the documentation you are following for these steps? This would help us redirect the issue to the appropriate team. Thanks!

Baklap4 commented 2 months ago

Im referring to this link from alpine linux: https://wiki.alpinelinux.org/wiki/Running_glibc_programs

Baklap4 commented 2 months ago

Update: now trying with https://github.com/sgerrand/alpine-pkg-glibc but also to no avail. Running into issues where libstdc++ comes back with:

runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so: /usr/lib/libstdc++.so.6: no version information available (required by runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so)

ManoharLakkoju-MSFT commented 2 months ago

@Baklap4 Please Note, GitHub forum is dedicated for Microsoft documentation related issues. So kindly share Microsoft document link which you are following for these steps.

Baklap4 commented 2 months ago

@Baklap4 Please Note, GitHub forum is dedicated for Microsoft documentation related issues. So kindly share Microsoft document link which you are following for these steps.

It was stated on the first paragraph of the question: The current MicrosoftDocs repo says: https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/ai-services/speech-service/includes/quickstarts/platform/linux-distributions.md

To use the Speech SDK in Alpine Linux, create a Debian chroot environment as documented in the Alpine Linux Wiki on running glibc programs. Then follow the Debian instructions here.

sudo apt-get update sudo apt-get install build-essential libssl-dev ca-certificates libasound2 wget

AjayBathini-MSFT commented 2 months ago

@Baklap4 Thanks for bringing this to our attention. I'm going to assign this to the document author so they can take a look at it accordingly.

Baklap4 commented 2 months ago

So how is this coming along?

Baklap4 commented 1 month ago

If i can add any value, just let me know :)