代码之家  ›  专栏  ›  技术社区  ›  Mr.Wang from Next Door

针对debian的Alpine Linux上的交叉编译

  •  0
  • Mr.Wang from Next Door  · 技术社区  · 4 年前

    我正试图在GitLab中设置CI。

    • 构建操作系统:Alpine Linux容器,实际上是Docker中的Docker 形象(见下面的Dockerfile)
    • 目标操作系统: x86_64-unknown-linux-gnu
    • 建筑工具:十字架 https://github.com/rust-embedded/cross
    • 错误: 未定义的对“\uu res\u init”的引用

    完整日志: https://github.com/rust-embedded/cross/files/4894721/build.log

    这是阿尔卑斯山跑步十字架的Dockerfile

    FROM docker:stable-dind
    
    
    RUN apk add --no-cache ca-certificates gcc mingw-w64-gcc libc-dev musl-dev
    
    # Copied from https://github.com/rust-lang/docker-rust/blob/6314c6bc3d54d5b9284458c6a9061ef5766c9607/1.44.1/alpine3.12/Dockerfile
    ENV RUSTUP_HOME=/usr/local/rustup \
        CARGO_HOME=/usr/local/cargo \
        PATH=/usr/local/cargo/bin:$PATH \
        RUST_VERSION=1.44.1
    
    RUN set -eux; \
        url="https://static.rust-lang.org/rustup/archive/1.21.1/x86_64-unknown-linux-musl/rustup-init"; \
        wget "$url"; \
        echo "0c86d467982bdf5c4b8d844bf8c3f7fc602cc4ac30b29262b8941d6d8b363d7e *rustup-init" | sha256sum -c -; \
        chmod +x rustup-init; \
        ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION; \
        rm rustup-init; \
        chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
        rustup --version; \
        cargo --version; \
        rustc --version;
    
    RUN cargo install cross
    RUN rustup target add x86_64-pc-windows-gnu
    RUN rustup target add x86_64-unknown-linux-gnu
    
    ENV CROSS_DOCKER_IN_DOCKER=true
    
    
    RUN mkdir ~/.cargo/ && \
        printf "\n[target.x86_64-pc-windows-gnu]" >> ~/.cargo/config  && \
        printf "\nlinker = \"/usr/bin/x86_64-w64-mingw32-gcc\"" >> ~/.cargo/config 
    
    
    
    0 回复  |  直到 4 年前