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

Build error when compiling for alpine linux docker #676

Open
bvjebin opened this issue Sep 14, 2023 · 1 comment
Open

Build error when compiling for alpine linux docker #676

bvjebin opened this issue Sep 14, 2023 · 1 comment

Comments

@bvjebin
Copy link

bvjebin commented Sep 14, 2023

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?

@bvjebin
Copy link
Author

bvjebin commented Sep 14, 2023

Is this an issue with sqld or something to do with libsqlite3-sys?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant