zig build error: UnknownOperatingSystem, on aarch64 opencv-rs version 0.91.2
Closed this issue · 2 comments
DennisZhangOiler commented
Checklist
- I've looked through the issues and pull requests for similar reports
Describe your issue
without specific zig version, it's able to be compiled, with zig version = 2.27, following log reported:
The following warnings were emitted during compilation:
warning: opencv@0.91.2: error: UnknownOperatingSystem
warning: opencv@0.91.2: ToolExecError: Command "/target/.zig-cache/cargo-zigbuild/0.17.3/zigcxx-aarch64-unknown-linux-gnu.2.27.sh" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "--target=aarch64-unknown-linux-gnu" "-std=c++14" "-I" "/home/dennis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.91.2/src_cpp" "-I" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out" "-I" "." "-I" "/opencv/platforms/linux/build/install/include/opencv4" "-Wall" "-Wextra" "-o" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/0de9285bc4b8b0c1-calib3d.o" "-c" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/calib3d.cpp" with args zigcxx-aarch64-unknown-linux-gnu.2.27.sh did not execute successfully (status code exit status: 1).cargo:warning=error: UnknownOperatingSystem
warning: opencv@0.91.2: ToolExecError: Command "/target/.zig-cache/cargo-zigbuild/0.17.3/zigcxx-aarch64-unknown-linux-gnu.2.27.sh" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "--target=aarch64-unknown-linux-gnu" "-std=c++14" "-I" "/home/dennis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.91.2/src_cpp" "-I" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out" "-I" "." "-I" "/opencv/platforms/linux/build/install/include/opencv4" "-Wall" "-Wextra" "-o" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/0de9285bc4b8b0c1-core.o" "-c" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/core.cpp" with args zigcxx-aarch64-unknown-linux-gnu.2.27.sh did not execute successfully (status code exit status: 1).cargo:warning=error: UnknownOperatingSystem
warning: opencv@0.91.2: ToolExecError: Command "/target/.zig-cache/cargo-zigbuild/0.17.3/zigcxx-aarch64-unknown-linux-gnu.2.27.sh" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "--target=aarch64-unknown-linux-gnu" "-std=c++14" "-I" "/home/dennis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.91.2/src_cpp" "-I" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out" "-I" "." "-I" "/opencv/platforms/linux/build/install/include/opencv4" "-Wall" "-Wextra" "-o" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/c7e00ddeaf254fbf-manual-core.o" "-c" "/home/dennis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.91.2/src_cpp/manual-core.cpp" with args zigcxx-aarch64-unknown-linux-gnu.2.27.sh did not execute successfully (status code exit status: 1).cargo:warning=error: UnknownOperatingSystem
warning: opencv@0.91.2: ToolExecError: Command "/target/.zig-cache/cargo-zigbuild/0.17.3/zigcxx-aarch64-unknown-linux-gnu.2.27.sh" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "--target=aarch64-unknown-linux-gnu" "-std=c++14" "-I" "/home/dennis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.91.2/src_cpp" "-I" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out" "-I" "." "-I" "/opencv/platforms/linux/build/install/include/opencv4" "-Wall" "-Wextra" "-o" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/0de9285bc4b8b0c1-dnn.o" "-c" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/dnn.cpp" with args zigcxx-aarch64-unknown-linux-gnu.2.27.sh did not execute successfully (status code exit status: 1).cargo:warning=error: UnknownOperatingSystem
warning: opencv@0.91.2: ToolExecError: Command "/target/.zig-cache/cargo-zigbuild/0.17.3/zigcxx-aarch64-unknown-linux-gnu.2.27.sh" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "--target=aarch64-unknown-linux-gnu" "-std=c++14" "-I" "/home/dennis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.91.2/src_cpp" "-I" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out" "-I" "." "-I" "/opencv/platforms/linux/build/install/include/opencv4" "-Wall" "-Wextra" "-o" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/0de9285bc4b8b0c1-features2d.o" "-c" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/features2d.cpp" with args zigcxx-aarch64-unknown-linux-gnu.2.27.sh did not execute successfully (status code exit status: 1).cargo:warning=error: UnknownOperatingSystem
warning: opencv@0.91.2: ToolExecError: Command "/target/.zig-cache/cargo-zigbuild/0.17.3/zigcxx-aarch64-unknown-linux-gnu.2.27.sh" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "--target=aarch64-unknown-linux-gnu" "-std=c++14" "-I" "/home/dennis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.91.2/src_cpp" "-I" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out" "-I" "." "-I" "/opencv/platforms/linux/build/install/include/opencv4" "-Wall" "-Wextra" "-o" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/0de9285bc4b8b0c1-flann.o" "-c" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/flann.cpp" with args zigcxx-aarch64-unknown-linux-gnu.2.27.sh did not execute successfully (status code exit status: 1).cargo:warning=error: UnknownOperatingSystem
warning: opencv@0.91.2: ToolExecError: Command "/target/.zig-cache/cargo-zigbuild/0.17.3/zigcxx-aarch64-unknown-linux-gnu.2.27.sh" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "--target=aarch64-unknown-linux-gnu" "-std=c++14" "-I" "/home/dennis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.91.2/src_cpp" "-I" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out" "-I" "." "-I" "/opencv/platforms/linux/build/install/include/opencv4" "-Wall" "-Wextra" "-o" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/0de9285bc4b8b0c1-highgui.o" "-c" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/highgui.cpp" with args zigcxx-aarch64-unknown-linux-gnu.2.27.sh did not execute successfully (status code exit status: 1).cargo:warning=error: UnknownOperatingSystem
warning: opencv@0.91.2: ToolExecError: Command "/target/.zig-cache/cargo-zigbuild/0.17.3/zigcxx-aarch64-unknown-linux-gnu.2.27.sh" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "--target=aarch64-unknown-linux-gnu" "-std=c++14" "-I" "/home/dennis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.91.2/src_cpp" "-I" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out" "-I" "." "-I" "/opencv/platforms/linux/build/install/include/opencv4" "-Wall" "-Wextra" "-o" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/0de9285bc4b8b0c1-imgcodecs.o" "-c" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/imgcodecs.cpp" with args zigcxx-aarch64-unknown-linux-gnu.2.27.sh did not execute successfully (status code exit status: 1).cargo:warning=error: UnknownOperatingSystem
warning: opencv@0.91.2: ToolExecError: Command "/target/.zig-cache/cargo-zigbuild/0.17.3/zigcxx-aarch64-unknown-linux-gnu.2.27.sh" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "--target=aarch64-unknown-linux-gnu" "-std=c++14" "-I" "/home/dennis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.91.2/src_cpp" "-I" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out" "-I" "." "-I" "/opencv/platforms/linux/build/install/include/opencv4" "-Wall" "-Wextra" "-o" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/0de9285bc4b8b0c1-imgproc.o" "-c" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/imgproc.cpp" with args zigcxx-aarch64-unknown-linux-gnu.2.27.sh did not execute successfully (status code exit status: 1).cargo:warning=error: UnknownOperatingSystem
warning: opencv@0.91.2: ToolExecError: Command "/target/.zig-cache/cargo-zigbuild/0.17.3/zigcxx-aarch64-unknown-linux-gnu.2.27.sh" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "--target=aarch64-unknown-linux-gnu" "-std=c++14" "-I" "/home/dennis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.91.2/src_cpp" "-I" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out" "-I" "." "-I" "/opencv/platforms/linux/build/install/include/opencv4" "-Wall" "-Wextra" "-o" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/0de9285bc4b8b0c1-ml.o" "-c" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/ml.cpp" with args zigcxx-aarch64-unknown-linux-gnu.2.27.sh did not execute successfully (status code exit status: 1).cargo:warning=error: UnknownOperatingSystem
warning: opencv@0.91.2: ToolExecError: Command "/target/.zig-cache/cargo-zigbuild/0.17.3/zigcxx-aarch64-unknown-linux-gnu.2.27.sh" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "--target=aarch64-unknown-linux-gnu" "-std=c++14" "-I" "/home/dennis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.91.2/src_cpp" "-I" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out" "-I" "." "-I" "/opencv/platforms/linux/build/install/include/opencv4" "-Wall" "-Wextra" "-o" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/0de9285bc4b8b0c1-objdetect.o" "-c" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/objdetect.cpp" with args zigcxx-aarch64-unknown-linux-gnu.2.27.sh did not execute successfully (status code exit status: 1).cargo:warning=error: UnknownOperatingSystem
warning: opencv@0.91.2: ToolExecError: Command "/target/.zig-cache/cargo-zigbuild/0.17.3/zigcxx-aarch64-unknown-linux-gnu.2.27.sh" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "--target=aarch64-unknown-linux-gnu" "-std=c++14" "-I" "/home/dennis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.91.2/src_cpp" "-I" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out" "-I" "." "-I" "/opencv/platforms/linux/build/install/include/opencv4" "-Wall" "-Wextra" "-o" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/0de9285bc4b8b0c1-photo.o" "-c" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/photo.cpp" with args zigcxx-aarch64-unknown-linux-gnu.2.27.sh did not execute successfully (status code exit status: 1).cargo:rerun-if-env-changed=CXX_aarch64-unknown-linux-gnu
warning: opencv@0.91.2: error: UnknownOperatingSystem
warning: opencv@0.91.2: ToolExecError: Command "/target/.zig-cache/cargo-zigbuild/0.17.3/zigcxx-aarch64-unknown-linux-gnu.2.27.sh" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "--target=aarch64-unknown-linux-gnu" "-std=c++14" "-I" "/home/dennis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.91.2/src_cpp" "-I" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out" "-I" "." "-I" "/opencv/platforms/linux/build/install/include/opencv4" "-Wall" "-Wextra" "-o" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/0de9285bc4b8b0c1-stitching.o" "-c" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/stitching.cpp" with args zigcxx-aarch64-unknown-linux-gnu.2.27.sh did not execute successfully (status code exit status: 1).cargo:warning=error: UnknownOperatingSystem
warning: opencv@0.91.2: ToolExecError: Command "/target/.zig-cache/cargo-zigbuild/0.17.3/zigcxx-aarch64-unknown-linux-gnu.2.27.sh" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "--target=aarch64-unknown-linux-gnu" "-std=c++14" "-I" "/home/dennis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.91.2/src_cpp" "-I" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out" "-I" "." "-I" "/opencv/platforms/linux/build/install/include/opencv4" "-Wall" "-Wextra" "-o" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/0de9285bc4b8b0c1-video.o" "-c" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/video.cpp" with args zigcxx-aarch64-unknown-linux-gnu.2.27.sh did not execute successfully (status code exit status: 1).cargo:warning=error: UnknownOperatingSystem
warning: opencv@0.91.2: ToolExecError: Command "/target/.zig-cache/cargo-zigbuild/0.17.3/zigcxx-aarch64-unknown-linux-gnu.2.27.sh" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "--target=aarch64-unknown-linux-gnu" "-std=c++14" "-I" "/home/dennis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opencv-0.91.2/src_cpp" "-I" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out" "-I" "." "-I" "/opencv/platforms/linux/build/install/include/opencv4" "-Wall" "-Wextra" "-o" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/0de9285bc4b8b0c1-videoio.o" "-c" "/target/aarch64-unknown-linux-gnu/debug/build/opencv-bb13004260793875/out/videoio.cpp" with args zigcxx-aarch64-unknown-linux-gnu.2.27.sh did not execute successfully (status code exit status: 1).
error: failed to run custom build command for `opencv v0.91.2`
What target(s) are you cross-compiling for?
aarch64-unknown-linux-gnu
Which operating system is the host (e.g computer cross is on) running?
- macOS
- Windows
- Linux / BSD
- other OS (specify in description)
What architecture is the host?
- x86_64 / AMD64
- arm32
- arm64 (including Mac M1)
What container engine is cross using?
- docker
- podman
- other container engine (specify in description)
cross version
cross 0.2.5 (6d097fb 2024-04-12)
Example
No response
Additional information / notes
My dockerfile:
ARG CROSS_BASE_IMAGE
FROM $CROSS_BASE_IMAGE
# requirements of bindgen, see https://rust-lang.github.io/rust-bindgen/requirements.html
RUN DEBIAN_FRONTEND=noninteractive apt install -y llvm-dev libclang-dev clang
# cross compile opencv, see https://docs.opencv.org/4.x/d0/d76/tutorial_arm_crosscompile_with_cmake.html
RUN DEBIAN_FRONTEND=noninteractive apt install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
RUN apt install -y \
git \
cmake \
pkgconf \
build-essential \
ninja-build \
crossbuild-essential-armhf \
crossbuild-essential-arm64
RUN git clone --depth 1 --branch '4.1.1' https://github.com/opencv/opencv.git && \
cd opencv/platforms/linux && \
mkdir build && \
cd build && \
cmake -DCMAKE_TOOLCHAIN_FILE=../aarch64-gnu.toolchain.cmake ../../.. && \
make && \
make install
ENV CMAKE_PREFIX_PATH="/opencv/platforms/linux/build/install"
Emilgardis commented
DennisZhangOiler commented
@Emilgardis Thank you so much! How can I manually fix this? Or should I open a PR and reference to this issue?