Giter Club home page Giter Club logo

emscripten-docker's Introduction

Emscripten dockerized

This image serves as convenient way how to have emscripten at hand without the need to build it for yourself, which takes a long time as you need to build clang from source.

See the docker hub for more details.

Versioning

The docker image version (tag) is the same as emscripten version so apiaryio/emcc:1.38.11 corresponds to emscripten version 1.38.11. Older images used to ignore the patch version but it we hit an issue along the way and started tagging even patch versions.

In the respective subdirectories you can find Dockerfiles for all emscripten versions ever built. Each of them is building the latest patch version.

Usage

Once pulled the usage is simple either invoke simple commands for interactive use

$> docker run --rm -v $(pwd):/src -t apiaryio/emcc emconfigure ./configure

or if working on non-trivial project have a build script run that, see the scripts directory in drafter.js repo.

$> docker run --rm -v $(pwd):/src -t apiaryio/emcc emcc/emcbuild.sh

Both examples assume you are in the root directory of your project where is your configure or Makefile.

Automated building of the images

To ease the maintenance there are few python 3 scripts to help and terraform settings.

emccbuild.py

This script updates and build the images automatically.

./emccbuild.py -h for usage

runit.py

This is a pexpect script which builds and pushes given versions on AWS EC2 instance. It utilizes terraform for the EC2 instance setup and teardown.

The script calls terraform and then over ssh runs docker login and emccbuild.py and if it finishes succesfully then it tears down the ec2 instance as well, making the whole process simple.

runit.py -h for usage

It needs a configuration file runitconfig.py to proceed. If it does not exists it will create a template so that you can just edit it and run it again.

Configuration (runitconfig.py)

aws_access = "<AWS ACCESS CODE>"
aws_secret = "<AWS SECRET>"
aws_instance_type = "c4.2xlarge"
aws_subnet_id = "<AWS SUBNET ID>"
key_name = "<AWS KEY NAME>"
ssh_key = "<PATH TO AWS KEY FILE>"
user = "<DOCKER USERNAME>"
passwd = "<DOCKER PASSWORD>"
email = "<DOCKER EMAIL>"

emscripten-docker's People

Contributors

janisozaur avatar jianrong-yu avatar kylef avatar mpapierski avatar w-vi 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

emscripten-docker's Issues

Permission denied

Hello,
I get this error when trying to compile .c file

root@984e88feb6cb:/test# emconfigure ./configure
ERROR:root:Exception thrown when invoking Popen in configure with args: "./confi
gure"!
Traceback (most recent call last):
File "/usr/local/bin/emconfigure", line 13, in
emconfigure.run()
File "/emscripten/emconfigure.py", line 46, in run
shared.Building.configure(sys.argv[1:])
File "/emscripten/tools/shared.py", line 1527, in configure
process = Popen(args, stdout=None if EM_BUILD_VERBOSE_LEVEL >= 2 else stdout
, stderr=None if EM_BUILD_VERBOSE_LEVEL >= 1 else stderr, env=env)
File "/usr/lib/python2.7/subprocess.py", line 390, in init
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child
raise child_exception
OSError: [Errno 13] Permission denied

Any Help!
Thanks

many compile errors pointing to libio.h, stdio.h ...

I'm trying to compile a c++ file which depends on boost, I ran below command in centos7
I mounted local /usr/include, where boost headers are installed, to /xxboost
I also put /usr/include, the docker's own, before /xxboost, my local, in the -I option
yet I'm getting many errors I never seen before.

BTW, the c++ file can be compiled and produce js file, with lower version of emscript, and not using docker.

please advise, thanks!

docker run --rm -v $(pwd):/src -v /usr/include:/xxboost -t apiaryio/emcc em++ --memory-init-file 0 -O3 -s MODULARIZE=1 -s NO_EXIT_RUNTIME=1 -I"/usr/include" -I"/xxboost" emcc.cxx
In file included from emcc.cxx:11:
In file included from /emscripten/system/include/emscripten.h:1:
In file included from /emscripten/system/include/emscripten/emscripten.h:23:
In file included from /xxboost/stdio.h:74:
/xxboost/libio.h:466:4: error: C++ requires a type specifier for all
      declarations
                        _IO_va_list, int *__restrict);
                        ^
/xxboost/libio.h:45:21: note: expanded from macro '_IO_va_list'
#define _IO_va_list _G_va_list
                    ^
/xxboost/_G_config.h:46:20: note: expanded from macro '_G_va_list'
#define _G_va_list __gnuc_va_list
                   ^
In file included from emcc.cxx:11:
In file included from /emscripten/system/include/emscripten.h:1:
In file included from /emscripten/system/include/emscripten/emscripten.h:23:
In file included from /xxboost/stdio.h:74:
/xxboost/libio.h:468:5: error: unknown type name '__gnuc_va_list'
                         _IO_va_list);
                         ^
/xxboost/libio.h:45:21: note: expanded from macro '_IO_va_list'
#define _IO_va_list _G_va_list
                    ^
/xxboost/_G_config.h:46:20: note: expanded from macro '_G_va_list'
#define _G_va_list __gnuc_va_list
                   ^
In file included from emcc.cxx:11:
In file included from /emscripten/system/include/emscripten.h:1:
In file included from /emscripten/system/include/emscripten/emscripten.h:23:
/xxboost/stdio.h:79:9: error: unknown type name '__gnuc_va_list'
typedef _G_va_list va_list;
        ^
/xxboost/_G_config.h:46:20: note: expanded from macro '_G_va_list'
#define _G_va_list __gnuc_va_list
                   ^
In file included from emcc.cxx:11:
In file included from /emscripten/system/include/emscripten.h:1:
In file included from /emscripten/system/include/emscripten/emscripten.h:23:
/xxboost/stdio.h:372:8: error: unknown type name '__gnuc_va_list'
                     _G_va_list __arg);
                     ^
/xxboost/_G_config.h:46:20: note: expanded from macro '_G_va_list'
#define _G_va_list __gnuc_va_list
                   ^
In file included from emcc.cxx:11:
In file included from /emscripten/system/include/emscripten.h:1:
In file included from /emscripten/system/include/emscripten/emscripten.h:23:
/xxboost/stdio.h:377:54: error: unknown type name '__gnuc_va_list'
extern int vprintf (const char *__restrict __format, _G_va_list __arg);
                                                     ^
/xxboost/_G_config.h:46:20: note: expanded from macro '_G_va_list'
#define _G_va_list __gnuc_va_list
                   ^
In file included from emcc.cxx:11:
In file included from /emscripten/system/include/emscripten.h:1:
In file included from /emscripten/system/include/emscripten/emscripten.h:23:
/xxboost/stdio.h:380:8: error: unknown type name '__gnuc_va_list'
                     _G_va_list __arg) __THROWNL;
                     ^
/xxboost/_G_config.h:46:20: note: expanded from macro '_G_va_list'
#define _G_va_list __gnuc_va_list
                   ^
In file included from emcc.cxx:11:
In file included from /emscripten/system/include/emscripten.h:1:
In file included from /emscripten/system/include/emscripten/emscripten.h:23:
/xxboost/stdio.h:391:42: error: unknown type name '__gnuc_va_list'
                      const char *__restrict __format, _G_va_list __arg)
                                                       ^
/xxboost/_G_config.h:46:20: note: expanded from macro '_G_va_list'
#define _G_va_list __gnuc_va_list
                   ^
In file included from emcc.cxx:11:
In file included from /emscripten/system/include/emscripten.h:1:
In file included from /emscripten/system/include/emscripten/emscripten.h:23:
/xxboost/stdio.h:400:9: error: unknown type name '__gnuc_va_list'
                      _G_va_list __arg)
                      ^
/xxboost/_G_config.h:46:20: note: expanded from macro '_G_va_list'
#define _G_va_list __gnuc_va_list
                   ^
In file included from emcc.cxx:11:
In file included from /emscripten/system/include/emscripten.h:1:
In file included from /emscripten/system/include/emscripten/emscripten.h:23:
/xxboost/stdio.h:413:8: error: unknown type name '__gnuc_va_list'
                     _G_va_list __arg)
                     ^
/xxboost/_G_config.h:46:20: note: expanded from macro '_G_va_list'
#define _G_va_list __gnuc_va_list
                   ^
In file included from emcc.cxx:11:
In file included from /emscripten/system/include/emscripten.h:1:
In file included from /emscripten/system/include/emscripten/emscripten.h:23:
/xxboost/stdio.h:472:7: error: unknown type name '__gnuc_va_list'
                    _G_va_list __arg)
                    ^
/xxboost/_G_config.h:46:20: note: expanded from macro '_G_va_list'
#define _G_va_list __gnuc_va_list
                   ^
In file included from emcc.cxx:11:
In file included from /emscripten/system/include/emscripten.h:1:
In file included from /emscripten/system/include/emscripten/emscripten.h:23:
/xxboost/stdio.h:479:53: error: unknown type name '__gnuc_va_list'
extern int vscanf (const char *__restrict __format, _G_va_list __arg)
                                                    ^
/xxboost/_G_config.h:46:20: note: expanded from macro '_G_va_list'
#define _G_va_list __gnuc_va_list
                   ^
In file included from emcc.cxx:11:
In file included from /emscripten/system/include/emscripten.h:1:
In file included from /emscripten/system/include/emscripten/emscripten.h:23:
/xxboost/stdio.h:484:40: error: unknown type name '__gnuc_va_list'
                    const char *__restrict __format, _G_va_list __arg)
                                                     ^
/xxboost/_G_config.h:46:20: note: expanded from macro '_G_va_list'
#define _G_va_list __gnuc_va_list
                   ^
In file included from emcc.cxx:11:
In file included from /emscripten/system/include/emscripten.h:1:
In file included from /emscripten/system/include/emscripten/emscripten.h:23:
/xxboost/stdio.h:904:8: error: unknown type name '__gnuc_va_list'
                            _G_va_list __args)
                            ^
/xxboost/_G_config.h:46:20: note: expanded from macro '_G_va_list'
#define _G_va_list __gnuc_va_list
                   ^
In file included from emcc.cxx:11:
In file included from /emscripten/system/include/emscripten.h:1:
In file included from /emscripten/system/include/emscripten/emscripten.h:23:
In file included from /xxboost/stdio.h:934:
/xxboost/bits/stdio.h:36:40: error: unknown type name '__gnuc_va_list'
vprintf (const char *__restrict __fmt, _G_va_list __arg)
                                       ^
/xxboost/_G_config.h:46:20: note: expanded from macro '_G_va_list'
#define _G_va_list __gnuc_va_list
                   ^

fatal error: too many errors emitted, stopping now [-ferror-limit=]

ERROR:root:compiler frontend failed to generate LLVM bitcode, halting

1.37/Dockerfile fails

wget https://raw.githubusercontent.com/apiaryio/emscripten-docker/master/1.37/Dockerfile
docker build -t emcc .

Results in a full build however stops on this error:

/bin/sh: 1: cd: can't cd to emsdk_portable
The command '/bin/sh -c apt-get update && apt-get install -y --no-install-recommends ca-certificates build-essential curl git-core openjdk-7-jre-headless python && apt-mark hold openjdk-7-jre-headless && apt-mark hold make && curl -Os https://cmake.org/files/v3.6/cmake-3.6.1.tar.gz && tar xf cmake-3.6.1.tar.gz && cd cmake-3.6.1 && ./configure && make && make install && cd .. && rm -rf cmake* && curl -sL https://deb.nodesource.com/setup_6.x | bash - && apt-get install -y nodejs && curl https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz > emsdk-portable.tar.gz && tar xzf emsdk-portable.tar.gz && rm emsdk-portable.tar.gz && cd emsdk_portable && ./emsdk update && ./emsdk install --build=MinSizeRel sdk-tag-$EMCC_SDK_VERSION-${EMCC_SDK_ARCH}bit && mkdir -p /clang && cp -r /emsdk_portable/clang/tag-e$EMCC_SDK_VERSION/build_tag-e${EMCC_SDK_VERSION}${EMCC_SDK_ARCH}/bin /clang && mkdir -p /clang/src && cp /emsdk_portable/clang/tag-e$EMCC_SDK_VERSION/src/emscripten-version.txt /clang/src/ && mkdir -p /emscripten && cp -r /emsdk_portable/emscripten/tag-$EMCC_SDK_VERSION/* /emscripten && cp -r /emsdk_portable/emscripten/tag-${EMCC_SDK_VERSION}${EMCC_SDK_ARCH}bit_optimizer/optimizer /emscripten/ && echo "import os\nLLVM_ROOT='/clang/bin/'\nNODE_JS='nodejs'\nEMSCRIPTEN_ROOT='/emscripten'\nEMSCRIPTEN_NATIVE_OPTIMIZER='/emscripten/optimizer'\nSPIDERMONKEY_ENGINE = ''\nV8_ENGINE = ''\nTEMP_DIR = '/tmp'\nCOMPILER_ENGINE = NODE_JS\nJS_ENGINES = [NODE_JS]\n" > ~/.emscripten && rm -rf /emsdk_portable && rm -rf /emscripten/tests && rm -rf /emscripten/site && for prog in em++ em-config emar emcc emconfigure emmake emranlib emrun emscons emcmake; do ln -sf /emscripten/$prog /usr/local/bin; done && apt-get -y --purge remove curl git-core build-essential gcc && apt-get -y clean && apt-get -y autoclean && apt-get -y autoremove && echo "Installed ... testing"' returned a non-zero code: 2

I don't know if it is related, but there are thinks in the Docker like:

FROM debian:latest
and
apt-get update

that are non-deterministic and could lead to unpredictable failures.

I'm using Docker version 1.11.2, build b9f10c9

include `-I` doesn't work

Hello, when I add -I option to the command, it seems it couldn't find the specified path..., there's always error in the #include, saying the header file can't be found

Am I doing it wrong?

e.g. , the header file is in /home/user/project/include

docker run --rm -v $(pwd):/src -t apiaryio/emcc em++ -I"/usr/include" -I"/home/user/project/include" file.cpp -o file.o

How do I specify include path? thanks!

Minor version updates to 1.37

Hi all

First of all thank you for open sourcing this collection of tools.

We have a build toolchain and Docker image based on the v1.37 image but the latest minor changes pushed to that tag in the last 2 weeks on Dockerhub seem to have broken things for us.

Would you consider creating tags for these in future or can help guide us towards why this may be?

Thank you

cc @daaain

1.37 Working behaviour different to 1.36 on function wcrtomb

Hi.
I had upgraded to image 1.37 and my old code failed. After some research, I found the function wcrtomb is not working as 1.36.
It failed on all the character with a high code value.
Please find the attachment test.c.zip for a sample of this issue.
The output of this function is 3 on 1.36 but -1 on 1.37.

I'm sorry I had no enough experience on docker and Emscripten so I cannot figure out the root cause of this issue, can you help me to find what's wrong with it?

Thanks you very much :)

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.