onur / acme-client

Yet another Let's Encrypt client and library written in Rust.
MIT License
225 stars 33 forks source link

Cross-compiled, now runtime error ‘The OpenSSL library reported an error’ (target `x86_64-unknown-linux-musl`) #14

Closed sanmai-NL closed 6 years ago

sanmai-NL commented 7 years ago

The openssl dependency makes cross-compilation very hard. (Once there is feature parity, I would be in favor of replacing it with webpki.) Even when cross-compilation succeeds, the letsencrypt-rs fails for me at runtime.

I compiled openssl under Arch Linux, as required by the openssl crate:

sudo pacman -Syu musl
mkdir /opt/openssl/
cd /srv/installers/
curl --tlsv1.2 -O 'https://www.openssl.org/source/openssl-1.1.0e.tar.gz'
tar xf 'openssl-1.1.0e.tar.gz'
cd 'openssl-1.1.0e/'
export CC='musl-gcc'
./Configure no-unit-test no-async no-afalgeng no-ui \
    --prefix=/opt/openssl/ linux-x86_64 -fPIC
make -j"$(nproc)"
sudo make install

Then I compiled letsencrypt-rs:

cd "$HOME/devel/github.com/onur/letsencrypt-rs/letsencrypt-rs/"
env PKG_CONFIG_ALLOW_CROSS=1 OPENSSL_STATIC=1 OPENSSL_DIR=/opt/openssl/ \
    cargo build --release --target=x86_64-unknown-linux-musl

However, when running with some CLI params under Alpine Linux 3.5, letsencrypt-rs exits with status 1 and message:

The OpenSSL library reported an error

How can I solve this? Could the error message be improved?

onur commented 7 years ago

TBH I have no idea. I can't even build openssl with musl-gcc on my system (Debian sid), it never worked and I give up on trying.

denji commented 6 years ago

Alpine Linux 3.5+ now used patched LibreSSL version.

onur commented 6 years ago

Yes, I just tested with LibreSSL and it is working fine. Just compile LibreSSL with musl-gcc and --disable-shared configuration option. Then you can build acme-client for x86_64-unknown-linux-musl and statically link LibreSSL library. I am closing this now.

denji commented 6 years ago

@onur https://github.com/intoli/exodus