Skip to content
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

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

Merged
merged 110 commits into from
Apr 5, 2024

Conversation

joemarshall
Copy link
Contributor

@joemarshall joemarshall commented Sep 21, 2023

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

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
Contributor Author

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

@kou kou changed the title GH23221 [C++] cmake changes for emscripten build support GH-23221: [C++] Add suppor for building with Emscripten Sep 22, 2023
Copy link
Member

@kou kou left a comment

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.)

cpp/CMakePresets.json Outdated Show resolved Hide resolved
cpp/CMakePresets.json Outdated Show resolved Hide resolved
cpp/CMakePresets.json Outdated Show resolved Hide resolved
cpp/CMakePresets.json Outdated Show resolved Hide resolved
cpp/CMakePresets.json Outdated Show resolved Hide resolved
cpp/CMakePresets.json Outdated Show resolved Hide resolved
cpp/CMakePresets.json Outdated Show resolved Hide resolved
cpp/CMakePresets.json Outdated Show resolved Hide resolved
cpp/CMakePresets.json Outdated Show resolved Hide resolved
@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting review Awaiting review labels Sep 23, 2023
Copy link
Member

@kou kou left a comment

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.)

docs/source/developers/cpp/emscripten.rst Outdated Show resolved Hide resolved
docs/source/developers/cpp/emscripten.rst Outdated Show resolved Hide resolved
docs/source/developers/cpp/emscripten.rst Outdated Show resolved Hide resolved
docs/source/developers/cpp/emscripten.rst Outdated Show resolved Hide resolved
docs/source/developers/cpp/emscripten.rst Outdated Show resolved Hide resolved
@jorisvandenbossche jorisvandenbossche changed the title GH-23221: [C++] Add suppor for building with Emscripten GH-23221: [C++] Add support for building with Emscripten Sep 25, 2023
Co-authored-by: Joris Van den Bossche <[email protected]>
Co-authored-by: Sutou Kouhei <[email protected]>
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Sep 25, 2023
@github-actions github-actions bot added Component: Python awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Sep 25, 2023
@kou
Copy link
Member

kou commented Apr 4, 2024

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

Copy link

github-actions bot commented Apr 4, 2024

Revision: d3bc3b4

Submitted crossbow builds: ursacomputing/crossbow @ actions-b7535ddb15

Task Status
test-ubuntu-22.04-cpp-emscripten GitHub Actions

@kou
Copy link
Member

kou commented Apr 4, 2024

@github-actions crossbow submit -g cpp

Copy link

github-actions bot commented Apr 4, 2024

Revision: d3bc3b4

Submitted crossbow builds: ursacomputing/crossbow @ actions-fd564c7b19

Task Status
test-alpine-linux-cpp GitHub Actions
test-build-cpp-fuzz GitHub Actions
test-conda-cpp GitHub Actions
test-conda-cpp-valgrind Azure
test-cuda-cpp GitHub Actions
test-debian-12-cpp-amd64 GitHub Actions
test-debian-12-cpp-i386 GitHub Actions
test-fedora-39-cpp GitHub Actions
test-ubuntu-20.04-cpp GitHub Actions
test-ubuntu-20.04-cpp-bundled GitHub Actions
test-ubuntu-20.04-cpp-minimal-with-formats GitHub Actions
test-ubuntu-20.04-cpp-thread-sanitizer GitHub Actions
test-ubuntu-22.04-cpp GitHub Actions
test-ubuntu-22.04-cpp-20 GitHub Actions
test-ubuntu-22.04-cpp-emscripten GitHub Actions
test-ubuntu-22.04-cpp-no-threading GitHub Actions
test-ubuntu-24.04-cpp GitHub Actions
test-ubuntu-24.04-cpp-gcc-14 GitHub Actions

Copy link
Member

@kou kou left a comment

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:main Apr 5, 2024
58 of 62 checks passed
@kou kou removed the awaiting change review Awaiting change review label Apr 5, 2024
@github-actions github-actions bot added the awaiting merge Awaiting merge label Apr 5, 2024
@bitsondatadev
Copy link

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

@joemarshall
Copy link
Contributor Author

Brilliant, thanks everyone

Copy link

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
Member

raulcd commented Apr 10, 2024

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

@raulcd
Copy link
Member

raulcd commented Apr 10, 2024

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

Copy link

Revision: 1307910

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

Task Status
test-build-vcpkg-win GitHub Actions

apt-get clean && \
rm -rf /var/lib/apt/lists*

# install emscripten using EMSDK
ARG emscripten_version="3.1.45"
RUN cd ~ && git clone https://github.com/emscripten-core/emsdk.git && \
Copy link
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?

@@ -151,6 +162,9 @@ RUN if [ "${gcc_version}" = "" ]; then \
update-alternatives --set c++ /usr/bin/g++; \
fi

# make sure zlib is cached in the EMSDK folder
RUN source ~/emsdk/emsdk_env.sh && embuilder --pic build zlib
Copy link
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 <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
vibhatha pushed a commit to vibhatha/arrow that referenced this pull request Apr 15, 2024
…ndows (apache#41178)

### Rationale for this change

apache#37821 changed to use `add_test()` usage from old style to new style:

apache@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: apache#41169

Authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
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 <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
tolleybot pushed a commit to tmct/arrow that referenced this pull request May 2, 2024
…e#37821)

Split from apache#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.

* Closes: apache#23221

Lead-authored-by: Joe Marshall <[email protected]>
Co-authored-by: Sutou Kouhei <[email protected]>
Co-authored-by: Joris Van den Bossche <[email protected]>
Co-authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
tolleybot pushed a commit to tmct/arrow that referenced this pull request May 2, 2024
…ndows (apache#41178)

### Rationale for this change

apache#37821 changed to use `add_test()` usage from old style to new style:

apache@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: apache#41169

Authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
tolleybot pushed a commit to tmct/arrow that referenced this pull request May 4, 2024
…e#37821)

Split from apache#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.

* Closes: apache#23221

Lead-authored-by: Joe Marshall <[email protected]>
Co-authored-by: Sutou Kouhei <[email protected]>
Co-authored-by: Joris Van den Bossche <[email protected]>
Co-authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
rok pushed a commit to tmct/arrow that referenced this pull request May 8, 2024
…e#37821)

Split from apache#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.

* Closes: apache#23221

Lead-authored-by: Joe Marshall <[email protected]>
Co-authored-by: Sutou Kouhei <[email protected]>
Co-authored-by: Joris Van den Bossche <[email protected]>
Co-authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
rok pushed a commit to tmct/arrow that referenced this pull request May 8, 2024
…e#37821)

Split from apache#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.

* Closes: apache#23221

Lead-authored-by: Joe Marshall <[email protected]>
Co-authored-by: Sutou Kouhei <[email protected]>
Co-authored-by: Joris Van den Bossche <[email protected]>
Co-authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
vibhatha pushed a commit to vibhatha/arrow that referenced this pull request May 25, 2024
…e#37821)

Split from apache#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.

* Closes: apache#23221

Lead-authored-by: Joe Marshall <[email protected]>
Co-authored-by: Sutou Kouhei <[email protected]>
Co-authored-by: Joris Van den Bossche <[email protected]>
Co-authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
vibhatha pushed a commit to vibhatha/arrow that referenced this pull request May 25, 2024
…ndows (apache#41178)

### Rationale for this change

apache#37821 changed to use `add_test()` usage from old style to new style:

apache@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: apache#41169

Authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
Sign up for free to 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