Skip to content

Modernize and fix the Emscripten build - #2849

Merged
hannahbast merged 28 commits into
ad-freiburg:masterfrom
RobinTF:improve-wasm
Jul 9, 2026
Merged

Modernize and fix the Emscripten build#2849
hannahbast merged 28 commits into
ad-freiburg:masterfrom
RobinTF:improve-wasm

Conversation

@RobinTF

@RobinTF RobinTF commented Apr 29, 2026

Copy link
Copy Markdown
Collaborator

So far, the Emscripten (WASM) build of QLever used an outdated toolchain and had several problems at runtime (for example, exceptions did not work correctly, and ICU could not find its data). This PR modernizes the build and fixes these problems. In particular:

  1. The emsdk is bumped from version 3.1.73 to 6.0.2 and is now installed directly instead of via the Conan Center recipe, which lags behind. The CMake toolchain and the build environment are wired up so that dependencies that build via autotools (ICU and OpenSSL) also use the Emscripten compiler.
  2. Exception handling now consistently uses -fwasm-exceptions for both compiling and linking; previously, exceptions did not work correctly.
  3. The ICU data is now embedded statically, which fixes a U_FILE_ACCESS_ERROR at runtime.
  4. The new class GenericCharTraits provides char_traits for non-standard single-byte character types, which newer versions of libc++ no longer provide implicitly. This completes the char_traits part of Change code to be more compatible with libc++ #3001.
  5. Tests that trigger bugs in the Emscripten toolchain (for example, HttpTest) are excluded from the WASM build; each exclusion has a comment that names the failing compiler component.
  6. Several redundant compilation flags are removed, and the CI workflow is adjusted accordingly.

@codecov

codecov Bot commented Apr 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.07%. Comparing base (b3a3e4a) to head (b9e4468).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2849      +/-   ##
==========================================
+ Coverage   92.05%   92.07%   +0.01%     
==========================================
  Files         529      530       +1     
  Lines       45362    45395      +33     
  Branches     6208     6208              
==========================================
+ Hits        41757    41796      +39     
+ Misses       1759     1756       -3     
+ Partials     1846     1843       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
14.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

hannahbast pushed a commit that referenced this pull request Jul 6, 2026
This is a subset of #2849 that increases the compatibility with `libc++` (the standard library of LLVM). In particular:

* In `libc++`, `std::string_view::begin()` and `end()` do not return a `const char*` but a wrapped iterator type, so `.data()` has to be used wherever a raw `const char*` is required (for example, for `std::from_chars`).
* `libc++` provides no `char_traits` for non-`char` types, so `std::basic_string_view<std::byte>` is replaced by a `span<std::byte>`. NOTE: This PR does not yet address all instances of this second issue; for the remaining ones there are several possible solutions (some uglier than others), which will be handled in a follow-up.

NOTE: This change does not alter any behavior; it only replaces non-portable uses of the standard library by portable ones.
hannahbast pushed a commit that referenced this pull request Jul 6, 2026
This is a subset of #2849 that increases the compatibility with `libc++` (the standard library of LLVM). In particular:

* In `libc++`, `std::string_view::begin()` and `end()` do not return a `const char*` but a wrapped iterator type, so `.data()` has to be used wherever a raw `const char*` is required (for example, for `std::from_chars`).
* `libc++` provides no `char_traits` for non-`char` types, so `std::basic_string_view<std::byte>` is replaced by a `span<std::byte>`. NOTE: This PR does not yet address all instances of this second issue; for the remaining ones there are several possible solutions (some uglier than others), which will be handled in a follow-up.

NOTE: This change does not alter any behavior; it only replaces non-portable uses of the standard library by portable ones.
@RobinTF RobinTF changed the title Enhance WASM build pipeline Modernize and fix the WASM (Emscripten) build Jul 7, 2026
@RobinTF RobinTF changed the title Modernize and fix the WASM (Emscripten) build Modernize and fix the Emscripten build Jul 7, 2026
@RobinTF
RobinTF marked this pull request as ready for review July 7, 2026 23:51
@RobinTF
RobinTF requested a review from joka921 July 7, 2026 23:51

@joka921 joka921 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.

In general nice, but i have some questions for clarification etc.

Comment thread src/util/GenericCharTraits.h
Comment thread src/util/GenericCharTraits.h
Comment thread src/util/GenericCharTraits.h Outdated
Comment thread test/MaterializedViewsTest.cpp
Comment thread CMakeLists.txt Outdated
Comment thread conanprofiles/emscripten.profile
Comment thread .github/workflows/native-build-with-conan-and-emscripten.yml Outdated
Comment thread .github/workflows/native-build-with-conan-and-emscripten.yml Outdated
Comment thread .github/workflows/native-build-with-conan-and-emscripten.yml
Comment thread .github/workflows/native-build-with-conan-and-emscripten.yml

@joka921 joka921 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.

Thank you very much.

@hannahbast
hannahbast merged commit e850615 into ad-freiburg:master Jul 9, 2026
21 checks passed
@sparql-conformance

Copy link
Copy Markdown

Overview

Number of Tests Passed ✅ Intended ✅ Failed ❌ Not tested
498 414 73 11 0

Conformance check passed ✅

No test result changes.

Details: https://qlever.dev/sparql-conformance-ui?cur=40a0e7df96fb9d0e0c47baba8cf078909c30d28f&prev=f5a34398bdb016c24ba3c01fb93507cd3a670aac

@sonarqubecloud

sonarqubecloud Bot commented Jul 9, 2026

Copy link
Copy Markdown

@RobinTF
RobinTF deleted the improve-wasm branch July 9, 2026 06:34
marvin7122 pushed a commit to marvin7122/qlever that referenced this pull request Jul 9, 2026
So far, the Emscripten (WASM) build of QLever used an outdated toolchain and had several problems at runtime (for example, exceptions did not work correctly, and `ICU` could not find its data). This PR modernizes the build and fixes these problems. In particular:

1. The `emsdk` is bumped from version 3.1.73 to 6.0.2 and is now installed directly instead of via the Conan Center recipe, which lags behind. The `CMake` toolchain and the build environment are wired up so that dependencies that build via autotools (`ICU` and `OpenSSL`) also use the Emscripten compiler.
2. Exception handling now consistently uses `-fwasm-exceptions` for both compiling and linking; previously, exceptions did not work correctly.
3. The `ICU` data is now embedded statically, which fixes a `U_FILE_ACCESS_ERROR` at runtime.
4. The new class `GenericCharTraits` provides `char_traits` for non-standard single-byte character types, which newer versions of `libc++` no longer provide implicitly. This completes the `char_traits` part of ad-freiburg#3001.
5. Tests that trigger bugs in the Emscripten toolchain (for example, `HttpTest`) are excluded from the WASM build; each exclusion has a comment that names the failing compiler component.
6. Several redundant compilation flags are removed, and the CI workflow is adjusted accordingly.
yarox-1 pushed a commit to yarox-1/qlever that referenced this pull request Aug 10, 2026
This is a subset of ad-freiburg#2849 that increases the compatibility with `libc++` (the standard library of LLVM). In particular:

* In `libc++`, `std::string_view::begin()` and `end()` do not return a `const char*` but a wrapped iterator type, so `.data()` has to be used wherever a raw `const char*` is required (for example, for `std::from_chars`).
* `libc++` provides no `char_traits` for non-`char` types, so `std::basic_string_view<std::byte>` is replaced by a `span<std::byte>`. NOTE: This PR does not yet address all instances of this second issue; for the remaining ones there are several possible solutions (some uglier than others), which will be handled in a follow-up.

NOTE: This change does not alter any behavior; it only replaces non-portable uses of the standard library by portable ones.
yarox-1 pushed a commit to yarox-1/qlever that referenced this pull request Aug 10, 2026
So far, the Emscripten (WASM) build of QLever used an outdated toolchain and had several problems at runtime (for example, exceptions did not work correctly, and `ICU` could not find its data). This PR modernizes the build and fixes these problems. In particular:

1. The `emsdk` is bumped from version 3.1.73 to 6.0.2 and is now installed directly instead of via the Conan Center recipe, which lags behind. The `CMake` toolchain and the build environment are wired up so that dependencies that build via autotools (`ICU` and `OpenSSL`) also use the Emscripten compiler.
2. Exception handling now consistently uses `-fwasm-exceptions` for both compiling and linking; previously, exceptions did not work correctly.
3. The `ICU` data is now embedded statically, which fixes a `U_FILE_ACCESS_ERROR` at runtime.
4. The new class `GenericCharTraits` provides `char_traits` for non-standard single-byte character types, which newer versions of `libc++` no longer provide implicitly. This completes the `char_traits` part of ad-freiburg#3001.
5. Tests that trigger bugs in the Emscripten toolchain (for example, `HttpTest`) are excluded from the WASM build; each exclusion has a comment that names the failing compiler component.
6. Several redundant compilation flags are removed, and the CI workflow is adjusted accordingly.
yarox-1 pushed a commit to yarox-1/qlever that referenced this pull request Aug 11, 2026
This is a subset of ad-freiburg#2849 that increases the compatibility with `libc++` (the standard library of LLVM). In particular:

* In `libc++`, `std::string_view::begin()` and `end()` do not return a `const char*` but a wrapped iterator type, so `.data()` has to be used wherever a raw `const char*` is required (for example, for `std::from_chars`).
* `libc++` provides no `char_traits` for non-`char` types, so `std::basic_string_view<std::byte>` is replaced by a `span<std::byte>`. NOTE: This PR does not yet address all instances of this second issue; for the remaining ones there are several possible solutions (some uglier than others), which will be handled in a follow-up.

NOTE: This change does not alter any behavior; it only replaces non-portable uses of the standard library by portable ones.
yarox-1 pushed a commit to yarox-1/qlever that referenced this pull request Aug 11, 2026
So far, the Emscripten (WASM) build of QLever used an outdated toolchain and had several problems at runtime (for example, exceptions did not work correctly, and `ICU` could not find its data). This PR modernizes the build and fixes these problems. In particular:

1. The `emsdk` is bumped from version 3.1.73 to 6.0.2 and is now installed directly instead of via the Conan Center recipe, which lags behind. The `CMake` toolchain and the build environment are wired up so that dependencies that build via autotools (`ICU` and `OpenSSL`) also use the Emscripten compiler.
2. Exception handling now consistently uses `-fwasm-exceptions` for both compiling and linking; previously, exceptions did not work correctly.
3. The `ICU` data is now embedded statically, which fixes a `U_FILE_ACCESS_ERROR` at runtime.
4. The new class `GenericCharTraits` provides `char_traits` for non-standard single-byte character types, which newer versions of `libc++` no longer provide implicitly. This completes the `char_traits` part of ad-freiburg#3001.
5. Tests that trigger bugs in the Emscripten toolchain (for example, `HttpTest`) are excluded from the WASM build; each exclusion has a comment that names the failing compiler component.
6. Several redundant compilation flags are removed, and the CI workflow is adjusted accordingly.
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.

3 participants