clux / muslrust

Docker environment for building musl based static linux rust binaries
MIT License
965 stars 88 forks source link

undefined OPENSSL_config #68

Closed hellojukay closed 4 years ago

hellojukay commented 4 years ago

Dockerfile

FROM clux/muslrust:1.41.1-stable
ADD sources.list /etc/apt/
RUN  apt purge cmake* &&  apt-get update && apt-get install cmake -y
RUN cmake --version
ENV PATH=$PREFIX/bin:$PATH:/usr/local/bin:$PATH:$HOME/bin \
    PKG_CONFIG_ALLOW_CROSS=true \
    PKG_CONFIG_ALL_STATIC=true \
    PQ_LIB_STATIC_X86_64_UNKNOWN_LINUX_MUSL=true \
    PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig \
    PG_CONFIG_X86_64_UNKNOWN_LINUX_GNU=/usr/bin/pg_config \
    OPENSSL_STATIC=true \
    OPENSSL_DIR=$PREFIX \
    SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
    SSL_CERT_DIR=/etc/ssl/certs \
    LIBZ_SYS_STATIC=1

# Allow ditching the -w /volume flag to docker run
WORKDIR /volume
RUN  mkdir -p /root/.ssh
ADD id_rsa /root/.ssh
ADD ssh_config /etc/ssh/
RUN chmod 600 /root/.ssh/id_rsa

cmd

cargo build --target x86_64-unknown-linux-musl --release

error

rustlib/x86_64-unknown-linux-musl/lib/crtn.o"
  = note: /volume/hyper-access/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-6106f6dbd1f8d914.rlib(fe-secure-openssl.o): In function `pgtls_init':
          fe-secure-openssl.c:(.text+0xd51): undefined reference to `OPENSSL_config'
clux commented 4 years ago

Seems to be what everyone else is running into when using openssl 1.0.x: https://github.com/emk/rust-musl-builder/issues/64#issuecomment-471573471

clux commented 4 years ago

Make sure you have followed these guidelines: https://github.com/clux/muslrust#diesel-and-pq-builds

hellojukay commented 4 years ago
 need to include the openssl crate before diesel due to pq-sys#25:

i fix it .