Normally if you cross-compile for a different architecture and can't run the created binary, the error should be ENOEXEC (Exec format error). However, Autoconf's ./configure does not care about the error code. All that matters is that the file fails to execute. If you simply output the JS to a file, that shouldn't be executable without a "#!".

BTW. Note that Autoconf ./configure will search for these possible output files: "a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*". It will figure out the extension of executable files based on what it finds. So, if you produced conftest.js it would assume .js is the extension. I think that it should also select .html if both .js and .html exist. At least bash will sort files matching a glob pattern. Then that extension is automatically used when compiling the target. So, it would be possible to just "emconfigure ./configure && make" and get JS output automatically.

On 2015-02-24 04:17 PM, Alon Zakai wrote:
Oh, I did not understand you properly before.

The EMCONFIGURE_JS option I added forces JS usage in emconfigure, no
exceptions. What you suggest is to also add an option that makes the
"executables" emitted fail to run, intentionally (how should they fail
to run, btw)? Perhaps we should call that EMCONFIGURE_JS_NOEXECUTE?

- Alon


On Mon, Feb 23, 2015 at 6:25 PM, Boris Gjenero <[email protected]
<mailto:[email protected]>> wrote:

    I was specifically asking for inability to run compiled tests with
    EMCONFIGURE_JS=2 so that Autoconf ./configure will assume that it is
    cross compiling. I'm not sure that this change is supposed to do
    that. It seems like
    
https://github.com/kripken/__emscripten/commit/__3702801d1fddc80d2a058507b953ed__e9dff09b11
    
<https://github.com/kripken/emscripten/commit/3702801d1fddc80d2a058507b953ede9dff09b11>
    simply always compiles to JS even if that would fail to run properly.

    The "checking whether we are cross compiling" test must fail to run
    the compiled binary in order for Autoconf ./configure to assume that
    it is cross compiling. If that binary runs but later tests fail to
    run properly, then test results may be bad, for example outputting
    empty defines like this:
    #define SIZEOF_UNSIGNED_CHAR
    #define SIZEOF_UNSIGNED_SHORT
    #define SIZEOF_UNSIGNED_INT
    #define SIZEOF_UNSIGNED_LONG
    #define SIZEOF_UNSIGNED_LONG_LONG
    #define SIZEOF_INT_P

    Surprisingly, I got the results I desire. The cross compiling test
    binary failed to execute with "./configure: ./conftest:
    /usr/bin/node: bad interpreter: No such file or directory" because
    it was looking for /usr/bin/node and there was only
    /usr/local/bin/node. Then Bochs 2.6.7 proceeded to configure and
    build without any ./configure hacks being needed. Impressive!
    However, if I create a /usr/bin/node symlink, I can't make
    ./configure conclude that it is cross compiling.

    I guess tests compiled to JS couldn't be run with EMCONFIGURE_JS=1
    either, but most tests were being compiled to native code, so this
    wasn't causing problems. I see only one Bochs test triggering the
    error with EMCONFIGURE_JS=1: "checking for ANSI C header files".

    BTW. Failure to run compiled C programs can cause an error like this:

    checking whether we are cross compiling... configure: error: in
    `/home/bgjenero/projects/__bochs/bochs-2.6.7':
    configure: error: cannot run C compiled programs.
    If you meant to cross compile, use `--host'.
    See `config.log' for more details
    ERROR    root: Configure step failed with non-zero return code 1!
    Command line: ['./configure', '--without-x', '--with-sdl2',
    '--disable-show-ips', '--enable-fast-function-calls'__,
    '--enable-handlers-chaining'] at
    /home/bgjenero/projects/bochs/__bochs-2.6.7

    The solution to that error is simple and self-explanatory. I added
    --host=le32-unknown-nacl because --host=asmjs-unknown-__emscripten
    isn't recognized.

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