Giter Site home page Giter Site logo

cib's People

Contributors

tbfleming 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  avatar  avatar  avatar

Watchers

 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

cib's Issues

Crashes in Safari

On both iOS (11) and desktop Safari (latest tech preview) pressing "Compile" makes the browser reload "because a problem occurred", I'm not exactly sure how to debug this, since the devtools also disappear.

screen shot 2018-01-02 at 13 37 07

LinkError: import object field 'sqlite3_open' is not a Function

I am trying to compile and run the following example and I get this error ...

// cib:{"fetch":"https://cdn.rawgit.com/mikeptweet/HelloWorld/21a97199/sqlite.zip", "system_includes":["."], "unzip_compiler":true}
#include "sqlite/sqlite3.h"
#include <stdio.h>

int main(void) {

sqlite3 *db;
sqlite3_stmt *res;

int rc = sqlite3_open(":memory:", &db);

if (rc != SQLITE_OK) {
    
    fprintf(stderr, "Cannot open database: %s\n", sqlite3_errmsg(db));
    sqlite3_close(db);
    
    return 1;
}

rc = sqlite3_prepare_v2(db, "SELECT SQLITE_VERSION()", -1, &res, 0);    

if (rc != SQLITE_OK) {
    
    fprintf(stderr, "Failed to fetch data: %s\n", sqlite3_errmsg(db));
    sqlite3_close(db);
    
    return 1;
}    

rc = sqlite3_step(res);

if (rc == SQLITE_ROW) {
    printf("%s\n", sqlite3_column_text(res, 0));
}

sqlite3_finalize(res);
sqlite3_close(db);

return 0;

}

Link Error

@tbfleming with my latest experiments with your tool I discovered an issue that boggled my mind (a picture has been attached). Somehow, the executed WebAssembly throws a Link Error even though I am pretty sure that all the necessary files have been added to the ZIP archive which is loaded at the beginning of the process. I bet it is something minor that we are currently overlooking but I hope that you can help us with our issue. The code snippet to be compiled has also been attached.

image

// Download a file using https. Only works with sites which support CORS.
// cib:{"fetch":"https://raw.githubusercontent.com/EmbeddedMontiArc/website/master/test2.zip","system_includes":["antlr4","common","monticore", "."], "unzip_compiler":true}

#include <emscripten.h>
#include <stdio.h>
#include <string>
#include <memory>
#include "Grammar_WithConceptsAntlrLexer.h"
#include "Grammar_WithConceptsAntlrParser.h"
#include "antlr4-runtime.h"

using namespace std;
using antlr4::tree::ParseTreeWalker;
using antlr4::ANTLRInputStream;
using antlr4::CommonTokenStream;

using antlrcpp::ws2s;

int main() {
    wstring wstr(L"");
    string input = ws2s(wstr);

    ANTLRInputStream stream(input);
    Grammar_WithConceptsAntlrLexer lexer(&stream);
    CommonTokenStream tokens(&lexer);
    Grammar_WithConceptsAntlrParser parser(&tokens);

    parser.mCGrammar();
}

Last line of output not printing without a final newline

Try and put cout<<42; at the end of the sample code and it won't print. Multiple subsequent couts without a newline also won't show, anything on that last line. Hit run again and that lost cout will print first then the rest

No longer working

HI ... thanks for this awesome project!

Everytime I try to run any of the examples, I get a "RuntimeError: index out of bounds". It seems to compile ok but fails on running the code. Would it be possible to get this fixed as I use this environment for teaching.

thanks

Integrate into WebAssembly.Studio

First of all, thanks for your efforts in bringing LLVM to the browser, great work.

The Clang format library from this project is being used in http://WebAssembly.studio. For now, compilation is done server side (in order to reduce code size) but we'd like to eventually do everything on the client.

Would you be interested in integrating these two projects more tightly?

Using compiler options in cib

Hi!

I'm trying to compile a program, which has been written in C++ to .wasm using cib. Could you please tell me, is it possible to pass compiler options? Maybe in the source code(like we do downloading some .zip files) or in another way?
When I do compilation with emscripten, I'm passing following parameters:

emcc.bat, pID.cpp, -o, pID.js, -I"..\armadillo", -s, WASM=1, -s, AGGRESSIVE_VARIABLE_ELIMINATION=1, -s, ALLOW_MEMORY_GROWTH=1, -L., -DARMA_DONT_USE_WRAPPER, -llapack_WIN64, -lblas_WIN64, -llibf2c, -ltmglib_WIN64, -llibfblaswr, -O3, --bind, -std=c++11

How you can see I use additional libraries. If it possible somehow use them during "web compilation"? Thank you in advance.

PS.: This is actually the code, which I'm trying to compile: https://tbfleming.github.io/cib/#gist=9bedf2bb85d1d67cf48454655aff4993

Add example for Armadillo numerical processing library

This project is really interesting!

I was able to get Armadillo to compile: http://arma.sourceforge.net/
Using the github pages branch locally, taking the armadillo download, and repackaging it as a zip:

// cib:{"fetch":"armadillo-9.200.7.zip", "system_includes":["include"], "unzip_compiler":true}

#define ARMA_DONT_USE_LAPACK
#define ARMA_DONT_USE_BLAS
#define ARMA_DONT_USE_NEWARP
#define ARMA_DONT_USE_ARPACK
#define ARMA_DONT_USE_SUPERLU
#define ARMA_DONT_USE_HDF5
#define ARMA_DONT_USE_OPENMP

#include <armadillo>
#include <stdio.h>

using namespace std;
using namespace arma;

int main() {
    mat A = randu<mat>(4,5);
    mat B = randu<mat>(4,5);
    printf("%f\n", A[0]);
    return 0;
}

I had to use the printf instead of the examples cout << A*B.t() << endl; because of #17

Having this available in the browser could be really useful!

Build not fully optimized?

clang.wasm is 54315717 bytes. Running binaryen's wasm-opt -O2 shrinks it by around 15%, and -Os by 20%, which suggests maybe it wasn't fully optimized?

I see the build script uses cmake and sets it to release, which should optimize the object files, but I'm not sure how it handles the final link to wasm (in emcc, we need -Os or such during both compile and link). @juj, I think you wrote the emcmake code, what does it do for the final link?

cc @mbebenita

Libclang in WASM

I wanted to ask if it would be possible to compile Libclang (C interface to clang) to WASM?

I am a complete noob here, please feel free to close this issue if this question is totally ridiculous. ๐Ÿ™ˆ

Can you please provide the binaries?

Hello,

I tried to build the project twice, without any success.
I have an EC2 Ubuntu machine, clean, with the packages you said to install. (nodejs instead of nodejs-legacy and libboost-all-tools instead of libboost1.58-tools-dev)
The repos are downloaded, cmake starts, then ninja starts, but at the very end, the whole thing stops with some error.

Building this takes a lot of time. (And apparently I may get an error after 5 hours of building)
Can you please provide the pre-built binaries for easier testing?

Thank you!

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.