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

Use the latest emsdk version to compile openjpeg decoder #19585

Merged
merged 1 commit into from
Mar 5, 2025

Conversation

calixteman
Copy link
Contributor

No description provided.

@calixteman
Copy link
Contributor Author

The latest version of emscripten removed an option in order to not use import.meta (see emscripten-core/emscripten#23171 for reference and out of curiosity see who was the reviewer :)).
That causes to have import.meta in openjpeg.js which leads to have an unexpected wasm file when building for mozcentral or generic. It should be possible to avoid that thanks to webpack.
@Snuffleupagus if you have time to look at that, it'd be nice or if it's easy enough few pointers would help me to figure out how to do it.

@Snuffleupagus

This comment was marked as outdated.

@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented Feb 28, 2025

There's no guarantee that it doesn't break any number of other things, so I'd recommend diffing all built files and comparing this patch against master carefully, however the following might help:

diff --git a/gulpfile.mjs b/gulpfile.mjs
index e79b79a96..77af20bdc 100644
--- a/gulpfile.mjs
+++ b/gulpfile.mjs
@@ -387,6 +387,7 @@ function createWebpackConfig(
       parser: {
         javascript: {
           importMeta: false,
+          url: false,
         },
       },
       rules: [

See also https://webpack.js.org/configuration/module/#moduleparserjavascripturl

@calixteman
Copy link
Contributor Author

I think I found something:

diff --git a/gulpfile.mjs b/gulpfile.mjs
index e79b79a96..6713cdb6b 100644
--- a/gulpfile.mjs
+++ b/gulpfile.mjs
@@ -400,6 +400,13 @@ function createWebpackConfig(
             targets: BABEL_TARGETS,
           },
         },
+        {
+          test: /\.wasm$/,
+          type: "asset/resource",
+          generator: {
+            emit: false,
+          },
+        },
       ],
     },
     // Avoid shadowing actual Node.js variables with polyfills, by disabling

@Snuffleupagus
Copy link
Collaborator

Have you compared the built pdf.worker.mjs files with/without this patch, as I suggested doing in #19585 (comment)?

Because when I do that locally it no longer emits the wasm-file, however the JavaScript code still contains a bunch of generated boilerplate code that references the wasm-file which seems strange.
Did you try the suggestion in #19585 (comment), since in my quick testing it seems to address the problem completely?

@calixteman
Copy link
Contributor Author

/botio test

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/147f820c980e286/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/7dd1719a5ead849/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/147f820c980e286/output.txt

Total script time: 29.09 mins

  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 2458

Image differences available at: http://54.241.84.105:8877/147f820c980e286/reftest-analyzer.html#web=eq.log

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/7dd1719a5ead849/output.txt

Total script time: 60.00 mins

@calixteman
Copy link
Contributor Author

/botio test

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/b54b2ed7bf3c0a4/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/f43f9e8b3d5b533/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/f43f9e8b3d5b533/output.txt

Total script time: 29.98 mins

  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 2458

Image differences available at: http://54.241.84.105:8877/f43f9e8b3d5b533/reftest-analyzer.html#web=eq.log

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/b54b2ed7bf3c0a4/output.txt

Total script time: 60.00 mins

@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented Mar 4, 2025

  • It seems that the Windows bot is broken, since no tests ran there.
  • The "failures" on the Linux bot is probably just from the Firefox 138 update, but it's not really feasible to check those given the sheer number of them.

@calixteman
Copy link
Contributor Author

/botio test

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/be72e38f110bcc5/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/b05fadb7c2d34c8/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/be72e38f110bcc5/output.txt

Total script time: 29.47 mins

  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 2458

Image differences available at: http://54.241.84.105:8877/be72e38f110bcc5/reftest-analyzer.html#web=eq.log

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/b05fadb7c2d34c8/output.txt

Total script time: 58.58 mins

  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 2458

Image differences available at: http://54.193.163.58:8877/b05fadb7c2d34c8/reftest-analyzer.html#web=eq.log

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

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

r=me, assuming that you carefully check that there's no actual failures in the reference tests; thank you.

@calixteman
Copy link
Contributor Author

I think we should makerefs and then re-run the tests, wdyt ?

@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented Mar 4, 2025

I think we should makerefs and then re-run the tests, wdyt ?

Sure, that's probably easier than going through 2458 ref-test results :-)

@Snuffleupagus
Copy link
Collaborator

/botio browsertest

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_browsertest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/ec8b42eeca78361/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_browsertest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/fa9b4b6031ba09e/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/ec8b42eeca78361/output.txt

Total script time: 16.34 mins

  • Regression tests: Passed

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/fa9b4b6031ba09e/output.txt

Total script time: 29.40 mins

  • Regression tests: Passed

@calixteman calixteman merged commit 4693b7a into mozilla:master Mar 5, 2025
9 checks passed
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.

4 participants