Simple demo cause `Segmentation fault` on Alpine Linux · Issue #1794 · seanmonstar/reqwest · GitHub |
您所在的位置:网站首页 › 旅游形象分析方法有哪几种 › Simple demo cause `Segmentation fault` on Alpine Linux · Issue #1794 · seanmonstar/reqwest · GitHub |
Thanks for the reminder, I confirmed that this is the problem caused by the openssl static link, it behaves almost the same as https://users.rust-lang.org/t/sigsegv-with-program-linked-against-openssl-in-an-alpine-container/52172, and the problem it describes exists so far. As for why I was able to build normally a week ago, it is composed of multiple coincidences😂. As a module of a C program written in Rust, it is configured as a static C ABI library: [lib] crate-type = ["staticlib"]On the final build I used the following docker script: FROM ${ALPINE} AS cleardns RUN apk add build-base cmake git openssl-libs-static COPY ./ /cleardns/ COPY --from=rust-mods /tmp/libassets.a /cleardns/src/target/release/ COPY --from=rust-mods /tmp/libto_json.a /cleardns/src/target/release/ WORKDIR /cleardns/bin/ RUN cmake -DCMAKE_EXE_LINKER_FLAGS=-static .. && make && strip cleardns && mv cleardns /tmp/When finally compiling into an executable file, the library written by Rust is statically linked. Since CMAKE_EXE_LINKER_FLAGS is specified as -static, all libraries including openssl will be completely statically linked, which inadvertently avoids this problem. Since openssl is cumbersome to build on musl-based systems, I would consider using rustls instead of openssl on Alpine. |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |