emscripten-core / emscripten-core/emsdk

[bazel] emsdk >=5.0.2 fails in cmake rule (foreign_rules_cc)

Open
#1,689 0 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

Building cmake rule fails because provided EMSDK_PYTHON _(introduced in https://github.com/emscripten-core/emsdk/commit/5464280d2fd5bfaf67903934cf4e0539b2a42fa1)_ is relative to execution_root,
but cmake can implicitly change current directory in builds _(especially during try_compile steps to CMakeFiles/CMakeScratch)_.

So in usual cmake builds there are failed:
1. "Detecting C compiler ABI info" step
2. "Check for working C compiler" step

Full log: [emdsk-5-cmake-bug.log](https://github.com/user-attachments/files/26309721/emdsk-5-cmake-bug.log)
Important part:
```
/private/var/tmp/_bazel/1b4150e0bd5fb01fec2f73043048bd2e/execroot/_main/external/emsdk+/emscripten_toolchain/emcc.sh: line 5: exec: /private/var/tmp/_bazel/1b4150e0bd5fb01fec2f73043048bd2e/execroot/_main/bazel-out/wasm-dbg-wasm-ST-87cf4af9f873/bin/external/sdl3+/sdl3_cmake_base.build_tmpdir/CMakeFiles/CMakeScratch/TryCompile-ZttFNR/external/rules_python++python+python_3_11_aarch64-apple-darwin/bin/python3: cannot execute: No such file or directory
```
Because: `EMSDK_PYTHON=external/rules_python++python+python_3_11_aarch64-apple-darwin/bin/python3`

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.