Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.
This repository was archived by the owner on Oct 18, 2023. It is now read-only.

Build error when compiling for alpine linux docker #676

@bvjebin

Description

@bvjebin

I am trying to build sqld for alpine. It keeps failing looking for libclang with error:

error: failed to run custom build command for `libsqlite3-sys v0.26.0 (https://github.com/psarna/rusqlite?rev=477264453b#47726445)`
#0 499.1
#0 499.1 Caused by:
#0 499.1   process didn't exit successfully: `/target/release/build/libsqlite3-sys-22f7b19467bfc769/build-script-build` (exit status: 101)
#0 499.1   --- stdout
#0 499.1   cargo:rerun-if-env-changed=LIBSQLITE3_SYS_USE_PKG_CONFIG
#0 499.1   cargo:rerun-if-env-changed=LIBSQLITE3_SYS_BUNDLING
#0 499.1
#0 499.1   --- stderr
#0 499.1   thread 'main' panicked at 'Unable to find libclang: "the `libclang` shared library at /usr/lib/llvm16/lib/libclang.so.16.0.6 could not be opened: Dynamic loading not supported"', /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.65.1/lib.rs:6

Following is the dockerfile content.

FROM rust:1.70-alpine3.18
COPY rust-toolchain.toml rust-toolchain.toml
RUN apk update \
    && apk add --no-cache musl-dev gcc clang-dev build-base tcl protobuf file openssl-dev pkgconf git ca-certificates \
    && apk cache clean \
    && cargo install cargo-chef
RUN cat rust-toolchain.toml | grep "channel" | awk '{print $3}' | sed 's/\"//g' > toolchain.txt \
    && rustup update $(cat toolchain.txt) \
    && rustup default $(cat toolchain.txt) \
    && rm toolchain.txt rust-toolchain.toml
COPY . .
RUN cargo chef prepare --recipe-path recipe.json && cargo chef cook --release --recipe-path recipe.json && cargo build --target=x86_64-unknown-linux-musl -p sqld --release
COPY /target/release/sqld /bin/sqld
CMD ["/bin/sqld"]

Am I missing a dependency or am I not passing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions