-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Open
Labels
Description
Hi,
I am trying to build perl5 using emscripten and so far I have this:
https://github.com/shlomif/perl5-build-using-emscripten
However I'm running into problem with the perl "tryp.c" example, and could not find anything in a web search.
Please run the following script in an empty directory with "emcc" and "node" (from node-js) in the path:
#!/bin/bash
cat <<EOF > tryp.c
#include <stdio.h>
int
main(int argc, char **argv)
{
char buf[1024];
int i;
char *bp = buf;
while (1) {
while ((i = getc(stdin)) != -1
&& (*bp++ = i) != '\n'
&& bp < &buf[1024])
/* DO NOTHING */ ;
*bp = '\0';
fprintf(stdout, "%s", buf);
fflush(stdin);
if (i == -1)
return 0;
bp = buf;
}
}
EOF
emcc --jcache -s TOTAL_MEMORY=134217728 -std=gnu99 -O2 -I . -m32 -o tryp.js tryp.c
node tryp.js
node ends up consuming 100% of CPU and gradually consumes more and more RAM. Can this be fixed?
Update: I am on Mageia Linux 3 Cauldron ( http://www.mageia.org/en/ ) with clang-3.2-5.mga3 , llvm-3.2-5.mga3 , nodejs-0.10.3-2.mga3 , etc.
Thanks!
-- @shlomif
Reactions are currently unavailable