emscripten-core / emsdk

Emscripten SDK
http://emscripten.org
Other
2.98k stars 679 forks source link

docker image build on WSL2 stops on error #1259

Open coolio986 opened 1 year ago

coolio986 commented 1 year ago

I am using the latest pull from the repo as of today. I am trying to build the docker image using ubuntu under wsl2.

The build in README says to use this build syntax.

docker build \
    --network host \
    --build-arg=EMSCRIPTEN_VERSION=1.39.17 \
    -t emscripten/emsdk:1.39.17 \
    -f docker/Dockerfile \
    .

This results in the error below

[+] Building 1.9s (9/15)
 => [internal] load build definition from Dockerfile                                                                                                                 0.0s
 => => transferring dockerfile: 38B                                                                                                                                  0.0s
 => [internal] load .dockerignore                                                                                                                                    0.1s
 => => transferring context: 35B                                                                                                                                     0.0s
 => [internal] load metadata for docker.io/library/ubuntu:jammy                                                                                                      1.6s
 => [auth] library/ubuntu:pull token for registry-1.docker.io                                                                                                        0.0s
 => [internal] load build context                                                                                                                                    0.1s
 => => transferring context: 444B                                                                                                                                    0.1s
 => CACHED [stage_build 1/6] FROM docker.io/library/ubuntu:jammy@sha256:0bced47fffa3361afa981854fcabcd4577cd43cebbb808cea2b1f33a3dd7f508                             0.0s
 => CACHED [stage_build 2/6] RUN echo "## Start building"     && echo "## Update and install packages"     && apt-get -qq -y update     && apt-get -qq install -y -  0.0s
 => CACHED [stage_build 3/6] COPY . /emsdk                                                                                                                           0.0s
 => ERROR [stage_build 4/6] RUN echo "## Install Emscripten"     && cd /emsdk     && ./emsdk install 1.39.17     && echo "## Done"                                   0.1s
------
 > [stage_build 4/6] RUN echo "## Install Emscripten"     && cd /emsdk     && ./emsdk install 1.39.17     && echo "## Done":
#9 0.109 ## Install Emscripten
#9 0.109 /bin/sh: 1: ./emsdk: not found
------
executor failed running [/bin/sh -c echo "## Install Emscripten"     && cd ${EMSDK}     && ./emsdk install ${EMSCRIPTEN_VERSION}     && echo "## Done"]: exit code: 127

Putting an ls -al inline with ./emsdk, the folder structure looks like this

[+] Building 1.0s (8/14)
 => [internal] load build definition from Dockerfile                                                                                                                 0.0s
 => => transferring dockerfile: 5.21kB                                                                                                                               0.0s
 => [internal] load .dockerignore                                                                                                                                    0.0s
 => => transferring context: 35B                                                                                                                                     0.0s
 => [internal] load metadata for docker.io/library/ubuntu:jammy                                                                                                      0.7s
 => [internal] load build context                                                                                                                                    0.1s
 => => transferring context: 444B                                                                                                                                    0.1s
 => CACHED [stage_build 1/6] FROM docker.io/library/ubuntu:jammy@sha256:0bced47fffa3361afa981854fcabcd4577cd43cebbb808cea2b1f33a3dd7f508                             0.0s
 => CACHED [stage_build 2/6] RUN echo "## Start building"     && echo "## Update and install packages"     && apt-get -qq -y update     && apt-get -qq install -y -  0.0s
 => CACHED [stage_build 3/6] COPY . /emsdk                                                                                                                           0.0s
 => ERROR [stage_build 4/6] RUN echo "## Install Emscripten"     && cd /emsdk  && ls -al     && ./emsdk install 1.39.17     && echo "## Done"                        0.1s
------
 > [stage_build 4/6] RUN echo "## Install Emscripten"     && cd /emsdk  && ls -al     && ./emsdk install 1.39.17     && echo "## Done":
#8 0.086 ## Install Emscripten
#8 0.087 total 196
#8 0.087 drwxr-xr-x 3 root root   4096 Jul 12 20:01 .
#8 0.087 drwxr-xr-x 1 root root   4096 Jul 12 20:36 ..
#8 0.087 -rwxrwxrwx 1 root root   1353 Jul 12 14:41 LICENSE
#8 0.087 drwxrwxrwx 2 root root   4096 Jul 12 20:01 docker
#8 0.087 -rwxrwxrwx 1 root root  11052 Jul 12 14:41 emscripten-releases-tags.json
#8 0.087 -rwxrwxrwx 1 root root   1688 Jul 12 14:41 emsdk
#8 0.087 -rwxrwxrwx 1 root root 119901 Jul 12 14:41 emsdk.py
#8 0.087 -rwxrwxrwx 1 root root   2050 Jul 12 14:41 emsdk_env.sh
#8 0.087 -rwxrwxrwx 1 root root  25862 Jul 12 14:41 emsdk_manifest.json
#8 0.087 -rwxrwxrwx 1 root root    744 Jul 12 14:41 legacy-binaryen-tags.txt
#8 0.087 -rwxrwxrwx 1 root root   1348 Jul 12 14:41 legacy-emscripten-tags.txt
#8 0.087 -rwxrwxrwx 1 root root   2455 Jul 12 14:41 llvm-tags-64bit.txt
#8 0.087 /bin/sh: 1: ./emsdk: not found
------
executor failed running [/bin/sh -c echo "## Install Emscripten"     && cd ${EMSDK}     && ls -al     && ./emsdk install ${EMSCRIPTEN_VERSION}     && echo "## Done"]: exit code: 127

emsdk is present and has a +x on it.

Doing a fresh git clone results in the same issue. Not sure if this is a wsl2 issue or dockerfile issue.

coolio986 commented 1 year ago

Update to the issue.

I did a git clone inside wsl2 rather than on the windows host. This got me a bit further but still ended with errors

[+] Building 46.7s (9/14)
 => [internal] load build definition from Dockerfile                                                                                                                 0.0s
 => => transferring dockerfile: 5.06kB                                                                                                                               0.0s
 => [internal] load .dockerignore                                                                                                                                    0.0s
 => => transferring context: 2B                                                                                                                                      0.0s
 => [internal] load metadata for docker.io/library/ubuntu:jammy                                                                                                      0.9s
 => [internal] load build context                                                                                                                                    0.3s
 => => transferring context: 335.95kB                                                                                                                                0.3s
 => CACHED [stage_build 1/6] FROM docker.io/library/ubuntu:jammy@sha256:0bced47fffa3361afa981854fcabcd4577cd43cebbb808cea2b1f33a3dd7f508                             0.0s
 => CACHED [stage_build 2/6] RUN echo "## Start building"     && echo "## Update and install packages"     && apt-get -qq -y update     && apt-get -qq install -y -  0.0s
 => [stage_build 3/6] COPY . /emsdk                                                                                                                                  0.0s
 => [stage_build 4/6] RUN echo "## Install Emscripten"     && cd /emsdk     && ./emsdk install 1.39.17     && echo "## Done"                                        44.0s
 => ERROR [stage_build 5/6] RUN cd /emsdk     && echo "## Generate standard configuration"     && ./emsdk activate 1.39.17     && chmod 777 /emsdk/upstream/emscrip  1.3s
------
 > [stage_build 5/6] RUN cd /emsdk     && echo "## Generate standard configuration"     && ./emsdk activate 1.39.17     && chmod 777 /emsdk/upstream/emscripten     && chmod -R 777 /emsdk/upstream/emscripten/cache     && echo "int main() { return 0; }" > hello.c     && /emsdk/upstream/emscripten/emcc -c hello.c     && cat /emsdk/upstream/emscripten/cache/sanity.txt     && echo "## Done":
#9 0.152 ## Generate standard configuration
#9 0.249 Resolving SDK version '1.39.17' to 'sdk-releases-9bc968c0e49b1c795ecddb87391b265911e2adcb-64bit'
#9 0.249 Setting the following tools as active:
#9 0.249    node-16.20.0-64bit
#9 0.249    releases-9bc968c0e49b1c795ecddb87391b265911e2adcb-64bit
#9 0.249
#9 0.249 Next steps:
#9 0.249 - To conveniently access emsdk tools from the command line,
#9 0.249   consider adding the following directories to your PATH:
#9 0.249     /emsdk
#9 0.249     /emsdk/node/16.20.0_64bit/bin
#9 0.249     /emsdk/upstream/emscripten
#9 0.249 - This can be done for the current shell by running:
#9 0.249     source "/emsdk/emsdk_env.sh"
#9 0.249 - Configure emsdk in your shell startup scripts by running:
#9 0.249     echo 'source "/emsdk/emsdk_env.sh"' >> $HOME/.bash_profile
#9 1.131 cache:INFO: generating system asset: is_vanilla.txt... (this will be cached in "/emsdk/upstream/emscripten/cache/is_vanilla.txt" for subsequent builds)
#9 1.142 cache:INFO:  - ok
#9 1.243 shared:INFO: (Emscripten: Running sanity checks)
#9 1.271 cat: /emsdk/upstream/emscripten/cache/sanity.txt: No such file or directory
------
executor failed running [/bin/sh -c cd ${EMSDK}     && echo "## Generate standard configuration"     && ./emsdk activate ${EMSCRIPTEN_VERSION}     && chmod 777 ${EMSDK}/upstream/emscripten     && chmod -R 777 ${EMSDK}/upstream/emscripten/cache     && echo "int main() { return 0; }" > hello.c     && ${EMSDK}/upstream/emscripten/emcc -c hello.c     && cat ${EMSDK}/upstream/emscripten/cache/sanity.txt     && echo "## Done"]: exit code: 1
coolio986 commented 1 year ago

Another update

I removed

&& cat ${EMSDK}/upstream/emscripten/cache/sanity.txt \

from the docker file and the build completed successfully