← Back to team overview

leaningtech-dev team mailing list archive

Re: [Bug 1399977] Re: Node.js support

 

Thanks for the clarification, ver instructive :-)

In any case, I have been thinking about it and I think my requeriments are
simpler: Node.js compiled modules will run always on the server (no client
side), and if the author did it that way he has it reasons, being
performance or access to low-level libraries, so we should stick to that.
Said this, I've got to the conclussion what NodeOS needs to be able to
compile native mofules without needing a binary toolchain is:

* a C/C++ frontend build in Javascript, like clang.js
* a compiler that generates binary code for the current target also build
in Javascript, like llvm.js
* some binutils like a linker or an assembler, also build in Javascript
* all of them available as npm packages

I have searched and only found clang.js and llvm.js that were just
experiments and are abandoned, and in fact llvm.js targets to Javascript
instead of binary code. I've also found a hobby project that didn't
published the code, and Cheerp that I'm not sure if can fullfill this
requeriments list :-)
El 08/12/2014 15:15, "Alessandro Pignotti" <1399977@xxxxxxxxxxxxxxxxxx>
escribió:

> Cheerp already supports some of the requirement you listed, namely:
>
> * You can generate standalone JS files to be executed on Node.js. Indeed
> we use node.js to run the files compiled from our test suite. We don't
> have the required C++ header to access Node.js functionalities, but they
> can be crafted easily:
>
> https://github.com/leaningtech/cheerp-wiki/wiki/Browser-side-
> programming-guide#accessing-the-dom-under-the-hood
>
> * Cheerp can generate native code, it also has experimental support for
> generating native server side code which is transparently invoked using
> RPCs from code running on the client. At the moment you can use the
> [[server]] custom attribute on a function to have it compiled to native
> code, but it will also generate RPC boilerplate which is unnecessary for
> your use case. Something like [[native]] could be added to remove such
> boilerplate and only build the native code.
>
> *  C is fully supported when generating native code. When generating
> JavaScript there are limitations. Since C is less type safe than C++
> there are idioms which works on native platforms but does not on Cheerp.
> I can give you some examples if you want. Moreover C code has no builtin
> way of accessing JS APIs as this functionality depends on C++
> namespaces.
>
> On the other hand, Cheerp can't yet be compiled in JavaScript as
> LLVM/clang which are the bases for Cheerp are not type safe enough. We
> have long term plans to make Cheerp self hosting but it's not something
> that it's available yet.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1399977
>
> Title:
>   Node.js support
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/cheerp/+bug/1399977/+subscriptions
>

-- 
You received this bug notification because you are a member of
Leaningtech Team, which is subscribed to Cheerp.
https://bugs.launchpad.net/bugs/1399977

Title:
  Node.js support

Status in Cheerp: C++ for the Web:
  New

Bug description:
  I would like that cheerp could be used as a C/C++ compiler running on
  top of Node.js, so it could be used on NodeOS to compile native
  modules. This has some implications:

  * cheerp itself compiled to Javascript
  * command line Node.js executable
  * C support
  * generate native code (not only Javascript)
  * detect when to generate native code. Node.js modules can be crafted for performance issues, but another usage is to access to low level libraries or system resources like syscalls. This last ones need native code to be generated with no other alternative

  Disclaimer: I'm the lead developer of NodeOS ;-)

To manage notifications about this bug go to:
https://bugs.launchpad.net/cheerp/+bug/1399977/+subscriptions


References