system() requires a full shell environment, which emscripten does not
provide. When the code runs on the web, we don't have a POSIX style OS
underneath us. We would have to emulate one, in theory.

For files, we have an emulated filesystem that looks like a normal POSIX
filesystem, but resides in memory - again, because we can't access the real
filesystem directly, in browsers. See
http://kripken.github.io/emscripten-site/docs/api_reference/Filesystem-API.html

- Alon


On Wed, Feb 25, 2015 at 7:42 AM, <[email protected]> wrote:

> Hello,
>
> The C library function system() seems to always returns -1.
> But I depend on a working system() function.
>
> I am trying to compile my project ( http://seed7.sourceforge.net/ ) with
> emcc.
> The build process uses a C program called chkccomp.c. This program
> checks the properties of C compiler and run-time library.
> To do this chkccomp.c uses system() to invoke the C compiler
> with many small test programs. Depending on this test programs
> the configuration is written to a configuration header file.
>
> In detail a small test program is written to the file ctest.c.
> After that system("emcc ctest.c"); compiles the program and
> finally ctest is executed with system("node cctest.js>ctest.out"); .
>
> At least this is my plan (and for other compilers this approach works
> without problems).
>
> With emcc this approach does not work.
> system(NULL) returns -1 and system("DIR") returns also -1
> (I do the emcc tests on windows. For other compilers I use also Linux).
>
> Maybe I need some option for emcc or node to make system() work.
>
> With I have some issues with emcc and chkccomp.c:
> The program chkccomp.c opens the configuration file in append mode.
> This does not work. To come around this I decided to write
> the configuration to stdout instead (and to redirect stdout to my file).
>
> Beside this problems a lot of the C source files compile just fine with
> emcc.
>
> Please advice me how system and local files work with emcc.
>
>
> Regards,
> Thomas Mertes
>
> --
> Seed7 Homepage:  http://seed7.sourceforge.net
> Seed7 - The extensible programming language: User defined statements
> and operators, abstract data types, templates without special
> syntax, OO with interfaces and multiple dispatch, statically typed,
> interpreted or compiled, portable, runs under linux/unix/windows.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to