browserstack / browserstack-local-nodejs

NodeJS bindings for BrowserStack Local
https://www.browserstack.com
MIT License
71 stars 56 forks source link

Tunnel fails on alpine linux #20

Closed joscha closed 8 years ago

joscha commented 8 years ago

It seems that the binary can't be properly started on an alpine-based image:

BrowserStack error BrowserStack tunnel: 'LocalError: Error: spawn /root/.browserstack/BrowserStackLocal ENOENT'

I suspect some of the logic to figure out which binary to download to be failing.

With alpine:3.4:

bash-4.3# wget https://www.browserstack.com/browserstack-local/BrowserStackLocal-linux-x64.zip
--2016-10-04 23:27:59--  https://www.browserstack.com/browserstack-local/BrowserStackLocal-linux-x64.zip
Resolving www.browserstack.com... 52.200.35.219, 52.205.168.216, 54.164.231.212
Connecting to www.browserstack.com|52.200.35.219|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5914538 (5.6M) [application/zip]
Saving to: 'BrowserStackLocal-linux-x64.zip'

BrowserStackLocal-linux-x64.zip        100%[===========================================================================>]   5.64M   403KB/s    in 31s

2016-10-04 23:28:34 (188 KB/s) - 'BrowserStackLocal-linux-x64.zip' saved [5914538/5914538]

bash-4.3# unzip BrowserStackLocal-linux-x64.zip
Archive:  BrowserStackLocal-linux-x64.zip
  inflating: BrowserStackLocal
bash-4.3# ./BrowserStackLocal
bash: ./BrowserStackLocal: No such file or directory
joscha commented 8 years ago

Seems there are some missing libs:

bash-4.3# file ./BrowserStackLocal
./BrowserStackLocal: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18, BuildID[sha1]=65535af54d7b8808fdd2b7587354710dd3ced488, stripped
bash-4.3# ldd ./BrowserStackLocal
    /lib64/ld-linux-x86-64.so.2 (0x560fb93fa000)
    libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x560fb93fa000)
    librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x560fb93fa000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7f9b26973000)
    libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x560fb93fa000)
    libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7f9b26760000)
    libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x560fb93fa000)
    libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x560fb93fa000)
Error relocating ./BrowserStackLocal: __isnan: symbol not found
Error relocating ./BrowserStackLocal: backtrace: symbol not found
Error relocating ./BrowserStackLocal: __isinf: symbol not found
joscha commented 8 years ago

After installing https://github.com/sgerrand/alpine-pkg-glibc we can at least see an error:

bash-4.3# ./BrowserStackLocal
./BrowserStackLocal: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
joscha commented 8 years ago

Seems to be related to: https://github.com/gliderlabs/docker-alpine/issues/11

vedharish commented 8 years ago

@joscha Thank you for digging up on this!

joscha commented 8 years ago

@vedharish ;) I just opened a support ticket - I actually think the only way to do this is to build the binary on alpine and provide it or to make the source available, so it can be built at template build time.

joscha commented 8 years ago

Got it to work, I'll leave this here for future reference:

#### <browserstack>
# Copied from https://github.com/sgerrand/alpine-pkg-glibc

ENV GLIBC_VERSION 2.23-r3

RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub \
&&  wget "https://github.com/sgerrand/alpine-pkg-glibc/releases/download/$GLIBC_VERSION/glibc-$GLIBC_VERSION.apk" \
&&  apk --no-cache add "glibc-$GLIBC_VERSION.apk" \
&&  rm "glibc-$GLIBC_VERSION.apk" \
&&  wget "https://github.com/sgerrand/alpine-pkg-glibc/releases/download/$GLIBC_VERSION/glibc-bin-$GLIBC_VERSION.apk" \
&&  apk --no-cache add "glibc-bin-$GLIBC_VERSION.apk" \
&&  rm "glibc-bin-$GLIBC_VERSION.apk" \
&&  wget "https://github.com/sgerrand/alpine-pkg-glibc/releases/download/$GLIBC_VERSION/glibc-i18n-$GLIBC_VERSION.apk" \
&&  apk --no-cache add "glibc-i18n-$GLIBC_VERSION.apk" \
&&  rm "glibc-i18n-$GLIBC_VERSION.apk"

RUN wget -q https://www.browserstack.com/browserstack-local/BrowserStackLocal-linux-x64.zip \
&&  unzip BrowserStackLocal-linux-x64.zip \
&&  rm BrowserStackLocal-linux-x64.zip
#### </browserstack>
joscha commented 8 years ago

It is used here: https://bitbucket.org/atlassian/atlaskit/src/c6d7641f1a0b5cd914ef758e0d66e10f6df86f81/Dockerfile?at=master&fileviewer=file-view-default

holms commented 5 years ago

It still doesn't work to me:

BrowserStackLocal: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

I really wonder why browserstack won't provide docker image. it's kind of 2019 already and we're not living in a tank.