Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Enable static builds of libsignal_jni #526

Closed
m-ueberall opened this issue Jun 5, 2023 · 3 comments
Closed

[Feature Request] Enable static builds of libsignal_jni #526

m-ueberall opened this issue Jun 5, 2023 · 3 comments

Comments

@m-ueberall
Copy link

It would be nice to be able to create static binaries of applications that use libsignal_jni. For this to work, the library itself needs to be static:

# cargo build --target x86_64-unknown-linux-musl --release --verbose -p libsignal-jni
error: cannot produce cdylib for `libsignal-jni v0.26.0 (/build/libsignal/rust/bridge/jni)` as the target `x86_64-unknown-linux-musl` does not support these crate types
@jrose-signal
Copy link
Contributor

You're welcome to do so, and we'd probably take a patch to add a flag to build_jni.sh and the Makefile, but it's not a need Signal has ourselves, so we probably won't publish official artifacts. (I didn't realize there were statically-linked JVMs, either.)

@morph027
Copy link

Just found this one via AsamK/signal-cli#1453 ...

Just tried building with RUSTFLAGS="-C link-arg=-s -C target-feature=-crt-static" and it at least the buildchain completes....however i have not tested the artifact with musl graalvm native image though.

Running in docker using rust:alpine

apk add build-base ccache clang cmake g++ gcc git protobuf-dev clang-dev
export PATH="/usr/lib/ccache/bin/:$PATH"
export CCACHE_DIR="${CCACHE_DIR:-/tmp/ccache}"
export RUSTC_WRAPPER=/usr/bin/ccache
mkdir -p "$CCACHE_DIR"
export RUSTFLAGS="-C link-arg=-s -C target-feature=-crt-static"
git clone -b v0.40.1 https://github.com/signalapp/libsignal-client /tmp/libsignal-client
cd /tmp/libsignal-client
cargo build --release --verbose -p libsignal-jni

I've attached the final build asset if you want to try.

libsignal_jni.so.tgz

@kevemueller
Copy link

Hi,

just a heads-up here for the build artefact posted by @morph027.
It works as intended on an AMD64/OpenWRT/musl/zulu17.48.15-ca-jre17.0.10-linux_musl_x64/OpenHAB/Signal plugin environment.
As the Signal plugin author @dalgwen uses exquo/signal-libs-build I have asked there to include it to the list of platforms @exquo is providing binaries for.

Cheers!

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

No branches or pull requests

4 participants