Skip to content

fix(build): use Homebrew clang for wasm32 C build on macOS#77

Merged
watson merged 1 commit intomainfrom
watson/dev-setup
Mar 3, 2026
Merged

fix(build): use Homebrew clang for wasm32 C build on macOS#77
watson merged 1 commit intomainfrom
watson/dev-setup

Conversation

@watson
Copy link
Copy Markdown
Contributor

@watson watson commented Mar 3, 2026

Summary

Fixes the full yarn build on macOS when a custom CC (e.g. ccache cc) is set, and adds a single place for development setup and build instructions.

Changes

WASM build on macOS — The datadog-js-zstd WASM crate uses zstd-sys, which compiles C code for wasm32-unknown-unknown. If CC points at Apple Clang or a wrapper like ccache cc, that compiler doesn’t support the wasm32 triple and the build fails with "No available targets are compatible with triple 'wasm32-unknown-unknown'". In scripts/build-wasm.js, we now set CC_wasm32_unknown_unknown and CXX_wasm32_unknown_unknown to Homebrew’s clang so the wasm32 C/C++ build always uses a supported compiler, without changing behavior on Linux or for people who already rely on PATH.

Docs — Added DEVELOPMENT.md with step-by-step setup (rustup, PATH, wasm32-unknown-unknown, macOS brew install llvm, yarn install) and the build/test commands. Removed the duplicate build section from README.md and pointed to DEVELOPMENT.md for contributing/setup.

When CC is set (e.g. ccache cc), the wasm32 C/C++ build can use Apple
Clang, which does not support wasm32-unknown-unknown, so the
datadog-js-zstd WASM build failed. Set CC_wasm32_unknown_unknown and
CXX_wasm32_unknown_unknown to Homebrew's clang so crates like zstd-sys
always use a wasm32-capable compiler.

Add DEVELOPMENT.md with Rust/rustup, macOS LLVM, and yarn setup steps,
and move the build/test notes from README into DEVELOPMENT.md.
Copy link
Copy Markdown
Contributor Author

watson commented Mar 3, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 3, 2026

Overall package size

Self size: 37.28 MB
Deduped: 37.28 MB
No deduping: 37.28 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------|

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@watson watson marked this pull request as ready for review March 3, 2026 10:22
@watson watson requested review from a team as code owners March 3, 2026 10:22
Copy link
Copy Markdown
Contributor

@szegedi szegedi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I have one small suggestion.

@watson watson merged commit 2c55c22 into main Mar 3, 2026
97 of 99 checks passed
@watson watson deleted the watson/dev-setup branch March 3, 2026 12:11
tlhunter pushed a commit that referenced this pull request Mar 19, 2026
When CC is set (e.g. ccache cc), the wasm32 C/C++ build can use Apple
Clang, which does not support wasm32-unknown-unknown, so the
datadog-js-zstd WASM build failed. Set CC_wasm32_unknown_unknown and
CXX_wasm32_unknown_unknown to Homebrew's clang so crates like zstd-sys
always use a wasm32-capable compiler.

Add DEVELOPMENT.md with Rust/rustup, macOS LLVM, and yarn setup steps,
and move the build/test notes from README into DEVELOPMENT.md.
tlhunter pushed a commit that referenced this pull request Mar 20, 2026
When CC is set (e.g. ccache cc), the wasm32 C/C++ build can use Apple
Clang, which does not support wasm32-unknown-unknown, so the
datadog-js-zstd WASM build failed. Set CC_wasm32_unknown_unknown and
CXX_wasm32_unknown_unknown to Homebrew's clang so crates like zstd-sys
always use a wasm32-capable compiler.

Add DEVELOPMENT.md with Rust/rustup, macOS LLVM, and yarn setup steps,
and move the build/test notes from README into DEVELOPMENT.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants