Skip to content

cargo build fails with SIGSEGV: invalid memory reference on rust:alpine3.21 image #665

@piotrpdev

Description

@piotrpdev

This Dockerfile fails to build:

FROM rust:alpine3.21

RUN set -xeu && \
    apk add build-base clang-dev opencv-dev

RUN set -xeu && \
	cargo new /root/app && \
	echo "opencv = { version = \"0.94.4\", default-features = false }" >> /root/app/Cargo.toml && \
	echo "use opencv::prelude::*; use opencv::core; fn main() {}" > /root/app/src/main.rs

RUN set -xu && \
	cd /root/app && \
    RUST_BACKTRACE=full cargo build -vv --release

Operating system

rust:alpine3.21 (Linux)

The way you installed OpenCV: package, official binary distribution, manual compilation, etc.

Package (using apk add opencv-dev)

OpenCV version

4.10.0-r3

rustc version (rustc --version)

rustc 1.86.0 (05f9846f8 2025-03-31)

Attach the full output of the following command from your project directory: RUST_BACKTRACE=full cargo build -vv

alpine.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions