Modship
Modship

Reputation: 57

Rust Cross building with dockerfile

I have a simple software on my mac OSX in rust :

fn main() -> std::io::Result<()> {
    println!("test log");
    Ok(())
}

I build a binary for linux (ubuntu) on my CI (Azure Devops) with Docker and extract it for run it on a vm doesn't have docker.

When i run it i have a Segmentation fault (core dumped) and don't know why ...

If someone has a solution there is my dockerfile :

FROM ubuntu:20.04 as cargo-build

ENV TZ=Europe/Paris
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# Update default packages
RUN apt-get -qq update

# Get Ubuntu packages
RUN apt-get install -y -q \
    build-essential \
    openssl \
    make \
    cmake \
    pkg-config \
    libssl-dev \
    libpq-dev \
    curl



# Get Rust; NOTE: using sh for better compatibility with other base images
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y

# Add .cargo/bin to PATH
ENV PATH="/root/.cargo/bin:${PATH}"

WORKDIR /usr/src/app

# Recuperation des ressources
#COPY Cargo.lock .
COPY Cargo.toml .
COPY ./src src


# Build de la release
RUN cargo build --release

Upvotes: 0

Views: 1637

Answers (1)

Zeppi
Zeppi

Reputation: 1245

We are found that's probleme is probably in pipeline (Azure Devops) description. Because when we do manually each step it work.

This issue is done? You are found solution?

Upvotes: 1

Related Questions