emscripten-core / emscripten-core/emsdk

Bazel: passing --embed-file to linkopts results in file not found

Open
#775 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3.7k
Forks
821
Avg merge
1h 25m
Merged PRs (30d)
3

Description

Synopsis:
```
cc_binary(
name = "embed-file",
srcs = ["embed-file.cc"],
linkopts = ["--embed-file", "$(rootpath my-file.txt)"],
data = ["my-file.txt"],
)
```
errors out on `file_packager` stating `%PATH%/my-file.txt does not exist`.

I have poked around and the path resolution looks correct, `--sandbox_debug` gives me some paths I can manually expect (namely `PWD=/proc/self/cwd`) where the path is present, but if I put `ls -lR` in `emcc_link.sh`, it's not visible there. Seems to me that the file is not passed to the toolchain - `data` merely exposes it in runfiles, and it cannot be included in `srcs`, etc.

@walkingeyerobot have you played around with this at all?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.