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.
emcc: error: src/native/core.c: unable to open file
emcc: error: 'src/native/core.c' does not existCommon 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
- List the directory the step runs in to verify the file exists.
- Use a path relative to the project root or an absolute path.
- Ensure earlier steps that generate or fetch the file actually ran.
ls -la src/native
emcc "$PWD/src/native/core.c" -o core.jsCheck out submodules that hold sources
If the file lives in a submodule, fetch it during checkout so emcc can open it.
- uses: actions/checkout@v4
with:
submodules: recursiveHow 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.