Skip to content

Android NDK 25 [firefox-android: main] - #5442

Merged
bendk merged 3 commits into
mozilla:mainfrom
bendk:ndk25
Mar 30, 2023
Merged

Android NDK 25 [firefox-android: main]#5442
bendk merged 3 commits into
mozilla:mainfrom
bendk:ndk25

Conversation

@bendk

@bendkbendk commented Mar 24, 2023

Copy link
Copy Markdown
Contributor

This updates the code to use android NDK 25.

The upgrade caused all kinds of issues, see #5436 for details. This PR contains a hack to work around those issues. It's very ugly, but it works at least. Is there a better way to do this?

Pull Request checklist

  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGES_UNRELEASED.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due dilligence applied in selecting them.

Branch builds: add [firefox-android: branch-name] to the PR title.

@bendkbendk mentioned this pull request Mar 24, 2023
@codecov-commenter

codecov-commenter commented Mar 24, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage: 33.33% and project coverage change: -0.04⚠️

Comparison is base (86c84c2) 45.11% compared to head (2ded859) 45.08%.

Additional details and impacted files
@@ Coverage Diff @@## main #5442 +/- ##
==========================================
- Coverage 45.11% 45.08% -0.04% 
==========================================
Files 172 172 Lines 14378 14387 +9 ==========================================
- Hits 6487 6486 -1 - Misses 7891 7901 +10 
Impacted FilesCoverage Δ
.../support/rc_crypto/nss/nss_build_common/src/lib.rs65.09% <33.33%> (-1.91%)⬇️

... and 4 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@rvandermeulen
rvandermeulen removed their request for review March 24, 2023 20:31
@rvandermeulen

Copy link
Copy Markdown
Contributor

I guess @glandium can't formally review this, but ultimately I think he's the one who should sign off on whatever lands here.

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

There's nothing here that worries me beyond the obvious grossness of the workaround.

The only suggestion I have is that if it's a) helpful and b) going to be a persistent situation, we could teach the rust-android-gradle plugin to do this symbol dance (or to remove -nodefaultlibs or whatever the flag was) and generalize this slightly.

I'm going to mark this r+ and trust @bendk and @glandium to agree on the details. Ben, land when you're comfortable.

What a tremendous waste of time and effort :(

@bendk
bendkforce-pushed the ndk25 branch 8 times, most recently from 68edfed to 6a0f8ebCompareMarch 29, 2023 23:29
rvandermeulenand others added 3 commits March 30, 2023 09:55
The new NDK doesn't link to `libgcc` anymore, which breaks our our NSS
and SQLCipher libraries since they depended on the symbols from
libclang_rt.builtins-x86_64-android` like `__extenddftf2`. See mozilla#5436 for
more details.
The change works around this by manually linking to the
libclang_rt.builtins-x86_64-android library in this case.
Added a doc on how to upgrade the Android NDK which hopefully will help
us in the future. Extracted some common code from the the
`build-*-android.sh` scripts to make these directions simpler.
@bendk
bendk merged commit 2c97beb into mozilla:mainMar 30, 2023
Niels-Be added a commit to Niels-Be/rusqlite that referenced this pull request Nov 4, 2024
Adds a temporary workaround for [an issue] with the Rust compiler and Android when
compiling for x86_64 devices.
The Android NDK used to include `libgcc` for unwind support (which is required by Rust
among others). From NDK r23, `libgcc` is removed, replaced by LLVM's `libunwind`.
However, `libgcc` was ambiently providing other compiler builtins, one of which we
require: `__extenddftf2` for software floating-point emulation. This is used by SQLite
(via the `rusqlite` crate), which defines a `LONGDOUBLE_TYPE` type as `long double`.
Rust uses a `compiler-builtins` crate that does not provide `__extenddftf2` because
[it involves floating-point types that are not supported by Rust][unsupported]. For
some reason, they _do_ export this symbol for `aarch64-linux-android`, but they do not
for `x86_64-linux-android`. Thus we run into a problem when trying to compile and run
the SDK on an x86_64 emulator.
The workaround comes from [this Mozilla PR]: we tell Cargo to statically link the
builtins from the Clang runtime provided inside the NDK, to provide this symbol.
[an issue]: rust-lang/rust#109717
[this Mozilla PR]:mozilla/application-services#5442
[unsupported]: https://github.com/rust-lang/compiler-builtins#unimplemented-functions
This fix was copied from: https://github.com/nerdcash/Nerdbank.Cryptocurrencies/pull/262/files#diff-7cc5f1ef7cbfce3114fe631861f19de2c050c13ff71e987100669131bb9ffa25Fixesrusqlite#1380
Niels-Be added a commit to Niels-Be/rusqlite that referenced this pull request Nov 26, 2024
Adds a temporary workaround for [an issue] with the Rust compiler and Android when
compiling for x86_64 devices.
The Android NDK used to include `libgcc` for unwind support (which is required by Rust
among others). From NDK r23, `libgcc` is removed, replaced by LLVM's `libunwind`.
However, `libgcc` was ambiently providing other compiler builtins, one of which we
require: `__extenddftf2` for software floating-point emulation. This is used by SQLite
(via the `rusqlite` crate), which defines a `LONGDOUBLE_TYPE` type as `long double`.
Rust uses a `compiler-builtins` crate that does not provide `__extenddftf2` because
[it involves floating-point types that are not supported by Rust][unsupported]. For
some reason, they _do_ export this symbol for `aarch64-linux-android`, but they do not
for `x86_64-linux-android`. Thus we run into a problem when trying to compile and run
the SDK on an x86_64 emulator.
The workaround comes from [this Mozilla PR]: we tell Cargo to statically link the
builtins from the Clang runtime provided inside the NDK, to provide this symbol.
[an issue]: rust-lang/rust#109717
[this Mozilla PR]:mozilla/application-services#5442
[unsupported]: https://github.com/rust-lang/compiler-builtins#unimplemented-functions
This fix was copied from: zcash/zcash-android-wallet-sdk@1bf2f84Fixesrusqlite#1380
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Sign up for freeto 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.

4 participants

@bendk@codecov-commenter@rvandermeulen@ncalexan
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Android NDK 25 [firefox-android: main] by bendk · Pull Request #5442 · mozilla/application-services · GitHub
Skip to content

Android NDK 25 [firefox-android: main] - #5442

Merged
bendk merged 3 commits into
mozilla:mainfrom
bendk:ndk25
Mar 30, 2023
Merged

Android NDK 25 [firefox-android: main]#5442
bendk merged 3 commits into
mozilla:mainfrom
bendk:ndk25

Conversation

@bendk

@bendkbendk commented Mar 24, 2023

Copy link
Copy Markdown
Contributor

This updates the code to use android NDK 25.

The upgrade caused all kinds of issues, see #5436 for details. This PR contains a hack to work around those issues. It's very ugly, but it works at least. Is there a better way to do this?

Pull Request checklist

  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGES_UNRELEASED.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due dilligence applied in selecting them.

Branch builds: add [firefox-android: branch-name] to the PR title.

@bendkbendk mentioned this pull request Mar 24, 2023
@codecov-commenter

codecov-commenter commented Mar 24, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage: 33.33% and project coverage change: -0.04⚠️

Comparison is base (86c84c2) 45.11% compared to head (2ded859) 45.08%.

Additional details and impacted files
@@ Coverage Diff @@## main #5442 +/- ##
==========================================
- Coverage 45.11% 45.08% -0.04% 
==========================================
Files 172 172 Lines 14378 14387 +9 ==========================================
- Hits 6487 6486 -1 - Misses 7891 7901 +10 
Impacted FilesCoverage Δ
.../support/rc_crypto/nss/nss_build_common/src/lib.rs65.09% <33.33%> (-1.91%)⬇️

... and 4 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@rvandermeulen
rvandermeulen removed their request for review March 24, 2023 20:31
@rvandermeulen

Copy link
Copy Markdown
Contributor

I guess @glandium can't formally review this, but ultimately I think he's the one who should sign off on whatever lands here.

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

There's nothing here that worries me beyond the obvious grossness of the workaround.

The only suggestion I have is that if it's a) helpful and b) going to be a persistent situation, we could teach the rust-android-gradle plugin to do this symbol dance (or to remove -nodefaultlibs or whatever the flag was) and generalize this slightly.

I'm going to mark this r+ and trust @bendk and @glandium to agree on the details. Ben, land when you're comfortable.

What a tremendous waste of time and effort :(

@bendk
bendkforce-pushed the ndk25 branch 8 times, most recently from 68edfed to 6a0f8ebCompareMarch 29, 2023 23:29
rvandermeulenand others added 3 commits March 30, 2023 09:55
The new NDK doesn't link to `libgcc` anymore, which breaks our our NSS
and SQLCipher libraries since they depended on the symbols from
libclang_rt.builtins-x86_64-android` like `__extenddftf2`. See mozilla#5436 for
more details.
The change works around this by manually linking to the
libclang_rt.builtins-x86_64-android library in this case.
Added a doc on how to upgrade the Android NDK which hopefully will help
us in the future. Extracted some common code from the the
`build-*-android.sh` scripts to make these directions simpler.
@bendk
bendk merged commit 2c97beb into mozilla:mainMar 30, 2023
Niels-Be added a commit to Niels-Be/rusqlite that referenced this pull request Nov 4, 2024
Adds a temporary workaround for [an issue] with the Rust compiler and Android when
compiling for x86_64 devices.
The Android NDK used to include `libgcc` for unwind support (which is required by Rust
among others). From NDK r23, `libgcc` is removed, replaced by LLVM's `libunwind`.
However, `libgcc` was ambiently providing other compiler builtins, one of which we
require: `__extenddftf2` for software floating-point emulation. This is used by SQLite
(via the `rusqlite` crate), which defines a `LONGDOUBLE_TYPE` type as `long double`.
Rust uses a `compiler-builtins` crate that does not provide `__extenddftf2` because
[it involves floating-point types that are not supported by Rust][unsupported]. For
some reason, they _do_ export this symbol for `aarch64-linux-android`, but they do not
for `x86_64-linux-android`. Thus we run into a problem when trying to compile and run
the SDK on an x86_64 emulator.
The workaround comes from [this Mozilla PR]: we tell Cargo to statically link the
builtins from the Clang runtime provided inside the NDK, to provide this symbol.
[an issue]: rust-lang/rust#109717
[this Mozilla PR]:mozilla/application-services#5442
[unsupported]: https://github.com/rust-lang/compiler-builtins#unimplemented-functions
This fix was copied from: https://github.com/nerdcash/Nerdbank.Cryptocurrencies/pull/262/files#diff-7cc5f1ef7cbfce3114fe631861f19de2c050c13ff71e987100669131bb9ffa25Fixesrusqlite#1380
Niels-Be added a commit to Niels-Be/rusqlite that referenced this pull request Nov 26, 2024
Adds a temporary workaround for [an issue] with the Rust compiler and Android when
compiling for x86_64 devices.
The Android NDK used to include `libgcc` for unwind support (which is required by Rust
among others). From NDK r23, `libgcc` is removed, replaced by LLVM's `libunwind`.
However, `libgcc` was ambiently providing other compiler builtins, one of which we
require: `__extenddftf2` for software floating-point emulation. This is used by SQLite
(via the `rusqlite` crate), which defines a `LONGDOUBLE_TYPE` type as `long double`.
Rust uses a `compiler-builtins` crate that does not provide `__extenddftf2` because
[it involves floating-point types that are not supported by Rust][unsupported]. For
some reason, they _do_ export this symbol for `aarch64-linux-android`, but they do not
for `x86_64-linux-android`. Thus we run into a problem when trying to compile and run
the SDK on an x86_64 emulator.
The workaround comes from [this Mozilla PR]: we tell Cargo to statically link the
builtins from the Clang runtime provided inside the NDK, to provide this symbol.
[an issue]: rust-lang/rust#109717
[this Mozilla PR]:mozilla/application-services#5442
[unsupported]: https://github.com/rust-lang/compiler-builtins#unimplemented-functions
This fix was copied from: zcash/zcash-android-wallet-sdk@1bf2f84Fixesrusqlite#1380
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Sign up for freeto 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.

4 participants

@bendk@codecov-commenter@rvandermeulen@ncalexan
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Android NDK 25 [firefox-android: main] by bendk · Pull Request #5442 · mozilla/application-services · GitHub
Skip to content

Android NDK 25 [firefox-android: main] - #5442

Merged
bendk merged 3 commits into
mozilla:mainfrom
bendk:ndk25
Mar 30, 2023
Merged

Android NDK 25 [firefox-android: main]#5442
bendk merged 3 commits into
mozilla:mainfrom
bendk:ndk25

Conversation

@bendk

@bendkbendk commented Mar 24, 2023

Copy link
Copy Markdown
Contributor

This updates the code to use android NDK 25.

The upgrade caused all kinds of issues, see #5436 for details. This PR contains a hack to work around those issues. It's very ugly, but it works at least. Is there a better way to do this?

Pull Request checklist

  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGES_UNRELEASED.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due dilligence applied in selecting them.

Branch builds: add [firefox-android: branch-name] to the PR title.

@bendkbendk mentioned this pull request Mar 24, 2023
@codecov-commenter

codecov-commenter commented Mar 24, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage: 33.33% and project coverage change: -0.04⚠️

Comparison is base (86c84c2) 45.11% compared to head (2ded859) 45.08%.

Additional details and impacted files
@@ Coverage Diff @@## main #5442 +/- ##
==========================================
- Coverage 45.11% 45.08% -0.04% 
==========================================
Files 172 172 Lines 14378 14387 +9 ==========================================
- Hits 6487 6486 -1 - Misses 7891 7901 +10 
Impacted FilesCoverage Δ
.../support/rc_crypto/nss/nss_build_common/src/lib.rs65.09% <33.33%> (-1.91%)⬇️

... and 4 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@rvandermeulen
rvandermeulen removed their request for review March 24, 2023 20:31
@rvandermeulen

Copy link
Copy Markdown
Contributor

I guess @glandium can't formally review this, but ultimately I think he's the one who should sign off on whatever lands here.

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

There's nothing here that worries me beyond the obvious grossness of the workaround.

The only suggestion I have is that if it's a) helpful and b) going to be a persistent situation, we could teach the rust-android-gradle plugin to do this symbol dance (or to remove -nodefaultlibs or whatever the flag was) and generalize this slightly.

I'm going to mark this r+ and trust @bendk and @glandium to agree on the details. Ben, land when you're comfortable.

What a tremendous waste of time and effort :(

@bendk
bendkforce-pushed the ndk25 branch 8 times, most recently from 68edfed to 6a0f8ebCompareMarch 29, 2023 23:29
rvandermeulenand others added 3 commits March 30, 2023 09:55
The new NDK doesn't link to `libgcc` anymore, which breaks our our NSS
and SQLCipher libraries since they depended on the symbols from
libclang_rt.builtins-x86_64-android` like `__extenddftf2`. See mozilla#5436 for
more details.
The change works around this by manually linking to the
libclang_rt.builtins-x86_64-android library in this case.
Added a doc on how to upgrade the Android NDK which hopefully will help
us in the future. Extracted some common code from the the
`build-*-android.sh` scripts to make these directions simpler.
@bendk
bendk merged commit 2c97beb into mozilla:mainMar 30, 2023
Niels-Be added a commit to Niels-Be/rusqlite that referenced this pull request Nov 4, 2024
Adds a temporary workaround for [an issue] with the Rust compiler and Android when
compiling for x86_64 devices.
The Android NDK used to include `libgcc` for unwind support (which is required by Rust
among others). From NDK r23, `libgcc` is removed, replaced by LLVM's `libunwind`.
However, `libgcc` was ambiently providing other compiler builtins, one of which we
require: `__extenddftf2` for software floating-point emulation. This is used by SQLite
(via the `rusqlite` crate), which defines a `LONGDOUBLE_TYPE` type as `long double`.
Rust uses a `compiler-builtins` crate that does not provide `__extenddftf2` because
[it involves floating-point types that are not supported by Rust][unsupported]. For
some reason, they _do_ export this symbol for `aarch64-linux-android`, but they do not
for `x86_64-linux-android`. Thus we run into a problem when trying to compile and run
the SDK on an x86_64 emulator.
The workaround comes from [this Mozilla PR]: we tell Cargo to statically link the
builtins from the Clang runtime provided inside the NDK, to provide this symbol.
[an issue]: rust-lang/rust#109717
[this Mozilla PR]:mozilla/application-services#5442
[unsupported]: https://github.com/rust-lang/compiler-builtins#unimplemented-functions
This fix was copied from: https://github.com/nerdcash/Nerdbank.Cryptocurrencies/pull/262/files#diff-7cc5f1ef7cbfce3114fe631861f19de2c050c13ff71e987100669131bb9ffa25Fixesrusqlite#1380
Niels-Be added a commit to Niels-Be/rusqlite that referenced this pull request Nov 26, 2024
Adds a temporary workaround for [an issue] with the Rust compiler and Android when
compiling for x86_64 devices.
The Android NDK used to include `libgcc` for unwind support (which is required by Rust
among others). From NDK r23, `libgcc` is removed, replaced by LLVM's `libunwind`.
However, `libgcc` was ambiently providing other compiler builtins, one of which we
require: `__extenddftf2` for software floating-point emulation. This is used by SQLite
(via the `rusqlite` crate), which defines a `LONGDOUBLE_TYPE` type as `long double`.
Rust uses a `compiler-builtins` crate that does not provide `__extenddftf2` because
[it involves floating-point types that are not supported by Rust][unsupported]. For
some reason, they _do_ export this symbol for `aarch64-linux-android`, but they do not
for `x86_64-linux-android`. Thus we run into a problem when trying to compile and run
the SDK on an x86_64 emulator.
The workaround comes from [this Mozilla PR]: we tell Cargo to statically link the
builtins from the Clang runtime provided inside the NDK, to provide this symbol.
[an issue]: rust-lang/rust#109717
[this Mozilla PR]:mozilla/application-services#5442
[unsupported]: https://github.com/rust-lang/compiler-builtins#unimplemented-functions
This fix was copied from: zcash/zcash-android-wallet-sdk@1bf2f84Fixesrusqlite#1380
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Sign up for freeto 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.

4 participants

@bendk@codecov-commenter@rvandermeulen@ncalexan
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Android NDK 25 [firefox-android: main] by bendk · Pull Request #5442 · mozilla/application-services · GitHub
Skip to content

Android NDK 25 [firefox-android: main] - #5442

Merged
bendk merged 3 commits into
mozilla:mainfrom
bendk:ndk25
Mar 30, 2023
Merged

Android NDK 25 [firefox-android: main]#5442
bendk merged 3 commits into
mozilla:mainfrom
bendk:ndk25

Conversation

@bendk

@bendkbendk commented Mar 24, 2023

Copy link
Copy Markdown
Contributor

This updates the code to use android NDK 25.

The upgrade caused all kinds of issues, see #5436 for details. This PR contains a hack to work around those issues. It's very ugly, but it works at least. Is there a better way to do this?

Pull Request checklist

  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGES_UNRELEASED.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due dilligence applied in selecting them.

Branch builds: add [firefox-android: branch-name] to the PR title.

@bendkbendk mentioned this pull request Mar 24, 2023
@codecov-commenter

codecov-commenter commented Mar 24, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage: 33.33% and project coverage change: -0.04⚠️

Comparison is base (86c84c2) 45.11% compared to head (2ded859) 45.08%.

Additional details and impacted files
@@ Coverage Diff @@## main #5442 +/- ##
==========================================
- Coverage 45.11% 45.08% -0.04% 
==========================================
Files 172 172 Lines 14378 14387 +9 ==========================================
- Hits 6487 6486 -1 - Misses 7891 7901 +10 
Impacted FilesCoverage Δ
.../support/rc_crypto/nss/nss_build_common/src/lib.rs65.09% <33.33%> (-1.91%)⬇️

... and 4 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@rvandermeulen
rvandermeulen removed their request for review March 24, 2023 20:31
@rvandermeulen

Copy link
Copy Markdown
Contributor

I guess @glandium can't formally review this, but ultimately I think he's the one who should sign off on whatever lands here.

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

There's nothing here that worries me beyond the obvious grossness of the workaround.

The only suggestion I have is that if it's a) helpful and b) going to be a persistent situation, we could teach the rust-android-gradle plugin to do this symbol dance (or to remove -nodefaultlibs or whatever the flag was) and generalize this slightly.

I'm going to mark this r+ and trust @bendk and @glandium to agree on the details. Ben, land when you're comfortable.

What a tremendous waste of time and effort :(

@bendk
bendkforce-pushed the ndk25 branch 8 times, most recently from 68edfed to 6a0f8ebCompareMarch 29, 2023 23:29
rvandermeulenand others added 3 commits March 30, 2023 09:55
The new NDK doesn't link to `libgcc` anymore, which breaks our our NSS
and SQLCipher libraries since they depended on the symbols from
libclang_rt.builtins-x86_64-android` like `__extenddftf2`. See mozilla#5436 for
more details.
The change works around this by manually linking to the
libclang_rt.builtins-x86_64-android library in this case.
Added a doc on how to upgrade the Android NDK which hopefully will help
us in the future. Extracted some common code from the the
`build-*-android.sh` scripts to make these directions simpler.
@bendk
bendk merged commit 2c97beb into mozilla:mainMar 30, 2023
Niels-Be added a commit to Niels-Be/rusqlite that referenced this pull request Nov 4, 2024
Adds a temporary workaround for [an issue] with the Rust compiler and Android when
compiling for x86_64 devices.
The Android NDK used to include `libgcc` for unwind support (which is required by Rust
among others). From NDK r23, `libgcc` is removed, replaced by LLVM's `libunwind`.
However, `libgcc` was ambiently providing other compiler builtins, one of which we
require: `__extenddftf2` for software floating-point emulation. This is used by SQLite
(via the `rusqlite` crate), which defines a `LONGDOUBLE_TYPE` type as `long double`.
Rust uses a `compiler-builtins` crate that does not provide `__extenddftf2` because
[it involves floating-point types that are not supported by Rust][unsupported]. For
some reason, they _do_ export this symbol for `aarch64-linux-android`, but they do not
for `x86_64-linux-android`. Thus we run into a problem when trying to compile and run
the SDK on an x86_64 emulator.
The workaround comes from [this Mozilla PR]: we tell Cargo to statically link the
builtins from the Clang runtime provided inside the NDK, to provide this symbol.
[an issue]: rust-lang/rust#109717
[this Mozilla PR]:mozilla/application-services#5442
[unsupported]: https://github.com/rust-lang/compiler-builtins#unimplemented-functions
This fix was copied from: https://github.com/nerdcash/Nerdbank.Cryptocurrencies/pull/262/files#diff-7cc5f1ef7cbfce3114fe631861f19de2c050c13ff71e987100669131bb9ffa25Fixesrusqlite#1380
Niels-Be added a commit to Niels-Be/rusqlite that referenced this pull request Nov 26, 2024
Adds a temporary workaround for [an issue] with the Rust compiler and Android when
compiling for x86_64 devices.
The Android NDK used to include `libgcc` for unwind support (which is required by Rust
among others). From NDK r23, `libgcc` is removed, replaced by LLVM's `libunwind`.
However, `libgcc` was ambiently providing other compiler builtins, one of which we
require: `__extenddftf2` for software floating-point emulation. This is used by SQLite
(via the `rusqlite` crate), which defines a `LONGDOUBLE_TYPE` type as `long double`.
Rust uses a `compiler-builtins` crate that does not provide `__extenddftf2` because
[it involves floating-point types that are not supported by Rust][unsupported]. For
some reason, they _do_ export this symbol for `aarch64-linux-android`, but they do not
for `x86_64-linux-android`. Thus we run into a problem when trying to compile and run
the SDK on an x86_64 emulator.
The workaround comes from [this Mozilla PR]: we tell Cargo to statically link the
builtins from the Clang runtime provided inside the NDK, to provide this symbol.
[an issue]: rust-lang/rust#109717
[this Mozilla PR]:mozilla/application-services#5442
[unsupported]: https://github.com/rust-lang/compiler-builtins#unimplemented-functions
This fix was copied from: zcash/zcash-android-wallet-sdk@1bf2f84Fixesrusqlite#1380
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Sign up for freeto 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.

4 participants

@bendk@codecov-commenter@rvandermeulen@ncalexan
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' Android NDK 25 [firefox-android: main] by bendk · Pull Request #5442 · mozilla/application-services · GitHub
Skip to content

Android NDK 25 [firefox-android: main] - #5442

Merged
bendk merged 3 commits into
mozilla:mainfrom
bendk:ndk25
Mar 30, 2023
Merged

Android NDK 25 [firefox-android: main]#5442
bendk merged 3 commits into
mozilla:mainfrom
bendk:ndk25

Conversation

@bendk

@bendkbendk commented Mar 24, 2023

Copy link
Copy Markdown
Contributor

This updates the code to use android NDK 25.

The upgrade caused all kinds of issues, see #5436 for details. This PR contains a hack to work around those issues. It's very ugly, but it works at least. Is there a better way to do this?

Pull Request checklist

  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGES_UNRELEASED.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due dilligence applied in selecting them.

Branch builds: add [firefox-android: branch-name] to the PR title.

@bendkbendk mentioned this pull request Mar 24, 2023
@codecov-commenter

codecov-commenter commented Mar 24, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage: 33.33% and project coverage change: -0.04⚠️

Comparison is base (86c84c2) 45.11% compared to head (2ded859) 45.08%.

Additional details and impacted files
@@ Coverage Diff @@## main #5442 +/- ##
==========================================
- Coverage 45.11% 45.08% -0.04% 
==========================================
Files 172 172 Lines 14378 14387 +9 ==========================================
- Hits 6487 6486 -1 - Misses 7891 7901 +10 
Impacted FilesCoverage Δ
.../support/rc_crypto/nss/nss_build_common/src/lib.rs65.09% <33.33%> (-1.91%)⬇️

... and 4 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@rvandermeulen
rvandermeulen removed their request for review March 24, 2023 20:31
@rvandermeulen

Copy link
Copy Markdown
Contributor

I guess @glandium can't formally review this, but ultimately I think he's the one who should sign off on whatever lands here.

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

There's nothing here that worries me beyond the obvious grossness of the workaround.

The only suggestion I have is that if it's a) helpful and b) going to be a persistent situation, we could teach the rust-android-gradle plugin to do this symbol dance (or to remove -nodefaultlibs or whatever the flag was) and generalize this slightly.

I'm going to mark this r+ and trust @bendk and @glandium to agree on the details. Ben, land when you're comfortable.

What a tremendous waste of time and effort :(

@bendk
bendkforce-pushed the ndk25 branch 8 times, most recently from 68edfed to 6a0f8ebCompareMarch 29, 2023 23:29
rvandermeulenand others added 3 commits March 30, 2023 09:55
The new NDK doesn't link to `libgcc` anymore, which breaks our our NSS
and SQLCipher libraries since they depended on the symbols from
libclang_rt.builtins-x86_64-android` like `__extenddftf2`. See mozilla#5436 for
more details.
The change works around this by manually linking to the
libclang_rt.builtins-x86_64-android library in this case.
Added a doc on how to upgrade the Android NDK which hopefully will help
us in the future. Extracted some common code from the the
`build-*-android.sh` scripts to make these directions simpler.
@bendk
bendk merged commit 2c97beb into mozilla:mainMar 30, 2023
Niels-Be added a commit to Niels-Be/rusqlite that referenced this pull request Nov 4, 2024
Adds a temporary workaround for [an issue] with the Rust compiler and Android when
compiling for x86_64 devices.
The Android NDK used to include `libgcc` for unwind support (which is required by Rust
among others). From NDK r23, `libgcc` is removed, replaced by LLVM's `libunwind`.
However, `libgcc` was ambiently providing other compiler builtins, one of which we
require: `__extenddftf2` for software floating-point emulation. This is used by SQLite
(via the `rusqlite` crate), which defines a `LONGDOUBLE_TYPE` type as `long double`.
Rust uses a `compiler-builtins` crate that does not provide `__extenddftf2` because
[it involves floating-point types that are not supported by Rust][unsupported]. For
some reason, they _do_ export this symbol for `aarch64-linux-android`, but they do not
for `x86_64-linux-android`. Thus we run into a problem when trying to compile and run
the SDK on an x86_64 emulator.
The workaround comes from [this Mozilla PR]: we tell Cargo to statically link the
builtins from the Clang runtime provided inside the NDK, to provide this symbol.
[an issue]: rust-lang/rust#109717
[this Mozilla PR]:mozilla/application-services#5442
[unsupported]: https://github.com/rust-lang/compiler-builtins#unimplemented-functions
This fix was copied from: https://github.com/nerdcash/Nerdbank.Cryptocurrencies/pull/262/files#diff-7cc5f1ef7cbfce3114fe631861f19de2c050c13ff71e987100669131bb9ffa25Fixesrusqlite#1380
Niels-Be added a commit to Niels-Be/rusqlite that referenced this pull request Nov 26, 2024
Adds a temporary workaround for [an issue] with the Rust compiler and Android when
compiling for x86_64 devices.
The Android NDK used to include `libgcc` for unwind support (which is required by Rust
among others). From NDK r23, `libgcc` is removed, replaced by LLVM's `libunwind`.
However, `libgcc` was ambiently providing other compiler builtins, one of which we
require: `__extenddftf2` for software floating-point emulation. This is used by SQLite
(via the `rusqlite` crate), which defines a `LONGDOUBLE_TYPE` type as `long double`.
Rust uses a `compiler-builtins` crate that does not provide `__extenddftf2` because
[it involves floating-point types that are not supported by Rust][unsupported]. For
some reason, they _do_ export this symbol for `aarch64-linux-android`, but they do not
for `x86_64-linux-android`. Thus we run into a problem when trying to compile and run
the SDK on an x86_64 emulator.
The workaround comes from [this Mozilla PR]: we tell Cargo to statically link the
builtins from the Clang runtime provided inside the NDK, to provide this symbol.
[an issue]: rust-lang/rust#109717
[this Mozilla PR]:mozilla/application-services#5442
[unsupported]: https://github.com/rust-lang/compiler-builtins#unimplemented-functions
This fix was copied from: zcash/zcash-android-wallet-sdk@1bf2f84Fixesrusqlite#1380
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Sign up for freeto 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.

4 participants

@bendk@codecov-commenter@rvandermeulen@ncalexan
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Android NDK 25 [firefox-android: main] by bendk · Pull Request #5442 · mozilla/application-services · GitHub
Skip to content

Android NDK 25 [firefox-android: main] - #5442

Merged
bendk merged 3 commits into
mozilla:mainfrom
bendk:ndk25
Mar 30, 2023
Merged

Android NDK 25 [firefox-android: main]#5442
bendk merged 3 commits into
mozilla:mainfrom
bendk:ndk25

Conversation

@bendk

@bendkbendk commented Mar 24, 2023

Copy link
Copy Markdown
Contributor

This updates the code to use android NDK 25.

The upgrade caused all kinds of issues, see #5436 for details. This PR contains a hack to work around those issues. It's very ugly, but it works at least. Is there a better way to do this?

Pull Request checklist

  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGES_UNRELEASED.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due dilligence applied in selecting them.

Branch builds: add [firefox-android: branch-name] to the PR title.

@bendkbendk mentioned this pull request Mar 24, 2023
@codecov-commenter

codecov-commenter commented Mar 24, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage: 33.33% and project coverage change: -0.04⚠️

Comparison is base (86c84c2) 45.11% compared to head (2ded859) 45.08%.

Additional details and impacted files
@@ Coverage Diff @@## main #5442 +/- ##
==========================================
- Coverage 45.11% 45.08% -0.04% 
==========================================
Files 172 172 Lines 14378 14387 +9 ==========================================
- Hits 6487 6486 -1 - Misses 7891 7901 +10 
Impacted FilesCoverage Δ
.../support/rc_crypto/nss/nss_build_common/src/lib.rs65.09% <33.33%> (-1.91%)⬇️

... and 4 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@rvandermeulen
rvandermeulen removed their request for review March 24, 2023 20:31
@rvandermeulen

Copy link
Copy Markdown
Contributor

I guess @glandium can't formally review this, but ultimately I think he's the one who should sign off on whatever lands here.

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

There's nothing here that worries me beyond the obvious grossness of the workaround.

The only suggestion I have is that if it's a) helpful and b) going to be a persistent situation, we could teach the rust-android-gradle plugin to do this symbol dance (or to remove -nodefaultlibs or whatever the flag was) and generalize this slightly.

I'm going to mark this r+ and trust @bendk and @glandium to agree on the details. Ben, land when you're comfortable.

What a tremendous waste of time and effort :(

@bendk
bendkforce-pushed the ndk25 branch 8 times, most recently from 68edfed to 6a0f8ebCompareMarch 29, 2023 23:29
rvandermeulenand others added 3 commits March 30, 2023 09:55
The new NDK doesn't link to `libgcc` anymore, which breaks our our NSS
and SQLCipher libraries since they depended on the symbols from
libclang_rt.builtins-x86_64-android` like `__extenddftf2`. See mozilla#5436 for
more details.
The change works around this by manually linking to the
libclang_rt.builtins-x86_64-android library in this case.
Added a doc on how to upgrade the Android NDK which hopefully will help
us in the future. Extracted some common code from the the
`build-*-android.sh` scripts to make these directions simpler.
@bendk
bendk merged commit 2c97beb into mozilla:mainMar 30, 2023
Niels-Be added a commit to Niels-Be/rusqlite that referenced this pull request Nov 4, 2024
Adds a temporary workaround for [an issue] with the Rust compiler and Android when
compiling for x86_64 devices.
The Android NDK used to include `libgcc` for unwind support (which is required by Rust
among others). From NDK r23, `libgcc` is removed, replaced by LLVM's `libunwind`.
However, `libgcc` was ambiently providing other compiler builtins, one of which we
require: `__extenddftf2` for software floating-point emulation. This is used by SQLite
(via the `rusqlite` crate), which defines a `LONGDOUBLE_TYPE` type as `long double`.
Rust uses a `compiler-builtins` crate that does not provide `__extenddftf2` because
[it involves floating-point types that are not supported by Rust][unsupported]. For
some reason, they _do_ export this symbol for `aarch64-linux-android`, but they do not
for `x86_64-linux-android`. Thus we run into a problem when trying to compile and run
the SDK on an x86_64 emulator.
The workaround comes from [this Mozilla PR]: we tell Cargo to statically link the
builtins from the Clang runtime provided inside the NDK, to provide this symbol.
[an issue]: rust-lang/rust#109717
[this Mozilla PR]:mozilla/application-services#5442
[unsupported]: https://github.com/rust-lang/compiler-builtins#unimplemented-functions
This fix was copied from: https://github.com/nerdcash/Nerdbank.Cryptocurrencies/pull/262/files#diff-7cc5f1ef7cbfce3114fe631861f19de2c050c13ff71e987100669131bb9ffa25Fixesrusqlite#1380
Niels-Be added a commit to Niels-Be/rusqlite that referenced this pull request Nov 26, 2024
Adds a temporary workaround for [an issue] with the Rust compiler and Android when
compiling for x86_64 devices.
The Android NDK used to include `libgcc` for unwind support (which is required by Rust
among others). From NDK r23, `libgcc` is removed, replaced by LLVM's `libunwind`.
However, `libgcc` was ambiently providing other compiler builtins, one of which we
require: `__extenddftf2` for software floating-point emulation. This is used by SQLite
(via the `rusqlite` crate), which defines a `LONGDOUBLE_TYPE` type as `long double`.
Rust uses a `compiler-builtins` crate that does not provide `__extenddftf2` because
[it involves floating-point types that are not supported by Rust][unsupported]. For
some reason, they _do_ export this symbol for `aarch64-linux-android`, but they do not
for `x86_64-linux-android`. Thus we run into a problem when trying to compile and run
the SDK on an x86_64 emulator.
The workaround comes from [this Mozilla PR]: we tell Cargo to statically link the
builtins from the Clang runtime provided inside the NDK, to provide this symbol.
[an issue]: rust-lang/rust#109717
[this Mozilla PR]:mozilla/application-services#5442
[unsupported]: https://github.com/rust-lang/compiler-builtins#unimplemented-functions
This fix was copied from: zcash/zcash-android-wallet-sdk@1bf2f84Fixesrusqlite#1380
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Sign up for freeto 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.

4 participants

@bendk@codecov-commenter@rvandermeulen@ncalexan
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Android NDK 25 [firefox-android: main] by bendk · Pull Request #5442 · mozilla/application-services · GitHub
Skip to content

Android NDK 25 [firefox-android: main] - #5442

Merged
bendk merged 3 commits into
mozilla:mainfrom
bendk:ndk25
Mar 30, 2023
Merged

Android NDK 25 [firefox-android: main]#5442
bendk merged 3 commits into
mozilla:mainfrom
bendk:ndk25

Conversation

@bendk

@bendkbendk commented Mar 24, 2023

Copy link
Copy Markdown
Contributor

This updates the code to use android NDK 25.

The upgrade caused all kinds of issues, see #5436 for details. This PR contains a hack to work around those issues. It's very ugly, but it works at least. Is there a better way to do this?

Pull Request checklist

  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGES_UNRELEASED.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due dilligence applied in selecting them.

Branch builds: add [firefox-android: branch-name] to the PR title.

@bendkbendk mentioned this pull request Mar 24, 2023
@codecov-commenter

codecov-commenter commented Mar 24, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage: 33.33% and project coverage change: -0.04⚠️

Comparison is base (86c84c2) 45.11% compared to head (2ded859) 45.08%.

Additional details and impacted files
@@ Coverage Diff @@## main #5442 +/- ##
==========================================
- Coverage 45.11% 45.08% -0.04% 
==========================================
Files 172 172 Lines 14378 14387 +9 ==========================================
- Hits 6487 6486 -1 - Misses 7891 7901 +10 
Impacted FilesCoverage Δ
.../support/rc_crypto/nss/nss_build_common/src/lib.rs65.09% <33.33%> (-1.91%)⬇️

... and 4 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@rvandermeulen
rvandermeulen removed their request for review March 24, 2023 20:31
@rvandermeulen

Copy link
Copy Markdown
Contributor

I guess @glandium can't formally review this, but ultimately I think he's the one who should sign off on whatever lands here.

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

There's nothing here that worries me beyond the obvious grossness of the workaround.

The only suggestion I have is that if it's a) helpful and b) going to be a persistent situation, we could teach the rust-android-gradle plugin to do this symbol dance (or to remove -nodefaultlibs or whatever the flag was) and generalize this slightly.

I'm going to mark this r+ and trust @bendk and @glandium to agree on the details. Ben, land when you're comfortable.

What a tremendous waste of time and effort :(

@bendk
bendkforce-pushed the ndk25 branch 8 times, most recently from 68edfed to 6a0f8ebCompareMarch 29, 2023 23:29
rvandermeulenand others added 3 commits March 30, 2023 09:55
The new NDK doesn't link to `libgcc` anymore, which breaks our our NSS
and SQLCipher libraries since they depended on the symbols from
libclang_rt.builtins-x86_64-android` like `__extenddftf2`. See mozilla#5436 for
more details.
The change works around this by manually linking to the
libclang_rt.builtins-x86_64-android library in this case.
Added a doc on how to upgrade the Android NDK which hopefully will help
us in the future. Extracted some common code from the the
`build-*-android.sh` scripts to make these directions simpler.
@bendk
bendk merged commit 2c97beb into mozilla:mainMar 30, 2023
Niels-Be added a commit to Niels-Be/rusqlite that referenced this pull request Nov 4, 2024
Adds a temporary workaround for [an issue] with the Rust compiler and Android when
compiling for x86_64 devices.
The Android NDK used to include `libgcc` for unwind support (which is required by Rust
among others). From NDK r23, `libgcc` is removed, replaced by LLVM's `libunwind`.
However, `libgcc` was ambiently providing other compiler builtins, one of which we
require: `__extenddftf2` for software floating-point emulation. This is used by SQLite
(via the `rusqlite` crate), which defines a `LONGDOUBLE_TYPE` type as `long double`.
Rust uses a `compiler-builtins` crate that does not provide `__extenddftf2` because
[it involves floating-point types that are not supported by Rust][unsupported]. For
some reason, they _do_ export this symbol for `aarch64-linux-android`, but they do not
for `x86_64-linux-android`. Thus we run into a problem when trying to compile and run
the SDK on an x86_64 emulator.
The workaround comes from [this Mozilla PR]: we tell Cargo to statically link the
builtins from the Clang runtime provided inside the NDK, to provide this symbol.
[an issue]: rust-lang/rust#109717
[this Mozilla PR]:mozilla/application-services#5442
[unsupported]: https://github.com/rust-lang/compiler-builtins#unimplemented-functions
This fix was copied from: https://github.com/nerdcash/Nerdbank.Cryptocurrencies/pull/262/files#diff-7cc5f1ef7cbfce3114fe631861f19de2c050c13ff71e987100669131bb9ffa25Fixesrusqlite#1380
Niels-Be added a commit to Niels-Be/rusqlite that referenced this pull request Nov 26, 2024
Adds a temporary workaround for [an issue] with the Rust compiler and Android when
compiling for x86_64 devices.
The Android NDK used to include `libgcc` for unwind support (which is required by Rust
among others). From NDK r23, `libgcc` is removed, replaced by LLVM's `libunwind`.
However, `libgcc` was ambiently providing other compiler builtins, one of which we
require: `__extenddftf2` for software floating-point emulation. This is used by SQLite
(via the `rusqlite` crate), which defines a `LONGDOUBLE_TYPE` type as `long double`.
Rust uses a `compiler-builtins` crate that does not provide `__extenddftf2` because
[it involves floating-point types that are not supported by Rust][unsupported]. For
some reason, they _do_ export this symbol for `aarch64-linux-android`, but they do not
for `x86_64-linux-android`. Thus we run into a problem when trying to compile and run
the SDK on an x86_64 emulator.
The workaround comes from [this Mozilla PR]: we tell Cargo to statically link the
builtins from the Clang runtime provided inside the NDK, to provide this symbol.
[an issue]: rust-lang/rust#109717
[this Mozilla PR]:mozilla/application-services#5442
[unsupported]: https://github.com/rust-lang/compiler-builtins#unimplemented-functions
This fix was copied from: zcash/zcash-android-wallet-sdk@1bf2f84Fixesrusqlite#1380
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Sign up for freeto 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.

4 participants

@bendk@codecov-commenter@rvandermeulen@ncalexan