[opencv] -> target wasm; build fail

rustc 1.40.0 [stable]

When I try to build OpenCV(4.2) with cargo for target "x86_64-unkown-linux-gnu' it works without any problem, but when I try to build for target "wasm32-unkown-unkown" or "wasm32-unkown-emscripten" it fails.

Why is that? Is there a working rust-wasm opencv version? (I found working version with C++ emscripten)

example try to build with wasm-pack

rustup run stable wasm-pack build --release

opencv_version on system is 4.2.0

build log

[INFO]: Checking for the Wasm target...
....
error: failed to run custom build command for `opencv v0.29.0`

Caused by:
  process didn't exit successfully: `/home/horky/ch03-bindgen/target/release/build/opencv-65897222609c9aae/build-script-build` (exit code: 1)
--- stdout
cargo:rustc-link-search=native=/usr/lib
cargo:rustc-link-lib=opencv_gapi
cargo:rustc-link-lib=opencv_stitching
cargo:rustc-link-lib=opencv_aruco
cargo:rustc-link-lib=opencv_bgsegm
cargo:rustc-link-lib=opencv_bioinspired
cargo:rustc-link-lib=opencv_ccalib
cargo:rustc-link-lib=opencv_cvv
cargo:rustc-link-lib=opencv_dnn_objdetect
cargo:rustc-link-lib=opencv_dnn_superres
cargo:rustc-link-lib=opencv_dpm
cargo:rustc-link-lib=opencv_highgui
cargo:rustc-link-lib=opencv_face
cargo:rustc-link-lib=opencv_freetype
cargo:rustc-link-lib=opencv_fuzzy
cargo:rustc-link-lib=opencv_hdf
cargo:rustc-link-lib=opencv_hfs
cargo:rustc-link-lib=opencv_img_hash
cargo:rustc-link-lib=opencv_line_descriptor
cargo:rustc-link-lib=opencv_quality
cargo:rustc-link-lib=opencv_reg
cargo:rustc-link-lib=opencv_rgbd
cargo:rustc-link-lib=opencv_saliency
cargo:rustc-link-lib=opencv_stereo
cargo:rustc-link-lib=opencv_structured_light
cargo:rustc-link-lib=opencv_phase_unwrapping
cargo:rustc-link-lib=opencv_superres
cargo:rustc-link-lib=opencv_optflow
cargo:rustc-link-lib=opencv_surface_matching
cargo:rustc-link-lib=opencv_tracking
cargo:rustc-link-lib=opencv_datasets
cargo:rustc-link-lib=opencv_text
cargo:rustc-link-lib=opencv_dnn
cargo:rustc-link-lib=opencv_plot
cargo:rustc-link-lib=opencv_videostab
cargo:rustc-link-lib=opencv_videoio
cargo:rustc-link-lib=opencv_viz
cargo:rustc-link-lib=opencv_xfeatures2d
cargo:rustc-link-lib=opencv_shape
cargo:rustc-link-lib=opencv_ml
cargo:rustc-link-lib=opencv_ximgproc
cargo:rustc-link-lib=opencv_video
cargo:rustc-link-lib=opencv_xobjdetect
cargo:rustc-link-lib=opencv_objdetect
cargo:rustc-link-lib=opencv_calib3d
cargo:rustc-link-lib=opencv_imgcodecs
cargo:rustc-link-lib=opencv_features2d
cargo:rustc-link-lib=opencv_flann
cargo:rustc-link-lib=opencv_xphoto
cargo:rustc-link-lib=opencv_photo
cargo:rustc-link-lib=opencv_imgproc
cargo:rustc-link-lib=opencv_core
cargo:rerun-if-changed=hdr_parser.py
cargo:rerun-if-changed=gen_rust.py
cargo:rerun-if-env-changed=OPENCV_HEADER_DIR
cargo:rerun-if-env-changed=OPENCV_PACKAGE_NAME
cargo:rerun-if-env-changed=OPENCV_PKGCONFIG_NAME
cargo:rerun-if-env-changed=OPENCV_LINK_LIBS
cargo:rerun-if-env-changed=OPENCV_LINK_PATHS
cargo:rerun-if-env-changed=OPENCV_INCLUDE_PATHS
...
Generating module 'freetype' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/freetype.hpp
Generating module 'bgsegm' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/bgsegm.hpp
Generating module 'imgproc' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/imgproc.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/imgproc/detail/gcgraph.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/imgproc/hal/interface.h
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/imgproc/imgproc.hpp
Generating module 'superres' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/superres.hpp
Generating module 'structured_light' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/structured_light.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/structured_light/graycodepattern.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/structured_light/sinusoidalpattern.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/structured_light/structured_light.hpp
Generating module 'dnn' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/dnn.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/dnn/all_layers.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/dnn/dict.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/dnn/dnn.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/dnn/layer.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/dnn/shape_utils.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/dnn/utils/inference_engine.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/dnn/version.hpp
Generating module 'line_descriptor' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/line_descriptor.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/line_descriptor/descriptor.hpp
Generating module 'bioinspired' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/bioinspired.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/bioinspired/bioinspired.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/bioinspired/retina.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/bioinspired/retinafasttonemapping.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/bioinspired/transientareassegmentationmodule.hpp
Generating module 'aruco' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/aruco/dictionary.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/aruco.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/aruco/charuco.hpp
Generating module 'video' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/video.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/video/background_segm.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/video/tracking.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/video/video.hpp
Generating module 'dnn_superres' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/dnn_superres.hpp
Generating module 'phase_unwrapping' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/phase_unwrapping.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/phase_unwrapping/histogramphaseunwrapping.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/phase_unwrapping/phase_unwrapping.hpp
Generating module 'plot' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/plot.hpp
Generating module 'videostab' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/videostab.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/videostab/deblurring.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/videostab/fast_marching.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/videostab/fast_marching_inl.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/videostab/frame_source.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/videostab/global_motion.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/videostab/inpainting.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/videostab/log.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/videostab/motion_core.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/videostab/motion_stabilizing.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/videostab/optical_flow.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/videostab/outlier_rejection.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/videostab/ring_buffer.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/videostab/stabilizer.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/videostab/wobble_suppression.hpp
Generating module 'videoio' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/videoio.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/videoio/registry.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/videoio/videoio.hpp
Generating module 'xfeatures2d' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/xfeatures2d.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/xfeatures2d/nonfree.hpp
Generating module 'photo' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/photo.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/photo/photo.hpp
Generating module 'ml' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/ml.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/ml/ml.hpp
Generating module 'sfm' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/sfm.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/sfm/conditioning.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/sfm/fundamental.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/sfm/io.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/sfm/numeric.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/sfm/projection.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/sfm/reconstruct.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/sfm/robust.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/sfm/simple_pipeline.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/sfm/triangulation.hpp
Generating module 'shape' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/shape.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/shape/emdL1.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/shape/hist_cost.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/shape/shape.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/shape/shape_distance.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/shape/shape_transformer.hpp
Generating module 'viz' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/viz/types.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/viz/widgets.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/viz.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/viz/viz3d.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/viz/vizcore.hpp
Generating module 'xobjdetect' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/xobjdetect.hpp
Generating module 'xphoto' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/xphoto.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/xphoto/bm3d_image_denoising.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/xphoto/dct_image_denoising.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/xphoto/inpainting.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/xphoto/oilpainting.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/xphoto/tonemap.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/xphoto/white_balance.hpp
Generating module 'objdetect' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/objdetect.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/objdetect/detection_based_tracker.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/objdetect/objdetect.hpp
Generating module 'core' from headers:
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/cvdef.h
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/version.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/base.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/traits.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/matx.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/types.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/mat.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/persistence.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/affine.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/async.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/bindings_utils.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/bufferpool.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/check.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/core.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/cv_cpu_helper.h
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/detail/async_promise.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/detail/exception_ptr.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/directx.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/hal/interface.h
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/hal/msa_macros.h
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/hal/simd_utils.impl.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/neon_utils.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/ocl.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/ocl_genbase.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/optim.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/ovx.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/saturate.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/simd_intrinsics.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/softfloat.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/sse_utils.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/utility.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/utils/allocator_stats.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/utils/instrumentation.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/utils/logger.defines.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/utils/logger.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/utils/logtag.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/utils/tls.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/va_intel.hpp
	/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2/core/vsx_utils.hpp
TARGET = Some("wasm32-unknown-unknown")
OPT_LEVEL = Some("3")
HOST = Some("x86_64-unknown-linux-gnu")
CXX_wasm32-unknown-unknown = None
CXX_wasm32_unknown_unknown = None
TARGET_CXX = None
CXX = None
CXXFLAGS_wasm32-unknown-unknown = None
CXXFLAGS_wasm32_unknown_unknown = None
TARGET_CXXFLAGS = None
CXXFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CXX_wasm32-unknown-unknown = None
CXX_wasm32_unknown_unknown = None
TARGET_CXX = None
CXX = None
CXXFLAGS_wasm32-unknown-unknown = None
CXXFLAGS_wasm32_unknown_unknown = None
TARGET_CXXFLAGS = None
CXXFLAGS = None
CRATE_CC_NO_DEFAULTS = None
CXX_wasm32-unknown-unknown = None
CXX_wasm32_unknown_unknown = None
TARGET_CXX = None
CXX = None
CXXFLAGS_wasm32-unknown-unknown = None
CXXFLAGS_wasm32_unknown_unknown = None
TARGET_CXXFLAGS = None
CXXFLAGS = None
CRATE_CC_NO_DEFAULTS = None
CXX_wasm32-unknown-unknown = None
CXX_wasm32_unknown_unknown = None
TARGET_CXX = None
CXX = None
CXXFLAGS_wasm32-unknown-unknown = None
CXXFLAGS_wasm32_unknown_unknown = None
TARGET_CXXFLAGS = None
CXXFLAGS = None
CRATE_CC_NO_DEFAULTS = None
CXX_wasm32-unknown-unknown = None
CXX_wasm32_unknown_unknown = None
TARGET_CXX = None
CXX = None
CXXFLAGS_wasm32-unknown-unknown = None
CXXFLAGS_wasm32_unknown_unknown = None
TARGET_CXXFLAGS = None
CXXFLAGS = None
CRATE_CC_NO_DEFAULTS = None
CXX_wasm32-unknown-unknown = None
CXX_wasm32_unknown_unknown = None
TARGET_CXX = None
CXX = None
CXXFLAGS_wasm32-unknown-unknown = None
CXXFLAGS_wasm32_unknown_unknown = None
TARGET_CXXFLAGS = None
CXXFLAGS = None
CRATE_CC_NO_DEFAULTS = None
running: "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-I" "/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4" "-I" "/home/horky/ch03-bindgen/target/wasm32-unknown-unknown/release/build/opencv-5bec079f3e0749b1/out" "-I" "." "-Wall" "-Wextra" "-std=c++11" "-o" "/home/horky/ch03-bindgen/target/wasm32-unknown-unknown/release/build/opencv-5bec079f3e0749b1/out/core.o" "-c" "/home/horky/ch03-bindgen/target/wasm32-unknown-unknown/release/build/opencv-5bec079f3e0749b1/out/core.cpp"
cargo:warning=/home/horky/ch03-bindgen/target/wasm32-unknown-unknown/release/build/opencv-5bec079f3e0749b1/out/core.cpp:3:10: fatal error: 'string' file not found
cargo:warning=#include <string>
cargo:warning=         ^~~~~~~~
cargo:warning=1 error generated.
exit code: 1
running: "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-I" "/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4" "-I" "/home/horky/ch03-bindgen/target/wasm32-unknown-unknown/release/build/opencv-5bec079f3e0749b1/out" "-I" "." "-Wall" "-Wextra" "-std=c++11" "-o" "/home/horky/ch03-bindgen/target/wasm32-unknown-unknown/release/build/opencv-5bec079f3e0749b1/out/aruco.o" "-c" "/home/horky/ch03-bindgen/target/wasm32-unknown-unknown/release/build/opencv-5bec079f3e0749b1/out/aruco.cpp"
cargo:warning=/home/horky/ch03-bindgen/target/wasm32-unknown-unknown/release/build/opencv-5bec079f3e0749b1/out/aruco.cpp:3:10: fatal error: 'string' file not found
cargo:warning=#include <string>
cargo:warning=         ^~~~~~~~
cargo:warning=1 error generated.
exit code: 1

--- stderr
=== Setting up OpenCV library from pkg_config
=== OpenCV library configuration: Library {
    pkg_name: "opencv4",
    libs: [
        "opencv_gapi",
        "opencv_stitching",
        "opencv_aruco",
        "opencv_bgsegm",
        "opencv_bioinspired",
        "opencv_ccalib",
        "opencv_cvv",
        "opencv_dnn_objdetect",
        "opencv_dnn_superres",
        "opencv_dpm",
        "opencv_highgui",
        "opencv_face",
        "opencv_freetype",
        "opencv_fuzzy",
        "opencv_hdf",
        "opencv_hfs",
        "opencv_img_hash",
        "opencv_line_descriptor",
        "opencv_quality",
        "opencv_reg",
        "opencv_rgbd",
        "opencv_saliency",
        "opencv_stereo",
        "opencv_structured_light",
        "opencv_phase_unwrapping",
        "opencv_superres",
        "opencv_optflow",
        "opencv_surface_matching",
        "opencv_tracking",
        "opencv_datasets",
        "opencv_text",
        "opencv_dnn",
        "opencv_plot",
        "opencv_videostab",
        "opencv_videoio",
        "opencv_viz",
        "opencv_xfeatures2d",
        "opencv_shape",
        "opencv_ml",
        "opencv_ximgproc",
        "opencv_video",
        "opencv_xobjdetect",
        "opencv_objdetect",
        "opencv_calib3d",
        "opencv_imgcodecs",
        "opencv_features2d",
        "opencv_flann",
        "opencv_xphoto",
        "opencv_photo",
        "opencv_imgproc",
        "opencv_core",
    ],
    link_paths: [
        "/usr/lib",
    ],
    framework_paths: [],
    include_paths: [
        "/usr/include/opencv4",
    ],
    version: "4.2.0",
    prefix: "/usr",
    libdir: "/usr/lib",
}
=== Found OpenCV library version: 4.2.0 in headers located at: /home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4
=== Using OpenCV headers from: /home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4/opencv2
=== Generating code in: /home/horky/ch03-bindgen/target/wasm32-unknown-unknown/release/build/opencv-5bec079f3e0749b1/out


error occurred: Command "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-I" "/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.29.0/headers/4" "-I" "/home/horky/ch03-bindgen/target/wasm32-unknown-unknown/release/build/opencv-5bec079f3e0749b1/out" "-I" "." "-Wall" "-Wextra" "-std=c++11" "-o" "/home/horky/ch03-bindgen/target/wasm32-unknown-unknown/release/build/opencv-5bec079f3e0749b1/out/core.o" "-c" "/home/horky/ch03-bindgen/target/wasm32-unknown-unknown/release/build/opencv-5bec079f3e0749b1/out/core.cpp" with args "clang" did not execute successfully (status code exit code: 1).



warning: build failed, waiting for other jobs to finish...
error: build failed
Error: Compiling your crate to WebAssembly failed
Caused by: failed to execute `cargo build`: exited with exit code: 101
make: *** [Makefile:18: pkg/] Error 1

I have managed to get a bit further with Emscripten:

cargo build --release --verbose --target=wasm32-unknown-emscripten

It fails on a strange error at link time:

wasm-ld: error: unknown file type: errno-loc.o

The same happens if I use opencv-rust and override OPENCV_LINK_LIBS to point to Emscripten build OpenCV libs.

2 Likes

@rustacean123 Thank You, for effort.
I made a simple working example with EMSCRIPTEN, but still not sure how to link OpenCV wasm libs via rustc, to make it work :sleepy:

1 Like

@rustacean123 build OpenCV to Emscripten/Wasm target is here, https://github.com/Horki/lanelines_wasm_emscripten/blob/master/BUILD.md.
Still not sure how to link it with to rust-wasm target.

1 Like