Skip to content

HPCC-34104 Add wasm32 build target #19868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

GordonSmith
Copy link
Member

@GordonSmith GordonSmith commented May 14, 2025

Type of change:

  • This change is a bug fix (non-breaking change which fixes an issue).
  • This change is a new feature (non-breaking change which adds functionality).
  • This change improves the code (refactor or other change that does not change the functionality)
  • This change fixes warnings (the fix does not alter the functionality or the generated code)
  • This change is a breaking change (fix or feature that will cause existing behavior to change).
  • This change alters the query API (existing queries will have to be recompiled)

Checklist:

  • My code follows the code style of this project.
    • My code does not create any new warnings from compiler, build system, or lint.
  • The commit message is properly formatted and free of typos.
    • The commit message title makes sense in a changelog, by itself.
    • The commit is signed.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly, or...
    • I have created a JIRA ticket to update the documentation.
    • Any new interfaces or exported functions are appropriately commented.
  • I have read the CONTRIBUTORS document.
  • The change has been fully tested:
    • I have added tests to cover my changes.
    • All new and existing tests passed.
    • I have checked that this change does not introduce memory leaks.
    • I have used Valgrind or similar tools to check for potential issues.
  • I have given due consideration to all of the following potential concerns:
    • Scalability
    • Performance
    • Security
    • Thread-safety
    • Cloud-compatibility
    • Premature optimization
    • Existing deployed queries will not be broken
    • This change fixes the problem, not just the symptom
    • The target branch of this pull request is appropriate for such a change.
  • There are no similar instances of the same problem that should be addressed
    • I have addressed them here
    • I have raised JIRA issues to address them separately
  • This is a user interface / front-end modification
    • I have tested my changes in multiple modern browsers
    • The component(s) render as expected

Smoketest:

  • Send notifications about my Pull Request position in Smoketest queue.
  • Test my draft Pull Request.

Testing:

@GordonSmith GordonSmith requested review from ghalliday and Copilot May 14, 2025 11:38
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds a wasm32 build target to support Emscripten compilation within the HPCC project, as described in HPCC-34104. Key changes include updates to various CMake files to enable EMSCRIPTEN‐specific build flags, modifications to dockerfiles and build scripts to support the wasm32 target, and adjustments to configuration files such as package.json and vcpkg settings.

Reviewed Changes

Copilot reviewed 42 out of 42 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
roxie/ccd/CMakeLists.txt Added EMSCRIPTEN-specific compile flag for the ccd library.
plugins/py3embed/py3embed.cpp Included EMSCRIPTEN in the conditional inclusion for execinfo backtrace support.
plugins/nlp/nlp_eng.cpp Extended build condition to define LINUX for EMSCRIPTEN; consider if this conflation is appropriate.
package.json Changed module type from ES module to CommonJS to align with the wasm32 target requirements.
fs/dafilesrv/dafilesrv.cpp Added a stub daemon function for EMSCRIPTEN builds.
esp/scm/*.cmake Updated custom commands to prepend COMMAND_NODE_PREFIX for EMSCRIPTEN builds.
ecl/hql/hqlstack.hpp & CMakeLists.txt Introduced EMSCRIPTEN-specific definitions and compile flags.
dockerfiles/* & dockerfiles/build.sh Updated build scripts and Dockerfiles to support a wasm32-emscripten build.
cmake_modules/* Adjusted multiple CMake modules (vcpkg, plugins, options, commonSetup) for EMSCRIPTEN compatibility.
.github/workflows/build-vcpkg.yml Added a new GitHub workflow job to build the wasm32-emscripten Docker image.
Comments suppressed due to low confidence (2)

package.json:4

  • Switching from ES module to CommonJS might affect module resolution and dependency loading. Please ensure that all downstream scripts and package dependencies are compatible with CommonJS.
"type":"commonjs"

cmake_modules/plugins.cmake:25

  • [nitpick] The addition of 'emscripten' to VCPKG_INCLUDE and similarly to VCPKG_SUPPRESS should be verified against the actual dependency requirements for EMSCRIPTEN. Documenting this change in the project’s build documentation may help clarify intended behavior.
set(VCPKG_INCLUDE "(windows | osx | linux | emscripten)")

Copy link

Jira Issue: https://hpccsystems.atlassian.net//browse/HPCC-34104

Jirabot Action Result:
Workflow Transition To: Merge Pending
Updated PR

Copy link
Member

@ghalliday ghalliday left a comment

Choose a reason for hiding this comment

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

@GordonSmith looks good. One cleanup comment.
Is master best, or will the changes to make/docker files cause upmerge conflicts?

@GordonSmith GordonSmith requested review from Copilot and ghalliday May 26, 2025 09:48
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a new WebAssembly build target by integrating Emscripten into the existing build system and CI.

  • Enable EMSCRIPTEN compilation paths in source files and headers
  • Extend CMake, vcpkg, and build scripts to recognize wasm32-emscripten and set appropriate flags
  • Provide a Dockerfile and CI job to build and test the new target

Reviewed Changes

Copilot reviewed 40 out of 40 changed files in this pull request and generated no comments.

Show a summary per file
File Description
roxie/ccd/ccdfile.cpp Include <sys/mman.h> when compiling under Emscripten
roxie/ccd/CMakeLists.txt Suppress memcall errors for EMSCRIPTEN target
plugins/py3embed/py3embed.cpp Enable backtrace includes under Emscripten
package.json Switch package type from module to commonjs
fs/dafilesrv/dafilesrv.cpp Stub out daemon() on Emscripten
esp/scm/smcscm.cmake Prefix SCM commands with COMMAND_NODE_PREFIX
esp/scm/ncmscm.cmake Prefix NCM commands with COMMAND_NODE_PREFIX
esp/scm/espscm.cmake Prefix ESD (ESP SCM) commands similarly
esp/scm/additional.cmake Prefix additional SCM commands
ecl/hql/hqlstack.hpp Define stack alignment for Emscripten
ecl/hql/CMakeLists.txt Add compile flags for Emscripten on hql
dockerfiles/wasm32-emscripten.dockerfile New Dockerfile for wasm32-emscripten builds
dockerfiles/build.sh Adjust build script to support wasm32 target
devdoc/.vitepress/config.mts Exclude third-party/** from doc builds
cmake_modules/vcpkg.cmake Configure vcpkg triplets and toolchain for EMSCRIPTEN
cmake_modules/plugins.cmake Include emscripten in plugin host/suppress filters
cmake_modules/options.cmake Accept MinSizeRel build type and disable features under EMSCRIPTEN
cmake_modules/commonSetup.cmake Parse Emscripten compiler version string
.github/workflows/build-vcpkg.yml Add CI job for wasm32-emscripten build

@GordonSmith
Copy link
Member Author

@GordonSmith looks good. One cleanup comment. Is master best, or will the changes to make/docker files cause upmerge conflicts?

If you would rather a diff branch to target it might help upmerge conflicts, but I don't think they would be too bad?

Fix windows build failing
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds support for building the HPCC platform for the wasm32 target using Emscripten by updating source files, CMake modules, and Docker build scripts.

  • Extended platform-specific conditions and target properties to include EMSCRIPTEN.
  • Updated CMake configuration and build scripts (including Dockerfiles) to handle EMSCRIPTEN-specific build flags and options.
  • Modified package.json and documentation settings to align with the wasm32 build target.

Reviewed Changes

Copilot reviewed 41 out of 41 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
roxie/ccd/ccdfile.cpp Added EMSCRIPTEN to platform check for system header inclusion.
roxie/ccd/CMakeLists.txt Set EMSCRIPTEN-specific compile flag on the ccd library.
plugins/py3embed/py3embed.cpp Extended platform check to include EMSCRIPTEN for backtrace setup.
package.json Changed module type from ES modules to CommonJS.
fs/dafilesrv/dafilesrv.cpp Added a stub for daemon() on EMSCRIPTEN.
esp/scm/* cmake files Updated custom commands to include COMMAND_NODE_PREFIX for EMSCRIPTEN.
ecl/hql/hqlstack.hpp & CMakeLists.txt Added EMSCRIPTEN-specific adjustments for compilation flags.
dockerfiles/wasm32-emscripten.dockerfile Added a Dockerfile for building using wasm32 Emscripten.
dockerfiles/build.sh Modified build scripts to handle wasm32-emscripten configuration.
devdoc/.vitepress/config.mts Updated source exclusion paths to omit third-party directories.
cmake_modules/* Added EMSCRIPTEN-specific configuration and toolchain settings.
.github/workflows/build-vcpkg.yml Added CI workflow support for the wasm32-emscripten build.
Comments suppressed due to low confidence (2)

package.json:4

  • Changing the module type from 'module' to 'commonjs' can affect module resolution and imports; please ensure that all dependent code and tooling are updated accordingly.
"type":"commonjs",

esp/scm/smcscm.cmake:56

  • Ensure that the variable COMMAND_NODE_PREFIX is defined in the build configuration or environment so that the injected command works as expected across all relevant platforms.
COMMAND ${ASAN_LEAK_SUPPRESS_PREFIX} ${COMMAND_NODE_PREFIX} $<TARGET_FILE:hidl> ${ESPSCM_SOURCE_DIR}/${result}.ecm ${ESPSCM_GENERATED_DIR}

@@ -94,16 +95,19 @@ function doBuild() {

mkdir -p $ROOT_DIR/build/$1
CMAKE_OPTIONS_EXTRA="-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
if [ "$1" == "wasm32-emscripten" ]; then
Copy link
Preview

Copilot AI May 26, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider adding a brief comment here to explain why the build type is switched to 'MinSizeRel' and the EMSCRIPTEN flag is added for wasm32 builds to help future maintainers.

Copilot uses AI. Check for mistakes.

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