Skip to content

opencv.js - docker build throws Unexpected string #19198

@Ziachnix

Description

@Ziachnix
System information (version)
  • OpenCV => 4.5.1-pre
  • Operating System / Platform => js/asm
  • Compiler => emscripten/emsdk:latest and emscripten/emsdk:2.0.10
  • Docker => 3.0.0
  • http-server => v0.12.3
Detailed description

Building opencv.js with the docker image 'emscripten/emsdk:2.0.10' and 'emscripten/emsdk' produces a not correctly encoded opencv.js file.
It seems that the encoding in /modules/js/src/make_umd.py is responsible for the incorrect output.

Steps to reproduce

Build opencv.js with docker and 'emscripten/emsdk' from source as descriped in the Opencv.js tutorial.
The generated opencv.js file contains escape sequences and produces Uncaught SyntaxError: Unexpected string when loaded in the generated tests.html.
Used commands:

git clone https://github.com/opencv/opencv.git
cd opencv
docker run --rm --workdir /src -v "$(get-location):/src" "emscripten/emsdk" emcmake python3 ./platforms/js/build_js.py build_js --build_test
npx http-server build_js/bin
firefox http://localhost:8080/tests.html

Attachment:
bin.zip contains the whole bin folder of the build.
opencv.js.zip contains just the built opencv.js.

Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    answers.opencv.org, Stack Overflow, etc and have not found solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions