Giter Site home page Giter Site logo

trzecieu / emscripten-docker Goto Github PK

View Code? Open in Web Editor NEW
97.0 97.0 29.0 243 KB

Docker image with Emscripten to compile ASM.js and WebAssembly

License: MIT License

Python 33.42% C++ 0.10% Shell 0.73% Dockerfile 65.75%
asmjs docker emscripten wasm webassembly

emscripten-docker's People

Contributors

forderud avatar kleisauke avatar quuxplusone avatar squareys avatar trzecieu avatar virtualtim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

emscripten-docker's Issues

make: command not found

Hi,

I'm using trzeci/emscripten:sdk-tag-1.37.3-64bit on GitLab CI.
I get the following error:

make: command not found

I don't understand how èmake` is not in the image.

Please advise,

Using docker image on travis-ci

Hello,

When I'm trying to use this docker image on travis I'm getting the following error:

Makefile:2: *** You need to install/source emscripten and run with "emmake make". Stop.

5 days ago was working ok: https://travis-ci.org/image-js/stroke-width-transform/builds/336607121
but right now is not working: https://travis-ci.org/image-js/stroke-width-transform/builds/338482076

I just change the way that it runs the docker container but still get the same error

original repo: https://github.com/image-js/stroke-width-transform

Can't compile WASM

printf '#include <iostream>\nint main(){std::cout<<"HELLO FROM DOCKER C++"<<std::endl;return 0;}' > test.cpp
docker run --rm -v $(pwd):/src trzeci/emscripten:sdk-tag-1.35.4-64bit emcc src/test.cpp -o src/test.js -s WASM=1 

Will fail to compile binaryen

Update to Debian stretch

Could you please update the base image from jessie to stretch?
Jessie no longer receives official support and thus using this image as a basis for webservices is problematic.

ETA for latest Emscripten builds

The docker image is two releases and ~2 months behind the latest Emscripten releases.
I get that you're on holidays, but is there any estimate on when you think you can work on this?
I'm not trying to rush you, just trying to organise my time.

Install zip/unzip

A nice-to-have, but not essential. It would allow make to do more bundling/packaging.

emscripten-upstream exception problems

I'm having problems enabling C++ exception catching when compiling code against the emscripten-upstream:sdk-tag-1.38.43-64bit container. Exceptions used to work fine with the fastcomp-based emscripten containers.

Details:

Is this a known issue?

Ubuntu version?

From the changelog it looks like there used to be an Ubuntu version. Is it possible to make an Ubuntu version of the images? Thanks!

In docs, suggest running docker with current user id rather than emscripten user

Hi, this is a very useful image. Thanks for creating it!

It worked for me on my Mac, but when I tried to run it on Travis CI, I got a permission error as soon as emcc tried to write to the file system:

command: "docker" "run" "--rm" "--volume" "/home/travis/build/tree-sitter/tree-sitter/test/fixtures/grammars/javascript:/src" "--user" "emscripten" "trzeci/emscripten-slim" "emcc" "-o" "tree-sitter-javascript.wasm" "-Os" "-s" "WASM=1" "-s" "SIDE_MODULE=1" "-s" "EXPORTED_FUNCTIONS=[\"_tree_sitter_javascript\"]" "-I" "src"

emcc command failed - Unable to find image 'trzeci/emscripten-slim:latest' locally
latest: Pulling from trzeci/emscripten-slim
e79bb959ec00: Pulling fs layer
67c164866f5d: Pulling fs layer
f3b772b4e21c: Pulling fs layer
f3b772b4e21c: Verifying Checksum
f3b772b4e21c: Download complete
e79bb959ec00: Download complete
e79bb959ec00: Pull complete
67c164866f5d: Verifying Checksum
67c164866f5d: Download complete
67c164866f5d: Pull complete
f3b772b4e21c: Pull complete
Digest: sha256:9fcec955b3174a78b0422e6dde4c9e58e9a68e5646102b11b1ecb0f358987571
Status: Downloaded newer image for trzeci/emscripten-slim:latest
Traceback (most recent call last):
  File "/emsdk_portable/sdk/emcc.py", line 3308, in <module>
    sys.exit(run(sys.argv))
  File "/emsdk_portable/sdk/emcc.py", line 2066, in run
    src = re.sub(shared.JS.memory_initializer_pattern, repl, open(final).read(), count=1)
  File "/usr/lib/python2.7/re.py", line 155, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "/emsdk_portable/sdk/emcc.py", line 2057, in repl
    open(memfile, 'wb').write(bytearray(membytes))
IOError: [Errno 13] Permission denied: 'tree-sitter-javascript.wasm.mem'

After reading about permissions issues with docker volumes, I replaced --user emscripten with --user $(id -u) (specifying my user id on the host, rather than a username). This fixed the problem for me.

I think this might be a better suggestion to make in the docs. What do you think?

Exported functions fail due lack of Perl JSON Module

I'm attempting to build an emscripten-based project that uses the -s EXPORTED_FUNCTIONS option to emcc but it fails with:

perl -MJSON -ne '$f{"_$1"}=1 if /(olm_[^( ]*)\(/; END { @f=sort keys %f; print encode_json \@f }' [header files] > javascript/exported_functions.json.tmp
Can't locate JSON.pm in @INC (you may need to install the JSON module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.20.2 /usr/local/share/perl/5.20.2 /usr/lib/x86_64-linux-gnu/perl5/5.20 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.20 /usr/share/perl/5.20 /usr/local/lib/site_perl .).

It looks like adding libjson-perl to the list of installed apt packages is necessary to use the -s EXPORTED_FUNCTIONS option?

PATH not set correctly

Locally, when running docker run -it, the PATH env var is set correctly. But I also tried to use this image on Circle CI, and emscripten binaries are not in the PATH there. Where is the PATH set?

Upgrade to CMake 3.14?

Hi, I just want to give you a big thank to @trzecieu running this project. It really makes it much easier to start experimenting with WebAssembly for Windows users.

One request though is upgrading to a more recent version of CMake. I'm working on a project that could really benefit from the new add_link_options and target_link_options commands that were introduced in CMake 3.13 (https://cmake.org/cmake/help/latest/release/3.13.html). The current 3.12 version therefore doesn't support these commands.

Disable 32bit support

Docker runs 64 bit arch by default, compiling by default 32bit versions seems pointless.

Install Node 8.9

Emsdk allows you to install Node 8.9 now. That would be very useful.

Has the pwd changed?

I've just changed from trzeci/emscripten:sdk-incoming-64bit to trzeci/emscripten:1.39.2-fastcomp and now make is saying there are no targets:
sdk-incoming-64bit: https://travis-ci.org/curiousdannii/emglken/builds/580095103
1.39.2-fastcomp: https://travis-ci.org/curiousdannii/emglken/builds/610665756

docker run -dit --name emscripten -v $(pwd):/src trzeci/emscripten:1.39.2-fastcomp bash
docker exec -it emscripten make
make: *** No targets specified and no makefile found.  Stop.

I had been running

$(pwd):/src

But I've noticed the docs now say

`pwd`:`pwd` or $(pwd):$(pwd)

I also tried both of those, but no success:
https://travis-ci.org/curiousdannii/emglken/builds/610671596
https://travis-ci.org/curiousdannii/emglken/builds/610672121

Any ideas?

We'll also have to update the Emscripten docs.

Increase CMake Version

Hi @asria!

I am using your docker image to compile a project based on magnum which supports emscripten builds through a cmake toolchain.

The toolchain requires at least CMake 3.7, though (https://github.com/mosra/toolchains/blob/master/generic/Emscripten-wasm.cmake#L48 for explanation), but the image only provides 3.6.

I already built a custom version of your image where I simply updated the cmake download link and that works great, but it would be amazing to not have to maintain that myself with every emscripten update.

Would you be okay with increasing the CMake version? Which version would you suggest (3.7/3.10)? I can provide a PR, if you're fine with it.

Thanks in advance and thanks for actively maintaining this docker image!
Cheers, Jonathan.

Building error of 1.39.1

[5/5](****/emscripten-fastcomp:1.39.1)[19/36][%](Create symbolic links) 
The command '/bin/sh -c echo "## Create symbolic links"     
&&  . ${EMSDK}/emsdk_set_env.sh         
&&  mkdir -p ${EMSDK}/llvm ${EMSDK}/emscripten ${EMSDK}/binaryen        
&&  ln -s $(dirname $(which node))/..       ${EMSDK}/node/current     
&&  ln -s $(dirname $(which clang))/..      ${EMSDK}/llvm/clang     
&&  ln -s $(dirname $(which emcc))          ${EMSDK}/emscripten/sdk     
&&  ln -s $(dirname $(which asm2wasm))      ${EMSDK}/binaryen/bin         
&&  echo "## Done"' returned a non-zero code: 1

1.39.4 is failing to build

No idea what's gone wrong, but the build status is failing and the image hasn't been updated to 1.39.4.

Increase CMake version to > 3.9 ?

Hi,

similarly to #23 I ran into CMake version issue. LevelDB needs at least 3.9.

In the source of the installer I found the option: --skip-license
So my upgrader now consists of:

version=3.13
build=0
wget https://cmake.org/files/v$version/cmake-$version.$build-Linux-x86_64.sh 
mkdir /opt/cmake
sh cmake-$version.$build-Linux-x86_64.sh --skip-license --prefix=/opt/cmake 
ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
ln -s /opt/cmake/bin/ctest /usr/local/bin/ctest 

It works for me now but it might be convenient for others.

Cheers,
Hans

Store emscripten, emscripten-slim in one dockerhub project

Get some good practices from https://github.com/nodejs/docker-node and use only one dockerhub project https://hub.docker.com/r/trzeci/emscripten/

That means a new schema will be introduced:
trzeci/emscripten:{version}-{variant}, where:

  • version: is every tag released with Emscripten
  • variant: One of:
    • *none* - a default version of Emscripten with predefined base tools for development
    • slim - lightweight version of Emscripten - Debian based
    • full - future version for holding: #8

supports shared libraries - no

I cannot compile gsl library because

configure:9010: checking whether the /emsdk_portable/sdk/emcc linker (/emsdk_portable/sdk/emcc) supports shared libraries \
configure:10163: result: no \
configure:10403: checking dynamic linker characteristics
configure:10914: /emsdk_portable/sdk/emcc -o conftest     conftest.c  >&5
configure:10914: $? = 0
configure:11140: result: GNU/Linux ld.so
configure:11247: checking how to hardcode library paths into programs
configure:11272: result: unsupported
configure:11812: checking whether stripping libraries is possible
configure:11817: result: yes
configure:11852: checking if libtool supports shared libraries
configure:11854: result: no
configure:11857: checking whether to build shared libraries
configure:11878: result: no
configure:11881: checking whether to build static libraries
configure:11885: result: yes

i am trying to build ubuntu version to chceck if this also happens

Namespace support is required to build ICU.

1 warning generated.
configure: error: Namespace support is required to build ICU.
make[5]: *** [icu-build/Makefile] Error 1
make[5]: Target 'rebuild' not remade because of errors.
make[4]: *** [../../libs/icu/include/unicode/uversion.h] Error 2

How to solve this?

Preserve compiled libs

ATM emscripten image compiles all ports, but do not preserve output (due a size ~1GB), this might be done as a separated image emscripten-full

1.38.38 fails to build

trzeci/emscripten-slim:sdk-tag-1.38.38-64bit-64bit)[][%]() 
The command '/bin/bash -c cd ${EMSDK}     &&  echo "## Clean-up Emscripten Installation"     &&  shopt -s globstar             &&  _file=`echo ./emscripten/*/site/build/text/docs/tools_reference/emcc.txt`     &&  _content=`cat ${_file}`     &&  rm -fr             ./emscripten/*/docs             ./emscripten/*/media             ./emscripten/*/site     &&  mkdir -p `dirname ${_file}`     &&  echo ${_content} >> ${_file}             &&  _file=`echo clang/*/src/emscripten-version.txt`     &&  _content=`cat ${_file}`     &&  rm -fr clang/*/src     &&  mkdir -p `dirname ${_file}`     &&  echo ${_content} >> ${_file}         &&  rm -fr binaryen/*/src     &&  rm -fr binaryen/**/test     &&  rm -fr binaryen/**/*.cmake     &&  rm -fr binaryen/**/Makefile         &&  rm -fr clang/*/*/docs     &&  rm -fr clang/*/*/tools     &&  rm -fr clang/*/*/projects     &&  rm -fr clang/*/*/cmake     &&  rm -fr clang/**/*.cmake     &&  rm -fr clang/**/Makefile             &&  find . -name "*.pyc" -exec rm {} \;     &&  find . -name "CMakeFiles" -type d -prune -exec rm -fr {} \;     &&  find . -name "CMakeCache.txt" -exec rm {} \;             &&  find . -name "*.o" -exec rm {} \;     &&  find . -name "*.a" -exec rm {} \;     &&  find . -name "*.inc*" -exec rm {} \;     &&  find . -name "*.gen.tmp" -exec rm {} \;             &&  find clang -type d -depth -empty -exec rmdir "{}" \;     &&  find binaryen -type d -depth -empty -exec rmdir "{}" \;             &&  rm -fr **/*_32bit     &&  rm -rf **/.git     &&  rm -rf **/tests     &&  rm -fr zips/*             &&  rm -fr /opt/cmake /usr/local/bin/cmake /cmake*             &&  sleep 2 &&  echo "## Done"' returned a non-zero code: 1
[INFO] Compiled [trzeci/emscripten-slim:sdk-tag-1.38.38-64bit] in: 0:00:01.159364                
trzeci/emscripten-slim:sdk-tag-1.38.38-64bit - FAIL                                              
At least one compilation set has failed to compile                                               

None

None : wrong submission. Moved to the correct projet : emscripten core

Clean up README

Current readme files are store too much information and cause lots of confusion.

Closure compiler support (missing java)

Hi,

we're setting --closure 1 to optimize the wrapper code.
It causes the following error:

WARNING:root:java does not seem to exist, required for closure compiler, which is optional (define JAVA in /root/.emscripten if you want it)
ERROR:root:fatal: closure compiler is not configured correctly

Maybe we should add java to the Docker images?

No setup/usage instruction for Windows User

  • Problematic Docker Image:

Please state what is missing: Need guide to run this on windows based system

I'm hitting to command and it's looks like invalid for windows.
``$ docker run \

--rm
-v $(pwd):$(pwd)
-u $(id -u):$(id -g)
trzeci/emscripten
emcc helloworld.cpp -o helloworld.js;``

image

How can we re-format for windows?

wget: command not found

Hi there,

I'm trying to build with trzeci/emscripten:sdk-tag-1.37.16-64bit but it won't work because wget is missing. wget was fine in previous builds, is there a specific reason to remove it?

Regards,

Error: 'bits/alltypes.h' "file not found" in newer images

Hi,
Thanks for your work on this image!
I'm attempting to use this for building the javascript port of micropython but on the latest images it throws a long list of

In file included from ../../extmod/moduwebsocket.c:27:
/emsdk_portable/emscripten/tag-1.38.42/system/include/libc/stdio.h:22:10: fatal error: 'bits/alltypes.h' file not found
#include <bits/alltypes.h>
         ^~~~~~~~~~~~~~~~~
1 error generated.

Which looks very similar to emscripten-core/emscripten#9205

I tried a couple of versions back, trzeci/emscripten:sdk-tag-1.38.42-64bit had the same compile error, but trzeci/emscripten:sdk-tag-1.38.41-64bit so this lines up with the versions in the above issue.

Based on that issue, I suspect llvm may need updating?

Error when downloading zlib with emscripten-slim but not emscripten

image
(transcription below w/ extra trace removed)

stderr: WARNING:root:retrieving port: zlib from https://github.com/emscripten-ports/zlib/archive/version_1.zip
Traceback (most recent call last):
  ...
  File "/usr/lib/python2.7/urllib2.py", line 1240, in https_open
    context=self._context)
  File "/usr/lib/python2.7/urllib2.py", line 1197, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)>

I get the above error when I try to build a library (ARToolkit) only in a emscripten-slim container but not in a emscripten container. This is my first time working with Docker so I'm not sure if I can provide more help.

I'm running Docker on Windows 10. If I navigate to the url in the issue normally I don't get any error in Chrome and I can download it fine in my host OS.

Install ssh

To make git tool fully useful, it requires also ssh tool to clone via SSH protocol.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.