twistedfall / opencv-rust

Rust bindings for OpenCV 3 & 4
MIT License
2.02k stars 161 forks source link

Build fails on ubuntu 22.04 #464

Closed hsyan2008 closed 1 year ago

hsyan2008 commented 1 year ago

ubuntu 22.04 opencv--4.7.0 rustc 1.71.0-nightly (2f6bc5d25 2023-05-09)

build command:cargo build --release --target x86_64-unknown-linux-musl

Here's a snippet from compile output:

error: failed to run custom build command for opencv v0.81.2
Caused by:
process didn't exit successfully: /rust/zhipin/target/release/build/opencv-80b3be9f94eab67d/build-script-build (exit status: 101)
--- stdout
=== Running: CARGO_TARGET_DIR="/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo" "build" "--release" "--package" "opencv-binding-generator" "--bin" "binding-generator"
.... .... .... === Running: "/rust/zhipin/targethread '' panicked at 'Can't run bindings generator: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81. 2/build/generator.rs:101:50
t/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out/release/binding-generator" "/opt/opencv/include/opencv4" "/root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/src_cpp" "/rust/zhipin/target/x86_6 4-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out" "text" ""
=== Running: "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out/release/binding-generator" "/opt/opencv/include/opencv4" "/root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/src _cpp" "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out" "stitching" ""
thread '' panicked at 'Can't run bindings generator: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/build/generator.rs:101:50
=== Running: "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out/release/binding-generator" "/opt/opencv/include/opencv4" "/root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/src _cpp" "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out" "video" ""
=== Running: "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out/release/binding-generator" "/opt/opencv/include/opencv4" "/root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/src _cpp" "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out" "superres" ""
thread '' panicked at 'Can't run bindings generator: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/build/generator.rs:101:50
=== Running: "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out/release/binding-generator" "/opt/opencv/include/opencv4" "/root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/src_cpp" "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out" "videoio" ""
thread '' panicked at 'Can't run bindings generator: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/build/generator.rs:101:50
=== Running: "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out/release/binding-generator" "/opt/opencv/include/opencv4" "/root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/src _cpp" "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out" "tracking" ""
thread '' panicked at 'Can't run bindings generator: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/build/generator.rs:101:50
=== Running: "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out/release/binding-generator" "/opt/opencv/include/opencv4" "/root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/src _cpp" "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out" "videostab" ""
thread '' panicked at 'Can't run bindings generator: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/build/generator.rs:101:50
thread '' panicked at 'Can't run bindings generator: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/build/generator.rs:101:50
=== Running: "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out/release/binding-generator" "/opt/opencv/include/opencv4" "/root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/src_cpp" "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out" "xfeatures2d" ""
=== Running: "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out/release/binding-generator" "/opt/opencv/include/opencv4" "/root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/src _cpp" "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out" "ximgproc" ""
thread '' panicked at 'Can't run bindings generator: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/build/generator.rs:101:50
=== Running: "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out/release/binding-generator" "/opt/opencv/include/opencv4" "/root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/src _cpp" "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out" "wechat_qrcode" ""
=== Running: "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out/release/binding-generator" "/opt/opencv/include/opencv4" "/root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/src_cpp" "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out" "xobjdetect" ""
thread '' panicked at 'Can't run bindings generator: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/build/generator.rs:101:50
thread 'main' panicked at 'Generator thread panicked: Any { .. }', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/build/generator.rs:112:28
thread '' panicked at 'Can't run bindings generator: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/build/generator.rs:101:50

hsyan2008 commented 1 year ago

There no /rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out/release/binding-generator but is /rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out/x86_64-unknown-linux-musl/release/binding-generatorbinding-generator

twistedfall commented 1 year ago

Can you please try setting HOST_TRIPPLE=x86_64-unknown-linux-musl environment variable for the build? It should work this around.

hsyan2008 commented 1 year ago

with setting HOST_TRIPLE=x86_64-unknown-linux-musl Here's a snippet from compile output: === Running: "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out/x86_64-unknown-linux-musl/release/binding-generator" "/opt/opencv/include/opencv4" "/root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/src_cpp" "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out" "ximgproc" "" thread 'main' panicked at 'Cannot initialize clang: "thelibclangshared library at /usr/lib/x86_64-linux-gnu/libclang-14.so.14.0.0 could not be opened: Dynamic loading not supported"', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-binding-generator-0.62.0/src/bin/binding-generator.rs:91:30 note: run withRUST_BACKTRACE=1environment variable to display a backtrace thread '<unnamed>' panicked at 'Failed to run the bindings generator', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/build/generator.rs:103:21 === Running: "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out/x86_64-unknown-linux-musl/release/binding-generator" "/opt/opencv/include/opencv4" "/root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/src_cpp" "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2b1e3bbfa7d66a15/out" "xobjdetect" "" thread 'main' panicked at 'Cannot initialize clang: "thelibclangshared library at /usr/lib/x86_64-linux-gnu/libclang-14.so.14.0.0 could not be opened: Dynamic loading not supported"', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-binding-generator-0.62.0/src/bin/binding-generator.rs:91:30 note: run withRUST_BACKTRACE=1environment variable to display a backtrace thread '<unnamed>' panicked at 'Failed to run the bindings generator', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/build/generator.rs:103:21 thread 'main' panicked at 'Generator thread panicked: Any { .. }', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.81.2/build/generator.rs:112:28 thread 'main' panicked at 'Cannot initialize clang: "thelibclangshared library at /usr/lib/x86_64-linux-gnu/libclang-14.so.14.0.0 could not be opened: Dynamic loading not supported"', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-binding-generator-0.62.0/src/bin/binding-generator.rs:91:30 note: run withRUST_BACKTRACE=1environment variable to display a backtrace thread 'main' panicked at 'Cannot initialize clang: "thelibclangshared library at /usr/lib/x86_64-linux-gnu/libclang-14.so.14.0.0 could not be opened: Dynamic loading not supported"', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-binding-generator-0.62.0/src/bin/binding-generator.rs:91:30

twistedfall commented 1 year ago

Can you please try switching from the crates.io release to the rel branch from this repo and try again to see if the issue is fixed?

hsyan2008 commented 1 year ago

Can you please try switching from the crates.io release to the rel branch from this repo and try again to see if the issue is fixed?

with opencv = { git = "https://github.com/twistedfall/opencv-rust", branch = "rel" } in Cargo.toml,i got

error: failed to run custom build command for opencv v0.81.2 (https://github.com/twistedfall/opencv-rust?branch=rel#3794b81a)

Caused by:
process didn't exit successfully: /root/.cargo/target/release/build/opencv-ded601220d2d2ba3/build-script-build (signal: 11, SIGSEGV: invalid memory reference)
--- stdout
=== Running: CARGO_TARGET_DIR="/root/.cargo/target/x86_64-unknown-linux-musl/release/build/opencv-b8a9e5ff2cd654a3/out" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/bin/cargo" "build" "--release" "--package" "opencv-bindi ng-generator" "--bin" "binding-generator" "--target" "x86_64-unknown-linux-musl"
cargo:rustc-cfg=ocvrs_opencv_branch_4
cargo:rerun-if-env-changed=OPENCV_PACKAGE_NAME
cargo:rerun-if-env-changed=OPENCV_PKGCONFIG_NAME cargo:rerun-if-env-changed=OPENCV_CMAKE_NAME
cargo:rerun-if-env-changed=OPENCV_CMAKE_BIN cargo:rerun-if-env-changed=OPENCV_VCPKG_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 cargo:rerun-if-env-changed=OPENCV_DISABLE_PROBES
cargo:rerun-if-env-changed=CMAKE_PREFIX_PATH
cargo:rerun-if-env-changed=OpenCV_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=VCPKG_ROOT
cargo:rerun-if-env-changed=VCPKGRS_DYNAMIC cargo:rerun-if-env-changed=OCVRS_DOCS_GENERATE_DIR cargo:rerun-if-env-changed=DOCS_RS
cargo:rerun-if-env-changed=HOST_TRIPLE
cargo:rerun-if-changed=/root/.cargo/git/checkouts/opencv-rust-274576ea50cb05ec/3794b81/src_cpp/sfm.hpp
cargo:rerun-if-changed=/root/.cargo/git/checkouts/opencv-rust-274576ea50cb05ec/3794b81/src_cpp/bioinspired.hpp
cargo:rerun-if-changed=/root/.cargo/git/checkouts/opencv-rust-274576ea50cb05ec/3794b81/src_cpp/alphamat.hpp
cargo:rerun-if-changed=/root/.cargo/git/checkouts/opencv-rust-274576ea50cb05ec/3794b81/src_cpp/photo.hpp
cargo:rerun-if-changed=/root/.cargo/git/checkouts/opencv-rust-274576ea50cb05ec/3794b81/src_cpp/manual-dnn.cpp
cargo:rerun-if-changed=/root/.cargo/git/checkouts/opencv-rust-274576ea50cb05ec/3794b81/src_cpp/ccalib.hpp
cargo:rerun-if-changed=/root/.cargo/git/checkouts/opencv-rust-274576ea50cb05ec/3794b81/src_cpp/hdf.hpp
cargo:rerun-if-changed=/root/.cargo/git/checkouts/opencv-rust-274576ea50cb05ec/3794b81/src_cpp/core.hpp
cargo:rerun-if-changed=/root/.cargo/git/checkouts/opencv-rust-274576ea50cb05ec/3794b81/src_cpp/dnn.hpp
cargo:rerun-if-changed=/root/.cargo/git/checkouts/opencv-rust-274576ea50cb05ec/3794b81/src_cpp/videoio.hpp
cargo:rerun-if-changed=/root/.cargo/git/checkouts/opencv-rust-274576ea50cb05ec/3794b81/src_cpp/xfeatures2d.hpp
cargo:rerun-if-changed=/root/.cargo/git/checkouts/opencv-rust-274576ea50cb05ec/3794b81/src_cpp/face.hpp
cargo:rerun-if-changed=/root/.cargo/git/checkouts/opencv-rust-274576ea50cb05ec/3794b81/src_cpp/gapi.hpp
cargo:rerun-if-changed=/root/.cargo/git/checkouts/opencv-rust-274576ea50cb05ec/3794b81/src_cpp/aruco.hpp
cargo:rerun-if-changed=/root/.cargo/git/checkouts/opencv-rust-274576ea50cb05ec/3794b81/src_cpp/manual-features2d.cpp cargo:rerun-if-changed=/root/.cargo/git/checkouts/opencv-rust-274576ea50cb05ec/3794b81/src_cpp/ocvrs_common.hpp
cargo:rerun-if-changed=/root/.cargo/git/checkouts/opencv-rust-274576ea50cb05ec/3794b81/src_cpp/manual-core.cpp
cargo:rerun-if-changed=Cargo.toml [108/984] --- stderr
=== Available jobs from the environment created jobserver is: 0 or there is an error reading that value
=== Creating a new job server with num_jobs: 4 === Crate version: Some("0.81.2")
=== Environment configuration:
=== OPENCV_PACKAGE_NAME = None === OPENCV_PKGCONFIG_NAME = None === OPENCV_CMAKE_NAME = None
=== OPENCV_CMAKE_BIN = None
=== OPENCV_VCPKG_NAME = None === OPENCV_LINK_LIBS = Some("opencv_highgui,opencv_objdetect,opencv_dnn,opencv_videostab,opencv_calib3d,opencv_features2d,opencv_stitching,opencv_flann,opencv_videoio,opencv_rgbd,opencv_aruco,opencv_video,opencv_ml,opencv_imgcodecs,op encv_imgproc,opencv_core,ittnotify,tbb,liblibwebp,liblibtiff,liblibjpeg-turbo,liblibpng,liblibopenjp2,ippiw,ippicv,liblibprotobuf,quirc,zlib") === OPENCV_LINK_PATHS = Some("/opt/opencv/lib,/opt/opencv/lib/opencv4/3rdparty,/usr/lib/x86_64-linux-gnu,/usr/lib/x86_64-linux-musl,/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1") === OPENCV_INCLUDE_PATHS = Some("/opt/opencv/include/opencv4") === OPENCV_DISABLE_PROBES = None === CMAKE_PREFIX_PATH = None === OpenCV_DIR = None === PKG_CONFIG_PATH = None === VCPKG_ROOT = None === VCPKGRS_DYNAMIC = None === OCVRS_DOCS_GENERATE_DIR = None === DOCS_RS = None === HOST_TRIPLE = Some("x86_64-unknown-linux-musl") === PATH = Some("/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin") === Enabled features: === ALPHAMAT === ARUCO === ARUCO_DETECTOR === BARCODE === BGSEGM === BIOINSPIRED === CALIB3D === CCALIB === CUDAARITHM === CUDABGSEGM === CUDACODEC === CUDAFEATURES2D === CUDAFILTERS === CUDAIMGPROC === CUDAOBJDETECT === CUDAOPTFLOW === CUDASTEREO === CUDAWARPING === CVV === DEFAULT === DNN === DNN_SUPERRES === DPM === FACE === FEATURES2D === FLANN === FREETYPE
=== FUZZY
=== GAPI
=== HDF
=== HFS
=== HIGHGUI
=== IMGCODECS
=== IMGPROC
=== IMG_HASH
=== INTENSITY_TRANSFORM
=== LINE_DESCRIPTOR
=== MCC
=== ML
=== OBJDETECT
=== OPTFLOW
=== OVIS
=== PHASE_UNWRAPPING
=== PHOTO
=== PLOT
=== QUALITY
=== RAPID
=== RGBD
=== SALIENCY
=== SFM
=== SHAPE
=== STEREO === STITCHING
=== STRUCTURED_LIGHT === SUPERRES === SURFACE_MATCHING === TEXT
=== TRACKING === VIDEO
=== VIDEOIO
=== VIDEOSTAB === VIZ
=== WECHAT_QRCODE === XFEATURES2D === XIMGPROC
=== XOBJDETECT === XPHOTO
=== Detected probe priority based on environment vars: pkg_config: false, cmake: false, vcpkg: false === Probing the OpenCV library in the following order: environment, pkg_config, cmake, vcpkg_cmake, vcpkg === Configuring OpenCV library from the environment: === include_paths: /opt/opencv/include/opencv4 === link_paths: /opt/opencv/lib,/opt/opencv/lib/opencv4/3rdparty,/usr/lib/x86_64-linux-gnu,/usr/lib/x86_64-linux-musl,/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1 === link_libs: opencv_highgui,opencv_objdetect,opencv_dnn,opencv_videostab,opencv_calib3d,opencv_features2d,opencv_stitching,opencv_flann,opencv_videoio,opencv_rgbd,opencv_aruco,opencv_video,opencv_ml,opencv_imgcodecs,opencv_imgproc,o pencv_core,ittnotify,tbb,liblibwebp,liblibtiff,liblibjpeg-turbo,liblibpng,liblibopenjp2,ippiw,ippicv,liblibprotobuf,quirc,zlib === Successfully probed using: environment === OpenCV library configuration: Library {
include_paths: [
"/opt/opencv/include/opencv4",
],
version: Version {
major: 4,
minor: 7,
patch: 0,
},
cargo_metadata: [
"cargo:rustc-link-search=/opt/opencv/lib",
"cargo:rustc-link-search=/opt/opencv/lib/opencv4/3rdparty",
"cargo:rustc-link-search=/usr/lib/x86_64-linux-gnu",
"cargo:rustc-link-search=/usr/lib/x86_64-linux-musl",
"cargo:rustc-link-search=/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1", "cargo:rustc-link-lib=opencv_highgui", "cargo:rustc-link-lib=opencv_objdetect", "cargo:rustc-link-lib=opencv_dnn", "cargo:rustc-link-lib=opencv_videostab", "cargo:rustc-link-lib=opencv_calib3d", "cargo:rustc-link-lib=opencv_features2d", "cargo:rustc-link-lib=opencv_stitching", "cargo:rustc-link-lib=opencv_flann",
"cargo:rustc-link-lib=opencv_videoio",
"cargo:rustc-link-lib=opencv_rgbd", "cargo:rustc-link-lib=opencv_aruco", "cargo:rustc-link-lib=opencv_video", "cargo:rustc-link-lib=opencv_ml", "cargo:rustc-link-lib=opencv_imgcodecs", "cargo:rustc-link-lib=opencv_imgproc", "cargo:rustc-link-lib=opencv_core", "cargo:rustc-link-lib=ittnotify", "cargo:rustc-link-lib=tbb", "cargo:rustc-link-lib=libwebp", "cargo:rustc-link-lib=libtiff", "cargo:rustc-link-lib=libjpeg-turbo", "cargo:rustc-link-lib=libpng", "cargo:rustc-link-lib=libopenjp2", "cargo:rustc-link-lib=ippiw", "cargo:rustc-link-lib=ippicv", "cargo:rustc-link-lib=libprotobuf", "cargo:rustc-link-lib=quirc", "cargo:rustc-link-lib=zlib",
],
}
=== Detected OpenCV module header dir at: /opt/opencv/include/opencv4/opencv2 === Found OpenCV version: 4.7.0 in headers located at: /opt/opencv/include/opencv4
=== Generating code in: /root/.cargo/target/x86_64-unknown-linux-musl/release/build/opencv-b8a9e5ff2cd654a3/out
=== Placing generated bindings into: /root/.cargo/target/x86_64-unknown-linux-musl/release/build/opencv-b8a9e5ff2cd654a3/out/opencv === Using OpenCV headers from: /opt/opencv/include/opencv4 warning: build failed, waiting for other jobs to finish...

twistedfall commented 1 year ago

Can you please post a full build log as produced by cargo build -vv, this one doesn't contain an actual error.

hsyan2008 commented 1 year ago

output.log

when i try which in output.log, "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2948594a53449f00/out/x86_64-unknown-linux-musl/release/binding-generator" "/opt/opencv/include/opencv4" "/root/.cargo/git/checkouts/opencv-rust-274576ea50cb05ec/4dec6d9/src_cpp" "/rust/zhipin/target/x86_64-unknown-linux-musl/release/build/opencv-2948594a53449f00/out" "xobjdetect" "" i got Segmentation fault

twistedfall commented 1 year ago

I see, can you please try building with HOST_TRIPLE=x86_64-unknown-linux-gnu instead of "x86_64-unknown-linux-musl"?

hsyan2008 commented 1 year ago

build with HOST_TRIPLE=x86_64-unknown-linux-gnu cargo build --release --target x86_64-unknown-linux-gnu -vv output.log

twistedfall commented 1 year ago

Please leave the --target as you need it, you had initially "x86_64-unknown-linux-musl", only the HOST_TRIPLE should be set to "x86_64-unknown-linux-gnu"

hsyan2008 commented 1 year ago

output.log

twistedfall commented 1 year ago

The last error line is error occurred: Failed to find tool. Ismusl-g++installed?, is your system configured correctly to build binaries linked with musl?

hsyan2008 commented 1 year ago

Sorry,I can't reproduce on ubuntu(this is my docker container and it has been destroyed)

Now try in Alpine3.17(docker) install package

apk add --no-cache tzdata cmake make gcc g++ linux-headers clang-static curl llvm15-dev  git ncurses-static 
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain nightly --profile minimal --target x86_64-unknown-linux-musl -y

build opencv: build_opencv.txt

code:

use opencv::core;
use opencv::highgui;
use opencv::imgcodecs;
use opencv::imgproc;
use opencv::prelude::*;
fn main() {
}

command:

HOST_TRIPLE=x86_64-unknown-linux-musl cargo build --release --target x86_64-unknown-linux-musl -vv > stdout.log 2>stderr.log

when in my project Cargo.toml opencv = { git = "https://github.com/twistedfall/opencv-rust", version = "0.81.3" } compile log: stderr.log stdout.log

after that : git clone https://github.com/twistedfall/opencv-rust/ add static like this: clang = { version = "2", features = ["clang_6_0", "static"] } change my project Cargo.toml : opencv = { path = "../opencv-rust" } compile log: stderr.log stdout.log and a file in opencv-rust with name core.64006 : core.64006.log

AlonSpinner commented 10 months ago

I had the same problem (build fails on ubuntu 22.04).

I Installed libstdc++-12-dev with sudo apt and it was solved.

sanchexas commented 2 months ago

I had the same problem (build fails on ubuntu 22.04).

I Installed libstdc++-12-dev with sudo apt and it was solved.

You're the best