Skip to content

GH-23221: [C++] Add support for building with Emscripten - #37821

Merged
kou merged 110 commits into
apache:mainfrom
joemarshall:emscripten_cmake_changes
Apr 5, 2024
Merged

GH-23221: [C++] Add support for building with Emscripten#37821
kou merged 110 commits into
apache:mainfrom
joemarshall:emscripten_cmake_changes

Conversation

@joemarshall

@joemarshalljoemarshall commented Sep 21, 2023

Copy link
Copy Markdown
Contributor

Split from #37696

This is just the cmake changes to enable building on emscripten.

Changes are:

  1. Support for target system "emscripten"
  2. Cmake preset for building libarrow ninja-release-python-emscripten (same as ninja-release-python, but with emscripten support)
  3. Override file for cmake on emscripten, to set various build parameters that need setting to make it build there.
  4. Changes in pyarrow cmake so it works if you are building libarrow as shared library, and also an option to enable the cmake file there to just dump the current arrow configuration, which is useful for cross-compile builds.

@github-actions

Copy link
Copy Markdown

Thanks for opening a pull request!

If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

In the case of PARQUET issues on JIRA the title also supports:

PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

See also:

@joemarshall

Copy link
Copy Markdown
ContributorAuthor

@kou here are the cmake changes for building libarrow in emscripten.

@koukou changed the title GH23221 [C++] cmake changes for emscripten build supportGH-23221: [C++] Add suppor for building with EmscriptenSep 22, 2023

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(Sorry. My review isn't completed yet. I'll continue later.)

Comment threadcpp/CMakePresets.json Outdated
Comment threadcpp/CMakePresets.json Outdated
Comment threadcpp/CMakePresets.json Outdated
Comment threadcpp/CMakePresets.json Outdated
Comment threadcpp/CMakePresets.json Outdated
Comment threadcpp/CMakePresets.json Outdated
Comment threadcpp/CMakePresets.json Outdated
Comment threadcpp/CMakePresets.json Outdated
Comment threadcpp/CMakePresets.json Outdated
@github-actionsgithub-actionsBot added awaiting changes Awaiting changes and removed awaiting review Awaiting review labels Sep 23, 2023

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(My first review is completed.)

Comment threadcpp/cmake_modules/Emscripten/Platform/EmscriptenOverrides.cmake Outdated
Comment threadcpp/cmake_modules/Emscripten/Platform/EmscriptenOverrides.cmake Outdated
Comment threadcpp/cmake_modules/Emscripten/Platform/EmscriptenOverrides.cmake Outdated
Comment threadcpp/cmake_modules/Emscripten/Platform/EmscriptenOverrides.cmake Outdated
Comment threadcpp/cmake_modules/Emscripten/Platform/EmscriptenOverrides.cmake Outdated
Comment threaddocs/source/developers/cpp/emscripten.rst Outdated
Comment threaddocs/source/developers/cpp/emscripten.rst Outdated
Comment threaddocs/source/developers/cpp/emscripten.rst Outdated
Comment threaddocs/source/developers/cpp/emscripten.rst Outdated
Comment threaddocs/source/developers/cpp/emscripten.rst Outdated
Comment threaddocs/source/developers/cpp/emscripten.rst Outdated
Comment threadcpp/CMakePresets.json Outdated
@jorisvandenbosschejorisvandenbossche changed the title GH-23221: [C++] Add suppor for building with EmscriptenGH-23221: [C++] Add support for building with EmscriptenSep 25, 2023
Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
@github-actionsgithub-actionsBot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Sep 25, 2023
@github-actionsgithub-actionsBot added Component: Python awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Sep 25, 2023
@jorisvandenbossche

Copy link
Copy Markdown
Member

The failing integration test build seems unrelated (it's failing in a rust<->rust test)

@bitsondatadev

Copy link
Copy Markdown

The failing integration test build seems unrelated (it's failing in a rust<->rust test)

@jorisvandenbossche and @kou, are there any changes you're waiting for or is this ready for another review?

@kou

kou commented Apr 3, 2024

Copy link
Copy Markdown
Member

Sorry... I should have said #include "arrow/util/config.h" not #include "arrow/util/future.h" for #37821 (comment) and so on...

Could you use arrow/util/config.h not arrow/util/future.h instead...? (Can I push a commit to this branch?)

@joemarshall

Copy link
Copy Markdown
ContributorAuthor

Sorry... I should have said #include "arrow/util/config.h" not #include "arrow/util/future.h" for #37821 (comment) and so on...

Could you use arrow/util/config.h not arrow/util/future.h instead...? (Can I push a commit to this branch?)

Yes pushing a commit is fine.

@kou

kou commented Apr 4, 2024

Copy link
Copy Markdown
Member

@github-actions crossbow submit test-ubuntu-22.04-cpp-emscripten

@github-actions

Copy link
Copy Markdown

Revision: d3bc3b4

Submitted crossbow builds: ursacomputing/crossbow @ actions-b7535ddb15

TaskStatus
test-ubuntu-22.04-cpp-emscriptenGitHub Actions

@kou

kou commented Apr 4, 2024

Copy link
Copy Markdown
Member

@github-actions crossbow submit -g cpp

@github-actions

Copy link
Copy Markdown

Revision: d3bc3b4

Submitted crossbow builds: ursacomputing/crossbow @ actions-fd564c7b19

TaskStatus
test-alpine-linux-cppGitHub Actions
test-build-cpp-fuzzGitHub Actions
test-conda-cppGitHub Actions
test-conda-cpp-valgrindAzure
test-cuda-cppGitHub Actions
test-debian-12-cpp-amd64GitHub Actions
test-debian-12-cpp-i386GitHub Actions
test-fedora-39-cppGitHub Actions
test-ubuntu-20.04-cppGitHub Actions
test-ubuntu-20.04-cpp-bundledGitHub Actions
test-ubuntu-20.04-cpp-minimal-with-formatsGitHub Actions
test-ubuntu-20.04-cpp-thread-sanitizerGitHub Actions
test-ubuntu-22.04-cppGitHub Actions
test-ubuntu-22.04-cpp-20GitHub Actions
test-ubuntu-22.04-cpp-emscriptenGitHub Actions
test-ubuntu-22.04-cpp-no-threadingGitHub Actions
test-ubuntu-24.04-cppGitHub Actions
test-ubuntu-24.04-cpp-gcc-14GitHub Actions

kou
kou approved these changes Apr 5, 2024

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

@kou
kou merged commit 1a1d2c8 into apache:mainApr 5, 2024
@koukou removed the awaiting change review Awaiting change review label Apr 5, 2024
@github-actionsgithub-actionsBot added the awaiting merge Awaiting merge label Apr 5, 2024
@bitsondatadev

Copy link
Copy Markdown

Thanks for your reviews @kou and thanks @joemarshall for all the hard work!!

@joemarshall

Copy link
Copy Markdown
ContributorAuthor

Brilliant, thanks everyone

@joemarshalljoemarshall mentioned this pull request Apr 5, 2024
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 7 benchmarking runs that have been run so far on merge-commit 1a1d2c8.

There was 1 benchmark result indicating a performance regression:

The full Conbench report has more details. It also includes information about 5 possible false positives for unstable benchmarks that are known to sometimes produce them.

@raulcd

Copy link
Copy Markdown
Member

@github-actions crossbow submit test-build-vcpkg-win

@raulcd

Copy link
Copy Markdown
Member

I am trying to understand if this PR was the one causing the test-build-vcpkg-win job failure.

@github-actions

Copy link
Copy Markdown

Revision: 1307910

Submitted crossbow builds: ursacomputing/crossbow @ actions-5c4dbcd949

TaskStatus
test-build-vcpkg-winGitHub Actions


# install emscripten using EMSDK
ARG emscripten_version="3.1.45"
RUN cd ~ && git clone https://github.com/emscripten-core/emsdk.git && \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm, two things:

  1. it would have been better for resource usage to make a separate dockerfile for this, perhaps
  2. could this be a script to avoid having tons of hand-coded bash code in dockerfiles?

fi

# make sure zlib is cached in the EMSDK folder
RUN source ~/emsdk/emsdk_env.sh && embuilder --pic build zlib

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Any reason why this isn't together with the install step above?

kou added a commit that referenced this pull request Apr 13, 2024
…41178)
### Rationale for this change
#37821 changed to use `add_test()` usage from old style to new style:
1a1d2c8?diff=unified&w=1#diff-1ce47eec54afaee769086e1a720c5ed65bc347cd8fc60a233de67fd895dda329L763-R764
MSVC generators multi-config generators. With old style, all tests are run without specifying `--build-config` explicitly. With new style, we need to specify `--build-config` explicitly.
See also: https://cmake.org/cmake/help/latest/command/add_test.html
### What changes are included in this PR?
Specify `--build-config` explicitly.
### Are these changes tested?
Yes.
### Are there any user-facing changes?
No.
* GitHub Issue: #41169
Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
raulcd pushed a commit that referenced this pull request Apr 15, 2024
…41178)
### Rationale for this change
#37821 changed to use `add_test()` usage from old style to new style:
1a1d2c8?diff=unified&w=1#diff-1ce47eec54afaee769086e1a720c5ed65bc347cd8fc60a233de67fd895dda329L763-R764
MSVC generators multi-config generators. With old style, all tests are run without specifying `--build-config` explicitly. With new style, we need to specify `--build-config` explicitly.
See also: https://cmake.org/cmake/help/latest/command/add_test.html
### What changes are included in this PR?
Specify `--build-config` explicitly.
### Are these changes tested?
Yes.
### Are there any user-facing changes?
No.
* GitHub Issue: #41169
Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C++] Add/document configuration to build with WebAssembly

6 participants

@joemarshall@jorisvandenbossche@kou@raulcd@bitsondatadev@pitrou