Skip to content
Latchkey

emcc "error: unable to open ..." input file in CI

emcc tried to open a file it was told to compile or link and the path did not resolve. In CI this is usually a relative path that is correct locally but wrong from the runner's working directory, or a generated file that does not exist yet.

What this error means

emcc fails with "emcc: error: ... unable to open" or "error: no such file or directory" naming a source, header, or library it expected to find.

emscripten
emcc: error: src/native/core.c: unable to open file
emcc: error: 'src/native/core.c' does not exist

Common causes

A relative path wrong from the CI working directory

The build runs from a different directory than locally, so a relative source or include path does not point at a real file.

A generated or fetched file is not present

A source produced by an earlier step (or a submodule) was never generated or checked out, so emcc has nothing to open.

How to fix it

Confirm the path from the runner cwd

  1. List the directory the step runs in to verify the file exists.
  2. Use a path relative to the project root or an absolute path.
  3. Ensure earlier steps that generate or fetch the file actually ran.
Terminal
ls -la src/native
emcc "$PWD/src/native/core.c" -o core.js

Check out submodules that hold sources

If the file lives in a submodule, fetch it during checkout so emcc can open it.

.github/workflows/ci.yml
- uses: actions/checkout@v4
  with:
    submodules: recursive

How to prevent it

  • Reference sources by project-relative or absolute paths in CI.
  • Check out submodules when sources live in them.
  • Ensure code-generation steps run before the emcc compile.

Frequently asked questions

What causes ""emcc: error: unable to open""?
The build runs from a different directory than locally, so a relative source or include path does not point at a real file.
How do I fix "emcc: error: unable to open"?
Confirm the path from the runner cwd

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card