Skip to content

Conversation

ChinYikMing
Copy link
Collaborator

@ChinYikMing ChinYikMing commented Feb 24, 2025

What changes?

Allow emcc build for both ISA or system emulation. Additionally, add emcc build check to CI.

How to reproduce emcc build fail for system emulation?

$ source ~/emsdk/emsdk_env.sh
$ make CC=emcc ENABLE_SYSTEM=1 -j8

Will see the error like the following:

BIN2C	src/minimal_dtb.h
/bin/sh: 1: build/bin2c: Permission denied
make: *** [mk/system.mk:22: src/minimal_dtb.h] Error 126

The reason is that the bin2c is compiled to Wasm by emcc instead of native executable which cannot build the device tree blob to C application.

Summary by Bito

This pull request enhances the build system by introducing support for emcc, enabling ISA and system emulation. It includes checks for GCC or Clang usage when emcc is unsuitable and implements error handling for unsupported compilers, improving robustness.

Unit tests added: False

Estimated effort to review (1-5, lower is better): 2

Emcc generates Wasm but not a native executable, making the generated
bin2c non-executable. As a result, the device tree blob cannot be built
into a C application. To resolve this, fall back to a native compiler
gcc or clang to build bin2c.

Additionally, ensuring CC is set to gcc, clang, or emcc. Otherwise,
trigger a build error early.

Related: sysprog21#534
@ChinYikMing ChinYikMing changed the title Ci emcc build Allow emcc build and validate in CI Feb 24, 2025
@jserv jserv added this to the release-2025.1 milestone Feb 25, 2025
@jserv jserv merged commit 7a77bf8 into sysprog21:master Feb 25, 2025
8 checks passed
@jserv
Copy link
Contributor

jserv commented Feb 25, 2025

Thank @ChinYikMing for contributing!

@ChinYikMing ChinYikMing deleted the ci-emcc-build branch February 25, 2025 03:29
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