Skip to content

Update intrin_wasm.hpp#25909

Merged
asmorkalov merged 9 commits intoopencv:4.xfrom
gblikas:patch-1
Oct 9, 2024
Merged

Update intrin_wasm.hpp#25909
asmorkalov merged 9 commits intoopencv:4.xfrom
gblikas:patch-1

Conversation

@gblikas
Copy link
Copy Markdown
Contributor

@gblikas gblikas commented Jul 14, 2024

See microsoft/vcpkg#33443 for some build context when using

vcpkg install opencv4:wasm32-emscripten

__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__ and __EMSCRIPTEN_tiny__ in emsdk >= 3.1.4 are in a header, as opposed to command line.

We could potentially be more aggressive with how I'm checking this property; let me know if I should make the change.

It should also be suggested that -msimd128 is auto-included in the associated portfile for opencv, but that's a separate issue. Someone let me know if I should also make that change as well.

Special thanks to https://github.com/youar for supporting this work; please inform if applying a copyright-header is appropriate attribution.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake
force_builders=Custom
build_image:Docs=docs-js
Xbuild_image:Custom=javascript
Xbuild_image:Custom=javascript-simd
build_image:Custom=javascript-simd:3.1.64
buildworker:Custom=linux-4

See microsoft/vcpkg#33443 for some build context when using `vcpkg install opencv4:wasm32-emscripten`.
@gblikas
Copy link
Copy Markdown
Contributor Author

gblikas commented Jul 15, 2024

We could potentially be more aggressive with how I'm checking this property; let me know if I should make the change.

It should also be suggested that -msimd128 is auto-included in the associated portfile for opencv, but that's a separate issue. Someone let me know if I should also make that change as well.

@opencv-alalek Any comments regarding this^^?

@gblikas
Copy link
Copy Markdown
Contributor Author

gblikas commented Jul 17, 2024

@opencv-alalek I've gone ahead and removed Line 11, #include <emscripten/version.h>, as it should not be included, if OpenCV only supports Emscripten v2.0.13. Please trigger another javascript-simd build, to verify this PR (it is then ready to merge).

Additionally, for people looking for Emscripten 3.X, the fix is involved; I'm working on it currently, but that will be another PR.

trailing whitespace
@opencv-alalek
Copy link
Copy Markdown
Contributor

FYI, Including of version.h was added here: #24288 (declared as a fix for 3.1.45)

@asmorkalov
Copy link
Copy Markdown
Contributor

I just checked current OpenCV 4.x with emscripten 3.1.61 (latest) with Ubuntu 24.04. Compilation works well.

@asmorkalov
Copy link
Copy Markdown
Contributor

The original ticket in MS tracker has reference to OpenCV 4.7.0, not fresh release. I close the PR. Please submit ticket/PR with -msimd128 option and motivation.

@asmorkalov asmorkalov closed this Jul 19, 2024
@gblikas
Copy link
Copy Markdown
Contributor Author

gblikas commented Jul 19, 2024

I believe this should be re-opened and merged:

I just checked current OpenCV 4.x with emscripten 3.1.61 (latest) with Ubuntu 24.04. Compilation works well.

@asmorkalov since emscripten/version.h was implemented in Emscripten >= 3.1.23 Emscripten Changelog 3123---092322, compilation would work with Emscripten 3.1.61, i.e. #include <emscripten/version.h> exists.

However, version.h does not exist in the (only) officially supported version of Emscripten, 2.0.13 - __EMSCRIPTEN_major__, etc. are only defined on commandline. I'm not sure how OpenCV >= 4.X would even compile with a #include <emscripten/version.h> and Emscripten 2.0.13, unless errors were converted to warnings?...

@opencv-alalek Are we saying that OpenCV >= 4.X officially supports Emscripten 3.X, and that should be preferred with OpenCV >= 4.9? If that is the case, the documentation on https://docs.opencv.org/4.10.0/d4/da1/tutorial_js_setup.html needs to be updated

The version 2.0.10 of emscripten is verified for latest WebAssembly.

Support for all versions of OpenCV 4.X and Emscripten >= 2.X would need to have the include wrapped in a ifndef __EMSCRIPTEN_major_.

@gblikas
Copy link
Copy Markdown
Contributor Author

gblikas commented Jul 25, 2024

@asmorkalov @opencv-alalek please consider re-opening this PR ^^

@asmorkalov asmorkalov reopened this Jul 26, 2024
@gblikas
Copy link
Copy Markdown
Contributor Author

gblikas commented Jul 26, 2024

@asmorkalov could you please trigger a javascript build for this PR? Looking at the logs, it looks like the failed runner is not targeting module js: https://github.com/opencv/opencv/actions/runs/10106629320/job/27949090047?pr=25909

Action run configuration 27949090047
2024-07-26T06:44:25.6903820Z -- General configuration for OpenCV 4.10.0-dev =====================================
2024-07-26T06:44:25.6908180Z --   Version control:               4.10.0-165-g0f59dfecf3
2024-07-26T06:44:25.6909050Z -- 
2024-07-26T06:44:25.6909540Z --   Platform:
2024-07-26T06:44:25.6915460Z --     Timestamp:                   2024-07-26T06:44:25Z
2024-07-26T06:44:25.6917750Z --     Host:                        Darwin 21.5.0 x86_64
2024-07-26T06:44:25.6919560Z --     CMake:                       3.20.1
2024-07-26T06:44:25.6921480Z --     CMake generator:             Ninja
2024-07-26T06:44:25.6923610Z --     CMake build tool:            /usr/local/bin/ninja
2024-07-26T06:44:25.6925650Z --     Configuration:               Release
2024-07-26T06:44:25.6927560Z --     Algorithm Hint:              ALGO_HINT_ACCURATE
2024-07-26T06:44:25.6928660Z -- 
2024-07-26T06:44:25.6929290Z --   CPU/HW features:
2024-07-26T06:44:25.6932340Z --     Baseline:                    SSE SSE2 SSE3 SSSE3 SSE4_1
2024-07-26T06:44:25.6934060Z --       requested:                 DETECT
2024-07-26T06:44:25.6937230Z --     Dispatched code generation:  SSE4_2 FP16 AVX AVX2 AVX512_SKX
2024-07-26T06:44:25.6939850Z --       requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
2024-07-26T06:44:25.6942010Z --       SSE4_2 (2 files):          + POPCNT SSE4_2
2024-07-26T06:44:25.6944610Z --       FP16 (1 files):            + POPCNT SSE4_2 FP16 AVX
2024-07-26T06:44:25.6946810Z --       AVX (9 files):             + POPCNT SSE4_2 AVX
2024-07-26T06:44:25.6949730Z --       AVX2 (38 files):           + POPCNT SSE4_2 FP16 FMA3 AVX AVX2
2024-07-26T06:44:25.6953320Z --       AVX512_SKX (8 files):      + POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
2024-07-26T06:44:25.6954850Z -- 
2024-07-26T06:44:25.6955370Z --   C/C++:
2024-07-26T06:44:25.6956690Z --     Built as dynamic libs?:      YES
2024-07-26T06:44:25.6958070Z --     C++ standard:                11
2024-07-26T06:44:25.6960640Z --     C++ Compiler:                /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  (ver 12.0.5.12050022)
2024-07-26T06:44:25.6968540Z --     C++ flags (Release):         -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
2024-07-26T06:44:25.6981660Z --     C++ flags (Debug):           -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
2024-07-26T06:44:25.6988720Z --     C Compiler:                  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
2024-07-26T06:44:25.6996220Z --     C flags (Release):           -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
2024-07-26T06:44:25.7008190Z --     C flags (Debug):             -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
2024-07-26T06:44:25.7015080Z --     Linker flags (Release):      -Wl,-dead_strip  
2024-07-26T06:44:25.7016180Z --     Linker flags (Debug):        -Wl,-dead_strip  
2024-07-26T06:44:25.7017150Z --     ccache:                      YES
2024-07-26T06:44:25.7018060Z --     Precompiled headers:         NO
2024-07-26T06:44:25.7057310Z --     Extra dependencies:
2024-07-26T06:44:25.7058120Z --     3rdparty dependencies:
2024-07-26T06:44:25.7058790Z -- 
2024-07-26T06:44:25.7059880Z --   OpenCV modules:
2024-07-26T06:44:25.7070920Z --     To be built:                 calib3d core dnn features2d flann gapi highgui imgcodecs imgproc java ml objdetect photo python3 stitching ts video videoio
2024-07-26T06:44:25.7073050Z --     Disabled:                    world
2024-07-26T06:44:25.7074720Z --     Disabled by dependency:      -
2024-07-26T06:44:25.7077720Z --     Unavailable:                 python2
2024-07-26T06:44:25.7090960Z --     Applications:                tests perf_tests examples apps
2024-07-26T06:44:25.7097210Z --     Documentation:               javadoc
2024-07-26T06:44:25.7098810Z --     Non-free algorithms:         YES
2024-07-26T06:44:25.7099440Z -- 
2024-07-26T06:44:25.7100510Z --   GUI:                           COCOA
2024-07-26T06:44:25.7101710Z --     Cocoa:                       YES
2024-07-26T06:44:25.7104060Z --     VTK support:                 YES (ver 9.1.0)
2024-07-26T06:44:25.7104920Z -- 
2024-07-26T06:44:25.7105430Z --   Media I/O: 
2024-07-26T06:44:25.7107590Z --     ZLib:                        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/lib/libz.tbd (ver 1.2.11)
2024-07-26T06:44:25.7109910Z --     JPEG:                        build-libjpeg-turbo (ver 3.0.3-70)
2024-07-26T06:44:25.7111000Z --       SIMD Support Request:      YES
2024-07-26T06:44:25.7111880Z --       SIMD Support:              NO
2024-07-26T06:44:25.7112870Z --     WEBP:                        build (ver encoder: 0x020f)
2024-07-26T06:44:25.7113960Z --     PNG:                         libpng (ver 1.6.37)
2024-07-26T06:44:25.7114930Z --       SIMD Support Request:      YES
2024-07-26T06:44:25.7116280Z --       SIMD Support:              YES (Intel SSE)
2024-07-26T06:44:25.7279810Z --     TIFF:                        libtiff (ver 42 / 4.6.0)
2024-07-26T06:44:25.7281510Z --     JPEG 2000:                   build (ver 2.5.0)
2024-07-26T06:44:25.7318950Z --     OpenEXR:                     OpenEXR::OpenEXR (ver 3.1.5)
2024-07-26T06:44:25.7319590Z --     HDR:                         YES
2024-07-26T06:44:25.7320060Z --     SUNRASTER:                   YES
2024-07-26T06:44:25.7320520Z --     PXM:                         YES
2024-07-26T06:44:25.7320960Z --     PFM:                         YES
2024-07-26T06:44:25.7321370Z -- 
2024-07-26T06:44:25.7321650Z --   Video I/O:
2024-07-26T06:44:25.7322000Z --     DC1394:                      NO
2024-07-26T06:44:25.7322450Z --     FFMPEG:                      YES
2024-07-26T06:44:25.7322960Z --       avcodec:                   YES (58.134.100)
2024-07-26T06:44:25.7323500Z --       avformat:                  YES (58.76.100)
2024-07-26T06:44:25.7324170Z --       avutil:                    YES (56.70.100)
2024-07-26T06:44:25.7324700Z --       swscale:                   YES (5.9.100)
2024-07-26T06:44:25.7325340Z --       avresample:                YES (4.0.0)
2024-07-26T06:44:25.7325860Z --     GStreamer:                   NO
2024-07-26T06:44:25.7326340Z --     AVFoundation:                YES
2024-07-26T06:44:25.7326750Z -- 
2024-07-26T06:44:25.7327060Z --   Parallel framework:            GCD
2024-07-26T06:44:25.7328160Z -- 
2024-07-26T06:44:25.7329050Z --   Trace:                         YES (with Intel ITT)
2024-07-26T06:44:25.7329840Z -- 
2024-07-26T06:44:25.7331030Z --   Other third-party libraries:
2024-07-26T06:44:25.7331610Z --     Intel IPP:                   2021.9.1 [2021.9.1]
2024-07-26T06:44:25.7333510Z --            at:                   /Users/opencv-cn/GHA-OCV-4/_work/opencv/opencv/build/3rdparty/ippicv/ippicv_mac/icv
2024-07-26T06:44:25.7335250Z --     Intel IPP IW:                sources (2021.9.1)
2024-07-26T06:44:25.7336850Z --               at:                /Users/opencv-cn/GHA-OCV-4/_work/opencv/opencv/build/3rdparty/ippicv/ippicv_mac/iw
2024-07-26T06:44:25.7340040Z --     Lapack:                      YES (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Accelerate.framework -lm -ldl)
2024-07-26T06:44:25.7342620Z --     Eigen:                       YES (ver 3.4.0)
2024-07-26T06:44:25.7343570Z --     Custom HAL:                  NO
2024-07-26T06:44:25.7344510Z --     Protobuf:                    build (3.19.1)
2024-07-26T06:44:25.7345600Z --     Flatbuffers:                 builtin/3rdparty (23.5.9)
2024-07-26T06:44:25.7346530Z -- 
2024-07-26T06:44:25.7347420Z --   OpenCL:                        YES (no extra features)
2024-07-26T06:44:25.7348110Z --     Include path:                NO
2024-07-26T06:44:25.7348660Z --     Link libraries:              -framework OpenCL
2024-07-26T06:44:25.7349630Z -- 
2024-07-26T06:44:25.7349910Z --   Python 3:
2024-07-26T06:44:25.7350410Z --     Interpreter:                 /usr/local/bin/python3 (ver 3.9.13)
2024-07-26T06:44:25.7353480Z --     Libraries:                   /usr/local/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib (ver 3.9.13)
2024-07-26T06:44:25.7354950Z --     Limited API:                 NO
2024-07-26T06:44:25.7364970Z --     numpy:                       /usr/local/lib/python3.9/site-packages/numpy/core/include (ver 1.22.4)
2024-07-26T06:44:25.7365920Z --     install path:                lib/python3.9/site-packages/cv2/python-3.9
2024-07-26T06:44:25.7366490Z -- 
2024-07-26T06:44:25.7366870Z --   Python (for build):            /usr/bin/python3
2024-07-26T06:44:25.7367350Z -- 
2024-07-26T06:44:25.7367640Z --   Java:                          
2024-07-26T06:44:25.7368180Z --     ant:                         /usr/local/bin/ant (ver 1.10.12)
2024-07-26T06:44:25.7368730Z --     Java:                        NO
2024-07-26T06:44:25.7369370Z --     JNI:                         /usr/local/include /usr/local/include /usr/local/include
2024-07-26T06:44:25.7370030Z --     Java wrappers:               YES (ANT)
2024-07-26T06:44:25.7371420Z --     Java tests:                  YES
2024-07-26T06:44:25.7371860Z -- 
2024-07-26T06:44:25.7372200Z --   Install to:                    /usr/local
2024-07-26T06:44:25.7372770Z -- -----------------------------------------------------------------

@asmorkalov
Copy link
Copy Markdown
Contributor

@gblikas I propose uncomment ifndef block. It should work for both generations of emsdk.

@gblikas
Copy link
Copy Markdown
Contributor Author

gblikas commented Jul 30, 2024

@gblikas I propose uncomment ifndef block. It should work for both generations of emsdk.

@asmorkalov I've gone ahead and uncommented the #ifndef block.

@asmorkalov
Copy link
Copy Markdown
Contributor

Run cd /home/ci/opencv
modules/core/include/opencv2/core/hal/intrin_wasm.hpp:18: trailing whitespace.
+// See https://github.com/opencv/opencv/pull/25909 
Error: Process completed with exit code 2.

@gblikas
Copy link
Copy Markdown
Contributor Author

gblikas commented Aug 2, 2024

Run cd /home/ci/opencv
modules/core/include/opencv2/core/hal/intrin_wasm.hpp:18: trailing whitespace.
+// See https://github.com/opencv/opencv/pull/25909 
Error: Process completed with exit code 2.

@asmorkalov Apologies, I'll go ahead and remove whitespaces; it's so much easier to edit directly in browser. May I petition for a bot that removes trailing whitespaces, in addition to the .git hook 😭 🤣

trailing whitespace.
@gblikas
Copy link
Copy Markdown
Contributor Author

gblikas commented Aug 2, 2024

@asmorkalov done*

@asmorkalov
Copy link
Copy Markdown
Contributor

@gblikas
Copy link
Copy Markdown
Contributor Author

gblikas commented Aug 21, 2024

CI is still broken for the simd configuration: https://pullrequest.opencv.org/buildbot/builders/precommit_custom_linux/builds/100478/steps/build/logs/stdio

@asmorkalov Not related to my changes, unless __EMSCRIPTEN_major__ is not defined; on that note, @asmorkalov could you update the CI/CD system to log emcc --version and em++ --version somewhere in the output? Right now the only line that indicates version is

--     C++ Compiler:                /opt/emsdk-portable/upstream/emscripten/em++  (ver 19.0.0)

and version 19.0.0 doesn't make sense... should be like 2.0.3...

I've gone ahead and synced forks, as it looks like I was a few behind. If the sync doesn't resolve the issue, the issue has been present for quite some time and not properly addressed.

@opencv-alalek
Copy link
Copy Markdown
Contributor

Added to the "init" step of JS builder:

++ emcc --version
shared:INFO: (Emscripten: Running sanity checks)
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.64 (a1fe3902bf73a3802eae0357d273d0e37ea79898)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

++ em++ --version
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.64 (a1fe3902bf73a3802eae0357d273d0e37ea79898)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@gblikas
Copy link
Copy Markdown
Contributor Author

gblikas commented Aug 22, 2024

Added to the "init" step of JS builder:

++ emcc --version
shared:INFO: (Emscripten: Running sanity checks)
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.64 (a1fe3902bf73a3802eae0357d273d0e37ea79898)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

++ em++ --version
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.64 (a1fe3902bf73a3802eae0357d273d0e37ea79898)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Still should not have effected the failed build @asmorkalov . Also, @alekcac so we are already of version 3.X of Emscripten?

@opencv-alalek
Copy link
Copy Markdown
Contributor

so we are already of version 3.X of Emscripten?

No. They are experimental builders (added to this PR).
Infrastructure still uses 1.39 by default.

@gblikas
Copy link
Copy Markdown
Contributor Author

gblikas commented Aug 23, 2024

so we are already of version 3.X of Emscripten?

No. They are experimental builders (added to this PR). Infrastructure still uses 1.39 by default.

So, the build issue @asmorkalov was talking about was a reflection of the code I pushed, or the result of an experimental build?

@gblikas
Copy link
Copy Markdown
Contributor Author

gblikas commented Oct 8, 2024

@opencv-alalek @asmorkalov bump*

Copy link
Copy Markdown
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

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

👍

@asmorkalov asmorkalov self-assigned this Oct 9, 2024
@asmorkalov asmorkalov added this to the 4.11.0 milestone Oct 9, 2024
@asmorkalov asmorkalov merged commit cefde84 into opencv:4.x Oct 9, 2024
@opencv-alalek opencv-alalek removed their request for review October 9, 2024 06:34
@asmorkalov asmorkalov mentioned this pull request Oct 23, 2024
ting-xin pushed a commit to ting-xin/opencv that referenced this pull request Nov 17, 2024
Update intrin_wasm.hpp opencv#25909

See microsoft/vcpkg#33443 for some build context when using 

```vcpkg install opencv4:wasm32-emscripten```

`__EMSCRIPTEN_major__`, `__EMSCRIPTEN_minor__` and `__EMSCRIPTEN_tiny__` in `emsdk` >= 3.1.4 are in a header, as opposed to command line. 

We could potentially be more aggressive with how I'm checking this property; let me know if I should make the change. 

It should also be suggested that `-msimd128` is auto-included in the associated portfile for opencv, but that's a separate issue. Someone let me know if I should also make that change as well. 

Special thanks to https://github.com/youar for supporting this work; please inform if applying a copyright-header is appropriate attribution.

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
thewoz pushed a commit to CobbsLab/OPENCV that referenced this pull request Feb 13, 2025
Update intrin_wasm.hpp opencv#25909

See microsoft/vcpkg#33443 for some build context when using 

```vcpkg install opencv4:wasm32-emscripten```

`__EMSCRIPTEN_major__`, `__EMSCRIPTEN_minor__` and `__EMSCRIPTEN_tiny__` in `emsdk` >= 3.1.4 are in a header, as opposed to command line. 

We could potentially be more aggressive with how I'm checking this property; let me know if I should make the change. 

It should also be suggested that `-msimd128` is auto-included in the associated portfile for opencv, but that's a separate issue. Someone let me know if I should also make that change as well. 

Special thanks to https://github.com/youar for supporting this work; please inform if applying a copyright-header is appropriate attribution.

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
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.

3 participants