signalapp / libsignal

Home to the Signal Protocol as well as other cryptographic primitives which make Signal possible.
GNU Affero General Public License v3.0
3.63k stars 420 forks source link

0.37.0: rust error[E0658]: use of unstable library feature 'int_roundings' #544

Closed bratkartoffel closed 10 months ago

bratkartoffel commented 11 months ago

Hi,

I can't compile latest release on alpine linux due to the following error:

# cd java
# ./gradlew --no-daemon -PskipAndroid :client:jar
[...]
   Compiling ciborium v0.2.1
   Compiling chrono v0.4.31
   Compiling bincode v1.3.3
   Compiling poksho v0.7.0 (/home/builder/aports/community/java-libsignal-client/src/libsignal-0.37.0/rust/poksho)
   Compiling x25519-dalek v2.0.0
   Compiling zkcredential v0.1.0 (/home/builder/aports/community/java-libsignal-client/src/libsignal-0.37.0/rust/zkcredential)
error[E0658]: use of unstable library feature 'int_roundings'
    --> rust/protocol/src/sealed_sender.rs:1506:70
     |
1506 |     let chunk_size = std::cmp::max(6, identity_keys_and_ranges.len().div_ceil(parallelism));
     |                                                                      ^^^^^^^^
     |
     = note: see issue #88581 <https://github.com/rust-lang/rust/issues/88581> for more information

For more information about this error, try `rustc --explain E0658`.
error: could not compile `libsignal-protocol` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...

> Task :makeJniLibrariesDesktop FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':makeJniLibrariesDesktop'.
> Process 'command 'bash'' finished with non-zero exit value 101

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 41s
2 actionable tasks: 2 executed

Installed toolchain:

(1/102) Installing java-common (0.5-r0)
(2/102) Installing libffi (3.4.4-r3)
(3/102) Installing libtasn1 (4.19.0-r2)
(4/102) Installing p11-kit (0.25.3-r0)
(5/102) Installing p11-kit-trust (0.25.3-r0)
(6/102) Installing java-cacerts (1.0-r1)
(7/102) Installing openjdk11-jre-headless (11.0.21_p9-r0)
(8/102) Installing ncurses-terminfo-base (6.4_p20231125-r0)
(9/102) Installing libncursesw (6.4_p20231125-r0)
(10/102) Installing readline (8.2.7-r0)
(11/102) Installing bash (5.2.21-r0)
Executing bash-5.2.21-r0.post-install
(12/102) Installing xz-libs (5.4.5-r0)
(13/102) Installing libxml2 (2.11.6-r0)
(14/102) Installing llvm16-libs (16.0.6-r7)
(15/102) Installing scudo-malloc (17.0.5-r0)
(16/102) Installing rust (1.72.1-r0)
(17/102) Installing cargo (1.72.1-r0)
(18/102) Installing clang17-headers (17.0.5-r0)
(19/102) Installing llvm17-libs (17.0.5-r0)
(20/102) Installing clang17-libs (17.0.5-r0)
(21/102) Installing llvm17-linker-tools (17.0.5-r0)
(22/102) Installing clang17 (17.0.5-r0)
(23/102) Installing clang17-libclang (17.0.5-r0)
(24/102) Installing clang17-extra-tools (17.0.5-r0)
(25/102) Installing clang17-dev (17.0.5-r0)
(26/102) Installing libbz2 (1.0.8-r6)
(27/102) Installing lz4-libs (1.9.4-r5)
(28/102) Installing libarchive (3.7.2-r0)
(29/102) Installing rhash-libs (1.4.4-r0)
(30/102) Installing libuv (1.47.0-r0)
(31/102) Installing cmake (3.28.1-r0)
(32/102) Installing libxau (1.0.11-r3)
(33/102) Installing libmd (1.1.0-r0)
(34/102) Installing libbsd (0.11.7-r3)
(35/102) Installing libxdmcp (1.1.4-r3)
(36/102) Installing libxcb (1.16-r0)
(37/102) Installing libx11 (1.8.7-r0)
(38/102) Installing libxext (1.3.5-r3)
(39/102) Installing libxi (1.8.1-r2)
(40/102) Installing libxrender (0.9.11-r4)
(41/102) Installing libxtst (1.2.4-r4)
(42/102) Installing alsa-lib (1.2.10-r0)
(43/102) Installing libpng (1.6.40-r0)
(44/102) Installing freetype (2.13.2-r0)
(45/102) Installing giflib (5.2.1-r5)
(46/102) Installing libjpeg-turbo (3.0.1-r0)
(47/102) Installing lcms2 (2.16-r0)
(48/102) Installing openjdk11-jre (11.0.21_p9-r0)
(49/102) Installing openjdk11-jmods (11.0.21_p9-r0)
(50/102) Installing openjdk11-jdk (11.0.21_p9-r0)
(51/102) Installing abseil-cpp-raw-logging-internal (20230802.1-r0)
(52/102) Installing abseil-cpp-log-internal-globals (20230802.1-r0)
(53/102) Installing abseil-cpp-time-zone (20230802.1-r0)
(54/102) Installing abseil-cpp-log-initialize (20230802.1-r0)
(55/102) Installing abseil-cpp-city (20230802.1-r0)
(56/102) Installing abseil-cpp-low-level-hash (20230802.1-r0)
(57/102) Installing abseil-cpp-hash (20230802.1-r0)
(58/102) Installing abseil-cpp-log-internal-nullguard (20230802.1-r0)
(59/102) Installing abseil-cpp-strings-internal (20230802.1-r0)
(60/102) Installing abseil-cpp-strings (20230802.1-r0)
(61/102) Installing abseil-cpp-log-internal-check-op (20230802.1-r0)
(62/102) Installing abseil-cpp-spinlock-wait (20230802.1-r0)
(63/102) Installing abseil-cpp-base (20230802.1-r0)
(64/102) Installing abseil-cpp-log-internal-conditions (20230802.1-r0)
(65/102) Installing abseil-cpp-debugging-internal (20230802.1-r0)
(66/102) Installing abseil-cpp-stacktrace (20230802.1-r0)
(67/102) Installing abseil-cpp-symbolize (20230802.1-r0)
(68/102) Installing abseil-cpp-examine-stack (20230802.1-r0)
(69/102) Installing abseil-cpp-log-globals (20230802.1-r0)
(70/102) Installing abseil-cpp-int128 (20230802.1-r0)
(71/102) Installing abseil-cpp-str-format-internal (20230802.1-r0)
(72/102) Installing abseil-cpp-time (20230802.1-r0)
(73/102) Installing abseil-cpp-log-internal-format (20230802.1-r0)
(74/102) Installing abseil-cpp-log-sink (20230802.1-r0)
(75/102) Installing abseil-cpp-kernel-timeout-internal (20230802.1-r0)
(76/102) Installing abseil-cpp-malloc-internal (20230802.1-r0)
(77/102) Installing abseil-cpp-synchronization (20230802.1-r0)
(78/102) Installing abseil-cpp-log-internal-log-sink-set (20230802.1-r0)
(79/102) Installing abseil-cpp-log-internal-proto (20230802.1-r0)
(80/102) Installing abseil-cpp-strerror (20230802.1-r0)
(81/102) Installing abseil-cpp-log-internal-message (20230802.1-r0)
(82/102) Installing abseil-cpp-raw-hash-set (20230802.1-r0)
(83/102) Installing abseil-cpp-crc-internal (20230802.1-r0)
(84/102) Installing abseil-cpp-crc32c (20230802.1-r0)
(85/102) Installing abseil-cpp-crc-cord-state (20230802.1-r0)
(86/102) Installing abseil-cpp-throw-delegate (20230802.1-r0)
(87/102) Installing abseil-cpp-cord-internal (20230802.1-r0)
(88/102) Installing abseil-cpp-exponential-biased (20230802.1-r0)
(89/102) Installing abseil-cpp-cordz-functions (20230802.1-r0)
(90/102) Installing abseil-cpp-cordz-handle (20230802.1-r0)
(91/102) Installing abseil-cpp-cordz-info (20230802.1-r0)
(92/102) Installing abseil-cpp-cord (20230802.1-r0)
(93/102) Installing abseil-cpp-status (20230802.1-r0)
(94/102) Installing abseil-cpp-statusor (20230802.1-r0)
(95/102) Installing abseil-cpp-die-if-null (20230802.1-r0)
(96/102) Installing libprotobuf (24.4-r0)
(97/102) Installing libprotoc (24.4-r0)
(98/102) Installing protoc (24.4-r0)
(99/102) Installing unzip (6.0-r14)
(100/102) Installing zip (3.0-r12)
(101/102) Installing .makedepends-java-libsignal-client (20231219.051255)
(102/102) Installing clang17-ccache (17.0.5-r0)

The previous version (v0.36.1) compiles fine.

Ref:

jrose-signal commented 11 months ago

div_ceil was stabilized in Rust 1.73. We don't generally try to support Rust versions older than the current stable. Are you able to update your Rust installation?

bratkartoffel commented 11 months ago

Currently alpine does not support rust 1.73 yet and I don't know exactly when it will upgrade. Furthermore I'm pretty sure it will upgrade only on the unstable branch and not the release branches, like v3.18 or v3.19. Backporting compiler upgrades usually only happen when there are security related fixes, not feature upgrades alone as they're known to break things from time to time.

As far as I can see, Ubuntu 22.04 LTS is still von rust 1.70 and I'm sure other distributions are also somewhere between 1.70 and 1.72.

From a maintainer perspective it's not easy to support a package which depends only on the latest version of a compiler. Can you please maintain some level of compatibility with older compilers?

Edit: Is there any workaround / patch / compiler option I could use to make it work again?

Edit-2: I've created a patch as a workaround: https://gitlab.alpinelinux.org/alpine/aports/-/blob/329bc200017f4593b3cec801e4565eeb4397802c/community/java-libsignal-client/div_ceil-rust-workaround.patch

jrose-signal commented 10 months ago

v0.38.0 removes the use of div_ceil and checks compatibility against Rust 1.72 (already required by some of our dependencies in the full workspace). But as noted in the readme, "Use outside of Signal is unsupported"; ultimately we are not writing this library to be used as a dependency for the standard Linux packaging systems, and may still bump the minimum required tools version. If you don't have access to the required Rust version, you have the imperfect option of staying on an older libsignal instead.

(That said, we're not planning to bump the version capriciously, now that this has been pointed out. It's more likely to be a new language feature that drives the change, such as Return Position impl Trait In Traits.)

jrose-signal commented 10 months ago

See also https://github.com/signalapp/libsignal/issues/490