Skip to content

Commit f802d7c

Browse files
authored
Merge branch 'main' into patch-1
2 parents db90553 + 9f9d615 commit f802d7c

File tree

450 files changed

+22501
-6804
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

450 files changed

+22501
-6804
lines changed

.circleci/config.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2.1
22

33
orbs:
4-
win: circleci/windows@1.0.0
4+
win: circleci/windows@5.0
55

66
executors:
77
linux-node:
@@ -414,6 +414,7 @@ jobs:
414414
steps:
415415
- checkout
416416
- pip-install
417+
- run: tools/maint/update_settings_docs.py --check
417418
- run: make -C site text
418419
- run: tools/maint/check_emcc_help_text.py
419420
- run: make -C site html
@@ -807,6 +808,7 @@ jobs:
807808
browser64
808809
skip:browser64.test_4gb_fail
809810
browser64_4gb.test_async_*
811+
browser64_4gb.test_audio_worklet*
810812
browser64_4gb.test_emscripten_log
811813
"
812814
test-browser-firefox:
@@ -827,8 +829,9 @@ jobs:
827829
# windows and mac do not have separate build and test jobs, as they only run
828830
# a limited set of tests; it is simpler and faster to do it all in one job.
829831
test-windows:
832+
working_directory: "~/path with spaces"
830833
executor:
831-
name: win/vs2019
834+
name: win/server-2019
832835
shell: bash.exe -eo pipefail
833836
environment:
834837
PYTHONUNBUFFERED: "1"
@@ -848,7 +851,7 @@ jobs:
848851
- run:
849852
name: Install packages
850853
command: |
851-
choco install cmake.portable ninja pkgconfiglite
854+
choco install -y cmake.portable ninja pkgconfiglite
852855
- run:
853856
name: Add python to bash path
854857
command: echo "export PATH=\"$PATH:/c/Python27amd64/\"" >> $BASH_ENV
@@ -916,10 +919,6 @@ jobs:
916919
- install-emsdk
917920
# TODO: We can't currently do pip install here since numpy and other packages
918921
# are currently missing arm64 macos binaries.
919-
# TODO: Remove this once emsdk has an arm64 version of node
920-
- run:
921-
name: Install Rosetta
922-
command: /usr/sbin/softwareupdate --install-rosetta --agree-to-license
923922
- run-tests:
924923
title: "crossplatform tests"
925924
test_targets: "--crossplatform-only"

.flake8

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[flake8]
22
ignore = E111,E114,E501,E261,E266,E121,E402,E241,W504,E741,B011,B023,U101
33
exclude =
4+
./node_modules/, # third-party code
45
./third_party/, # third-party code
56
./tools/filelock.py, # third-party code
67
./tools/scons/, # third-party code
@@ -9,7 +10,7 @@ exclude =
910
./system/lib/, # system libraries
1011
./cache/, # download/built content
1112
.git
12-
# The ports plugins have a lot of unused imports becuase
13+
# The ports plugins have a lot of unused imports because
1314
# they need to implement the specific plugin APIs
1415
per-file-ignores =
1516
./tools/ports/*.py: U100

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,3 +596,4 @@ a license to everyone to use it as detailed in LICENSE.)
596596
* 郑苏波 (Super Zheng) <[email protected]>
597597
* James Hu <[email protected]>
598598
* Jerry Zhuang <[email protected]>
599+
* Taisei Kon <[email protected]>

ChangeLog.md

Lines changed: 84 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,87 @@ to browse the changes between the tags.
1818

1919
See docs/process.md for more on how version tagging works.
2020

21-
3.1.51 (in development)
21+
3.1.53 (in development)
2222
-----------------------
23+
24+
3.1.52 - 01/19/24
25+
-----------------
26+
- The core stack manipulation functions (`stackSave`, `stackRestore`,
27+
`stackAlloc`) are no longer exported by default. Users of these function
28+
now need to depend on them explicitly (either via `__deps` attributes or via
29+
`-sEXPORTED_FUNCTIONS`). (#21075)
30+
- Building with `pthreads+EXPORT_ES6` will now emit the worker file as
31+
`NAME.worker.mjs` rather than `.js`. This is a necessary breaking change to
32+
resolve other `pthreads+EXPORT_ES6` issues in Node.js (because Node.js is
33+
affected by the suffix in some cases). (#21041)
34+
- Include paths added by ports (e.g. `-sUSE_SDL=2`) now use `-isystem` rather
35+
then `-I`. This means that files in user-specified include directories will
36+
now take precedence over port includes. (#21014)
37+
- Certain settings that only apply when generating JavaScript output will now
38+
trigger a warning if used when generating only Wasm.
39+
- Fix bug where `main` was mistakenly included in debug builds but not in
40+
release builds. (#20971)
41+
- Remove JAVA from the list of `.emscripten` config file settings. In the
42+
past we used this to run the java version of closure compiler. If there are
43+
folks who prefer to use the java version of closure compiler for some reason
44+
it should be possible by adding `--platform=java` to `--closure-args` or
45+
`EMCC_CLOSURE_ARGS` but emscripten will no longer do this automatically.
46+
(#20919)
47+
- The WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG setting was
48+
removed. This was a workaround from 2018 (#7459) that should no longer be
49+
needed. (#20925)
50+
- The `--default-obj-ext` command line flag was removed. (#20917)
51+
- emcc will now treat `.bc` files as source files. These means that will get
52+
compiled by clang before being passed to the linker. This matches the
53+
behaviour of clang. (#20922)
54+
- Emscripten now only supports browsers going back to certain versions. The
55+
current set of minimum versions are: Chrome 32, Firefox 34, Safari 9.
56+
Attempting to targets version older this using, for example
57+
`MIN_CHROME_VERSION` will now result in build-time error. All of these
58+
browser versions are at least 8 years old now so the hope is that nobody
59+
is intending to target them today. (#20924)
60+
- C++ objects passed into embind's val via constructors, methods, and call
61+
function will not be automatically destroyed after the function call. This
62+
makes the behavior consistent for invocations.
63+
- The `SUPPORT_ERRNO` setting is now deprecated as it only controlled setting
64+
errno from JS library functions and emscripten no longer requires this.
65+
(#21074)
66+
67+
3.1.51 - 12/13/23
68+
-----------------
69+
- Support for explicitly targeting the legacy Internet Explorer or EdgeHTML
70+
(edge version prior to the chromium-based edge) browsers via
71+
`-sMIN_EDGE_VERSION/-sMIN_IE_VERSION` was removed. (#20881)
72+
- Emscripten is now more strict about handling unsupported shared library
73+
inputs. For example, under the old behaviour if a system shared library
74+
such as `/usr/lib/libz.so` was passed to emscripten it would silently re-write
75+
this to `-lz`, which would then search this a libz in its own sysroot. Now
76+
this file is passed though the linker like any other input file and you will
77+
see an `unknown file type` error from the linker (just like you would with the
78+
native clang or gcc toolchains). (#20886)
79+
- Support for explicitly targeting the legacy EdgeHTML browser (edge version
80+
prior to the chromium-based edge) via `-sMIN_EDGE_VERSION` was removed.
81+
Using `-sLEGACY_VM_SUPPORT` should still work if anyone still wanted to target
82+
this or any other legacy browser.
2383
- Breaking change: Using the `*glGetProcAddress()` family of functions now
2484
requires passing a linker flag -sGL_ENABLE_GET_PROC_ADDRESS. This prevents
2585
ports of native GL renderers from later accidentally attempting to activate
2686
"dormant" features if web browser implementations gain new WebGL extensions in
2787
the future, which `*glGetProcAddress()` is not able to support. (#20802)
88+
- Added Hi DPI support to GLFW. When enabled, GLFW automatically accounts for
89+
the `devicePixelRatio` browser property and changes the size of the canvas
90+
accordingly (including dynamically if the canvas is moved from a 4K screen to
91+
a 2K screen and vice-versa). `glfwGetFramebufferSize` now properly returns the
92+
canvas size in pixels, while `glfwGetWindowSize` returns the canvas size is
93+
screen size. By default, this feature is disabled. You can enable it before
94+
creating a window by calling `glfwWindowHint(GLFW_SCALE_TO_MONITOR,
95+
GLFW_TRUE)`. You can also dynamically change it after the window has been
96+
created by calling `glfwSetWindowAttrib(window, GLFW_SCALE_TO_MONITOR,
97+
GLFW_TRUE)`. (#20584)
98+
- Transpilation to support older environments/browsers is now performed by babel
99+
rather than closure compiler. This means that folks targeting older browsers
100+
(e.g. `-sLEGACY_VM_SUPPORT`) do not need to ensure their code is closure
101+
compliant. (#20879)
28102

29103
3.1.50 - 11/29/23
30104
-----------------
@@ -38,8 +112,8 @@ See docs/process.md for more on how version tagging works.
38112
the `DEFAULT_TO_CXX` setting now only applies when linking and not when
39113
compiling. (#20712)
40114
- JavaScript library code can now use the full range of ES6 features and we rely
41-
on closure compiler to transpile for ES5 when targetting older browsers.
42-
For those that would rather perform transpilation seperately outside of
115+
on closure compiler to transpile for ES5 when targeting older browsers.
116+
For those that would rather perform transpilation separately outside of
43117
emscripten you can use the `-sPOLYFILL=0` setting. (#20700)
44118
- libcxx, libcxxabi, libunwind, and compiler-rt were updated to LLVM 17.0.4.
45119
(#20705, #20707, and #20708)
@@ -71,7 +145,7 @@ See docs/process.md for more on how version tagging works.
71145
JavaScript code. (#20551)
72146
- A new top-level `bootstrap` script was added. This script is for emscripten
73147
developers and helps take a care of post-checkout tasks such as `npm install`.
74-
If this script needs to be run (e.g. becuase package.json was changed, emcc
148+
If this script needs to be run (e.g. because package.json was changed, emcc
75149
will exit with an error. (#19736)
76150
- If exceptions are disabled, using `new` together with `std::nothrow` no
77151
longer aborts if the allocation fails. Instead `nullptr` is returned now.
@@ -115,7 +189,7 @@ See docs/process.md for more on how version tagging works.
115189
-----------------
116190
- The `wasmTable` global is now a JS library function that will only be included
117191
as needed. Code that references `wasmTable` will no need to declare a
118-
dependency on it. It can also be explictly included using
192+
dependency on it. It can also be explicitly included using
119193
`-sEXPORTED_RUNTIME_METHODS=wasmTable`.
120194
- libunwind updated to LLVM 16.0.6. (#20088)
121195
- The `--minify=0` commnad line flag will now preserve comments as well as
@@ -132,7 +206,7 @@ See docs/process.md for more on how version tagging works.
132206
- The `USE_GLFW` settings now defaults to 0 rather than 2. This matches other
133207
other settings such as `USE_SDL` that default to 0 these days and also matches
134208
the existing behaviour for `MINIMAL_RUNTIME` and `STRICT` mode.
135-
If you use GLFW you now need to explictly opt into it using `-sUSE_GLFW` or
209+
If you use GLFW you now need to explicitly opt into it using `-sUSE_GLFW` or
136210
`-lglfw`. (#19939)
137211
- A new settings `TABLE_BASE` was introduced that can be used to place static
138212
function addresses (table slots) at a certain offset. This defaults to 1
@@ -182,7 +256,7 @@ See docs/process.md for more on how version tagging works.
182256
`-sMIN_NODE_VERSION=101900` which will apply the previous minimum version of
183257
10.19.0. (#19192).
184258
- The log message that emcc will sometime print (for example when auto-building
185-
system libraries) can now be completely supressed by running with
259+
system libraries) can now be completely suppressed by running with
186260
`EMCC_LOGGING=0`.
187261
- Runtime dynamic linking symbols such as dlopen and dlsym will no longer cause
188262
a linker error when building without `-sMAIN_MODULE`. Instead stub functions
@@ -259,13 +333,13 @@ See docs/process.md for more on how version tagging works.
259333
- stringToUTF8
260334
- lengthBytesUTF8
261335
If you use any of these functions in your JS code you will now need to include
262-
them explictly in one of the following ways:
336+
them explicitly in one of the following ways:
263337
- Add them to a `__deps` entry in your JS library file (with leading $)
264338
- Add them to `DEFAULT_LIBRARY_FUNCS_TO_INCLUDE` (with leading $)
265339
- Add them to `EXPORTED_FUNCTIONS` (without leading $)
266340
- Set `-sLEGACY_RUNTIME` to include all of them at once.
267341
- `FS.loadFilesFromDB` and `FS.saveFilesToDB` were removed. We think it's
268-
unlikly there were any users of these functions since there is now a separate
342+
unlikely there were any users of these functions since there is now a separate
269343
IDBFS filesystem for folks that want persistence. (#19049)
270344
- `allocateUTF8` and `allocateUTF8OnStack` library function moved to
271345
`library_legacy.js`. Prefer the more accurately named `stringToNewUTF8` and
@@ -286,7 +360,7 @@ See docs/process.md for more on how version tagging works.
286360
- Fix for using `EM_JS` functions defined in other object files. This was a bug
287361
that was introduced when `LLD_REPORT_UNDEFINED` was enabled by default back in
288362
3.1.28. (#18928)
289-
- The prefered way to enable pthread is now to just the the standard `-pthread`
363+
- The preferred way to enable pthreads is now to just use the standard `-pthread`
290364
flag. The `-sUSE_PTHREADS` setting still works but is marked as legacy and
291365
will generate a warning in `-sSTRICT` mode.
292366
- When targeting node, and using `-sMODULARIZE`, we no longer internally catch

bootstrap.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

bootstrap.py

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,37 @@
2020
from tools import shared, utils
2121

2222
actions = [
23-
('npm packages', 'package.json', [shutil.which('npm'), 'ci']),
24-
# TODO(sbc): Remove the checked in entry point files and have them
25-
# built on demand by this step.
26-
('create entry points', 'tools/maint/create_entry_points.py', [sys.executable, 'tools/maint/create_entry_points.py']),
27-
('git submodules', 'test/third_party/posixtestsuite/', [shutil.which('git'), 'submodule', 'update', '--init']),
23+
('npm packages', ['package.json'], [shutil.which('npm'), 'ci']),
24+
('create entry points', [
25+
'tools/maint/create_entry_points.py',
26+
'tools/maint/run_python.bat',
27+
'tools/maint/run_python.sh',
28+
'tools/maint/run_python.ps1',
29+
],
30+
[sys.executable, 'tools/maint/create_entry_points.py']),
31+
('git submodules', ['test/third_party/posixtestsuite/'], [shutil.which('git'), 'submodule', 'update', '--init']),
2832
]
2933

3034

3135
def get_stamp_file(action_name):
3236
return os.path.join(STAMP_DIR, action_name.replace(' ', '_') + '.stamp')
3337

3438

39+
def check_deps(name, deps):
40+
stamp_file = get_stamp_file(name)
41+
if not os.path.exists(stamp_file):
42+
return False
43+
for dep in deps:
44+
dep = utils.path_from_root(dep)
45+
if os.path.getmtime(dep) > os.path.getmtime(stamp_file):
46+
return False
47+
return True
48+
49+
3550
def check():
36-
for name, filename, _ in actions:
37-
stamp_file = get_stamp_file(name)
38-
filename = utils.path_from_root(filename)
39-
if not os.path.exists(stamp_file) or os.path.getmtime(filename) > os.path.getmtime(stamp_file):
40-
utils.exit_with_error(f'emscripten setup is not complete ("{name}" is out-of-date). Run bootstrap.py to update')
51+
for name, deps, _ in actions:
52+
if not check_deps(name, deps):
53+
utils.exit_with_error(f'emscripten setup is not complete ("{name}" is out-of-date). Run `bootstrap` to update')
4154

4255

4356
def main(args):
@@ -46,13 +59,12 @@ def main(args):
4659
parser.add_argument('-n', '--dry-run', action='store_true', help='dry run', default=False)
4760
args = parser.parse_args()
4861

49-
for name, filename, cmd in actions:
50-
stamp_file = get_stamp_file(name)
51-
filename = utils.path_from_root(filename)
52-
if os.path.exists(stamp_file) and os.path.getmtime(filename) <= os.path.getmtime(stamp_file):
62+
for name, deps, cmd in actions:
63+
if check_deps(name, deps):
5364
print('Up-to-date: %s' % name)
5465
continue
5566
print('Out-of-date: %s' % name)
67+
stamp_file = get_stamp_file(name)
5668
if args.dry_run:
5769
print(' (skipping: dry run) -> %s' % ' '.join(cmd))
5870
return

cmake/Modules/Platform/Emscripten.cmake

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# line parameters:
77
# cmake -DCMAKE_TOOLCHAIN_FILE=<EmscriptenRoot>/cmake/Modules/Platform/Emscripten.cmake
88
# -DCMAKE_BUILD_TYPE=<Debug|RelWithDebInfo|Release|MinSizeRel>
9-
# -G "Unix Makefiles" (Linux and OSX)
9+
# -G "Unix Makefiles" (Linux and macOS)
1010
# -G "MinGW Makefiles" (Windows)
1111
# <path/to/CMakeLists.txt> # Note, pass in here ONLY the path to the file, not the filename 'CMakeLists.txt' itself.
1212

@@ -354,35 +354,6 @@ function(em_link_post_js target)
354354
em_add_link_deps(${target} "--post-js" ${ARGN})
355355
endfunction()
356356

357-
# Experimental support for targeting generation of Visual Studio project files
358-
# (vs-tool) of Emscripten projects for Windows. To use this, pass the
359-
# combination -G "Visual Studio 10" -DCMAKE_TOOLCHAIN_FILE=Emscripten.cmake
360-
if ("${CMAKE_GENERATOR}" MATCHES "^Visual Studio.*")
361-
# By default, CMake generates VS project files with a
362-
# <GenerateManifest>true</GenerateManifest> directive.
363-
# This causes VS to attempt to invoke rc.exe during the build, which will fail
364-
# since app manifests are meaningless for Emscripten. To disable this, add
365-
# the following linker flag. This flag will not go to emcc, since the Visual
366-
# Studio CMake generator will swallow it.
367-
set(EMSCRIPTEN_VS_LINKER_FLAGS "/MANIFEST:NO")
368-
# CMake is hardcoded to write a ClCompile directive
369-
# <ObjectFileName>$(IntDir)</ObjectFileName> in all VS project files it
370-
# generates. This makes VS pass emcc a -o param that points to a directory
371-
# instead of a file, which causes emcc autogenerate the output filename.
372-
# CMake is hardcoded to assume all object files have the suffix .obj, so
373-
# adjust the emcc-autogenerated default suffix name to match.
374-
set(EMSCRIPTEN_VS_LINKER_FLAGS "${EMSCRIPTEN_VS_LINKER_FLAGS} --default-obj-ext .obj")
375-
# Also hint CMake that it should not hardcode <ObjectFileName> generation.
376-
# Requires a custom CMake build for this to work (ignored on others)
377-
# See http://www.cmake.org/Bug/view.php?id=14673 and https://github.com/juj/CMake
378-
set(CMAKE_VS_NO_DEFAULT_OBJECTFILENAME 1)
379-
380-
# Apply and cache Emscripten Visual Studio IDE-specific linker flags.
381-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EMSCRIPTEN_VS_LINKER_FLAGS}" CACHE STRING "")
382-
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${EMSCRIPTEN_VS_LINKER_FLAGS}" CACHE STRING "")
383-
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${EMSCRIPTEN_VS_LINKER_FLAGS}" CACHE STRING "")
384-
endif()
385-
386357
if (NOT DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
387358
find_program(NODE_JS_EXECUTABLE NAMES nodejs node)
388359
if(NODE_JS_EXECUTABLE)

docs/emcc.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,6 @@ Options that are modified or new in *emcc* are listed below:
268268
before the closure-compiled code runs, because then it will
269269
reuse that variable.
270270

271-
* If closure compiler hits an out-of-memory, try adjusting
272-
"JAVA_HEAP_SIZE" in the environment (for example, to 4096m for
273-
4GB).
274-
275271
* Closure is only run if JavaScript opts are being done ("-O2" or
276272
above).
277273

@@ -569,13 +565,6 @@ Options that are modified or new in *emcc* are listed below:
569565
the user's home directory ("~/.emscripten"). This can be overridden
570566
using the "EM_CONFIG" environment variable.
571567

572-
"--default-obj-ext <.ext>"
573-
[compile] Specifies the output suffix to use when compiling with
574-
"-c" in the absence of "-o". For example, when compiling multiple
575-
sources files with "emcc -c *.c" the compiler will normally output
576-
files with the ".o" extension, but "--default-obj-ext .obj" can be
577-
used to instead generate files with the *.obj* extension.
578-
579568
"--valid-abspath <path>"
580569
[compile+link] Note an allowed absolute path, which we should not
581570
warn about (absolute include paths normally are warned about, since

docs/process.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Development Processes
22

3+
More information can be found in the [Contribution
4+
section](https://emscripten.org/docs/contributing/contributing.html) of the
5+
webside.
36

47
## Landing PRs
58

0 commit comments

Comments
 (0)