-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Compile libpng with shared memory when using pthreads #16701
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
Conversation
I don't know for sure about browser support, but it's definitely a bug if they don't support this. |
Is there a typo in this sentence? I though that whole point was to build things with pthread support and they would be usable in all builds (both pthread and non-pthread builds). |
I'm sorry to go back on my previous suggestions, but I think making a |
RE: browser support caniuse states that atomics is available in the latest major browsers, except that in Safari it is gated behind COOP/COEP response headers. The site states that Android chrome/ff has it disabled... but this bug suggests otherwise. I reported this as a bug in the browser compat data. Anecdotally I've definitely been able to use emscripten applications built with pthreads on my android Chrome and FF browsers.
No worries! I'll make the requested changes. |
611651a
to
77e782c
Compare
FWIW, that caniuse page is about the |
not sure why CI is failing, this test is passing for me locally (on mac):
could someone help me diagnose? CI just says |
77e782c
to
16dda51
Compare
It looks like it's failing with:
Adding this entry: 'libpng-mt': ('libpng', {'USE_PTHREADS': 1}), to the dictionary here: Line 64 in 7e9a238
should fix that. |
tools/ports/libpng.py
Outdated
ports.build_port(dest_path, final, flags=['-sUSE_ZLIB=1'], exclude_files=['pngtest'], exclude_dirs=['scripts', 'contrib']) | ||
flags = ['-sUSE_ZLIB=1'] | ||
if settings.USE_PTHREADS: | ||
flags += ['-sSHARED_MEMORY=1'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not USE_PTHREADS like the other ports do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was following the suggestion of @kleisauke
libpng doesn't use pthreads, it just needs to be built with shared memory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but I think that is probably true for most of the ports that have -mt
builds. I don't know of any of them that actually start threads.. they just use atomics and pthread locks to make themselves thread safe.
I don't feel strongly but I think it would be better to be consistent across ports on this.
Looks like the main thing is to add to PORT_VARIANTS so that this change can land. |
16dda51
to
5eb25ca
Compare
|
Fixes #16681
Bisect here
This patch always builds libpng with-pthread
. The alternative is to build a-mt
variant, but the last time this issue happened @sbc100 suggested this as the better approach.This patch builds a
-mt
variant with shared memory iff USE_PTHREAD is defined.