Skip to content

emconfigure fails inside "type": "module" package #13551

Description

@aduh95

Repro:

$ echo '{"type":"module"}' > package.json
$ curl -L https://github.com/libexpat/libexpat/releases/download/R_2_2_10/expat-2.2.10.tar.xz | tar -xJ
$ cd expat-2.2.10
$ emconfigure ./configure
configure: ./configure
checking build system type... x86_64-apple-darwin20.3.0
checking host system type... x86_64-apple-darwin20.3.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... conftools/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... …/emsdk/upstream/emscripten/emcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... configure: error: in `…/expat-2.2.10':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

And in config.log:

configure:3744: checking whether we are cross compiling
configure:3752: …/emsdk/upstream/emscripten/emcc -o conftest    conftest.c  >&5
configure:3756: $? = 0
configure:3763: ./conftest
(node:90074) ExperimentalWarning: The ESM module loader is experimental.
internal/modules/run_main.js:54
    internalBinding('errors').triggerUncaughtException(
                              ^

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for …/expat-2.2.10/conftest
    at Loader.defaultGetFormat [as _getFormat] (internal/modules/esm/get_format.js:65:15)
    at Loader.getFormat (internal/modules/esm/loader.js:113:42)
    at Loader.getModuleJob (internal/modules/esm/loader.js:244:31)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Loader.import (internal/modules/esm/loader.js:178:17) {
  code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
configure:3767: $? = 1
configure:3774: error: in `…/expat-2.2.10':
configure:3776: error: cannot run C compiled programs.

This could be solved if emconfigure added a package.json file in the current directory:

{ "type" : "commonjs" }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions