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

scripts/zig-rpc-server.sh fails to build for i686 and armv7 #4799

Closed
link2xt opened this issue Oct 7, 2023 · 2 comments
Closed

scripts/zig-rpc-server.sh fails to build for i686 and armv7 #4799

link2xt opened this issue Oct 7, 2023 · 2 comments
Labels
bug Something is not working

Comments

@link2xt
Copy link
Collaborator

link2xt commented Oct 7, 2023

The error is this:

   Compiling deltachat-rpc-server v1.124.1 (/home/link2xt/deltachat-core-rust/deltachat-rpc-server)
error: linking with `/home/link2xt/deltachat-core-rust/scripts/zig-cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/home/link2xt/deltachat-core-rust/zig-linux-x86_64-0.11.0:/usr/local/concourse/bin:/home/link2xt/bin:/usr/local/concourse/bin:/home/link2xt/bin:/home/link2xt/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" VSLANG="1033" "/home/link2xt/deltachat-core-rust/scripts/zig-cc" "/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/armv7-unknown-linux-musleabihf/lib/self-contained/crt1.o" "/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/armv7-unknown-linux-musleabihf/lib/self-contained/crti.o" "/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/armv7-unknown-linux-musleabihf/lib/self-contained/crtbegin.o" "/tmp/rustcK91Vnt/symbols.o" "/home/link2xt/deltachat-core-rust/target/armv7-unknown-linux-musleabihf/release/deps/deltachat_rpc_server-2685b2d74e0caaf9.deltachat_rpc_server.369006fa916dd54-cgu.0.rcgu.o" "-Wl,--as-needed" "-L" "/home/link2xt/deltachat-core-rust/target/armv7-unknown-linux-musleabihf/release/deps" "-L" "/home/link2xt/deltachat-core-rust/target/release/deps" "-L" "/home/link2xt/deltachat-core-rust/target/armv7-unknown-linux-musleabihf/release/build/openssl-sys-6d083e89a05b6e70/out/openssl-build/install/lib" "-L" "/home/link2xt/deltachat-core-rust/target/armv7-unknown-linux-musleabihf/release/build/ring-099a854b424cc283/out" "-L" "/home/link2xt/deltachat-core-rust/target/armv7-unknown-linux-musleabihf/release/build/libsqlite3-sys-e4e543534d490216/out" "-L" "/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/armv7-unknown-linux-musleabihf/lib" "-Wl,-Bstatic" "/tmp/rustcK91Vnt/libring-4f26a25b8a3f11b6.rlib" "/tmp/rustcK91Vnt/liblibsqlite3_sys-5a7789aab29d9564.rlib" "/tmp/rustcK91Vnt/libopenssl_sys-8b6a95c7962f0ffc.rlib" "-lunwind" "-lc" "/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/armv7-unknown-linux-musleabihf/lib/libcompiler_builtins-fc76a4f69f9e639e.rlib" "-Wl,-Bdynamic" "-latomic" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-nostartfiles" "-L" "/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/armv7-unknown-linux-musleabihf/lib" "-L" "/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/armv7-unknown-linux-musleabihf/lib/self-contained" "-o" "/home/link2xt/deltachat-core-rust/target/armv7-unknown-linux-musleabihf/release/deps/deltachat_rpc_server-2685b2d74e0caaf9" "-Wl,--gc-sections" "-static" "-no-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/armv7-unknown-linux-musleabihf/lib/self-contained/crtend.o" "/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/armv7-unknown-linux-musleabihf/lib/self-contained/crtn.o"
  = note: error: unable to find Dynamic system library 'atomic' using strategy 'no_fallback'. searched paths:
            /home/link2xt/deltachat-core-rust/target/armv7-unknown-linux-musleabihf/release/deps/libatomic.so
            /home/link2xt/deltachat-core-rust/target/release/deps/libatomic.so
            /home/link2xt/deltachat-core-rust/target/armv7-unknown-linux-musleabihf/release/build/openssl-sys-6d083e89a05b6e70/out/openssl-build/install/lib/libatomic.so
            /home/link2xt/deltachat-core-rust/target/armv7-unknown-linux-musleabihf/release/build/ring-099a854b424cc283/out/libatomic.so
            /home/link2xt/deltachat-core-rust/target/armv7-unknown-linux-musleabihf/release/build/libsqlite3-sys-e4e543534d490216/out/libatomic.so
            /home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/armv7-unknown-linux-musleabihf/lib/libatomic.so
            /home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/armv7-unknown-linux-musleabihf/lib/libatomic.so
            /home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/armv7-unknown-linux-musleabihf/lib/self-contained/libatomic.so

This is the reason releases do not have deltachat-rpc-server binaries anymore.

Here is a related upstream issue for zig regarding full support of atomics: ziglang/zig#14889

The builds worked previously though, I suspect that the reason is OpenSSL 3.0 upgrade.
With the following patch reverting ed781af it works:

diff --git a/Cargo.lock b/Cargo.lock
index bfd31e42..5d24858f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3078,11 +3078,11 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
 
 [[package]]
 name = "openssl"
-version = "0.10.57"
+version = "0.10.55"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c"
+checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d"
 dependencies = [
- "bitflags 2.3.3",
+ "bitflags 1.3.2",
  "cfg-if",
  "foreign-types",
  "libc",
@@ -3110,18 +3110,18 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
 
 [[package]]
 name = "openssl-src"
-version = "300.1.5+3.1.3"
+version = "111.26.0+1.1.1u"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "559068e4c12950d7dcaa1857a61725c0d38d4fc03ff8e070ab31a75d6e316491"
+checksum = "efc62c9f12b22b8f5208c23a7200a442b2e5999f8bdf80233852122b5a4f6f37"
 dependencies = [
  "cc",
 ]
 
 [[package]]
 name = "openssl-sys"
-version = "0.9.93"
+version = "0.9.90"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d"
+checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6"
 dependencies = [
  "cc",
  "libc",

Related issue in the rust-openssl repository: sfackler/rust-openssl#2043

@link2xt
Copy link
Collaborator Author

link2xt commented Oct 15, 2023

I have tried to filter out -latomic in zig-cc wrapper, but it results in this error:

error: linking with `/home/link2xt/deltachat-core-rust/scripts/zig-cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/home/link2xt/deltachat-core-rust/zig-linux-x86_64-0.11.0:/usr/local/concourse/bin:/home/link2xt/bin:/home/link2xt/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" VSLANG="1033" "/home/link2xt/deltachat-core-rust/scripts/zig-cc" "-m32" "-Wl,-melf_i386" "/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/self-contained/crt1.o" "/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/self-contained/crti.o" "/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/self-contained/crtbegin.o" "/tmp/rustccwqKEu/symbols.o" "/home/link2xt/deltachat-core-rust/target/i686-unknown-linux-musl/release/deps/deltachat_rpc_server-ca966cdcd6e2b2a0.deltachat_rpc_server.5558f3cb83a67988-cgu.0.rcgu.o" "-Wl,--as-needed" "-L" "/home/link2xt/deltachat-core-rust/target/i686-unknown-linux-musl/release/deps" "-L" "/home/link2xt/deltachat-core-rust/target/release/deps" "-L" "/home/link2xt/deltachat-core-rust/target/i686-unknown-linux-musl/release/build/openssl-sys-8928e712ecb93492/out/openssl-build/install/lib" "-L" "/home/link2xt/deltachat-core-rust/target/i686-unknown-linux-musl/release/build/blake3-a9ef50d8934ccb0f/out" "-L" "/home/link2xt/deltachat-core-rust/target/i686-unknown-linux-musl/release/build/ring-55b67fe8243be04b/out" "-L" "src/backend/linux_raw/arch/outline/release" "-L" "/home/link2xt/deltachat-core-rust/target/i686-unknown-linux-musl/release/build/libsqlite3-sys-a2db76a3595c28cd/out" "-L" "src/backend/linux_raw/arch/outline/release" "-L" "/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib" "-Wl,-Bstatic" "/tmp/rustccwqKEu/librustix-4a060223dcefa05d.rlib" "/tmp/rustccwqKEu/libring-1d54c7f06d564203.rlib" "/tmp/rustccwqKEu/libblake3-c1a281a6d275b9e3.rlib" "/tmp/rustccwqKEu/liblibsqlite3_sys-a4c10f66380ecaf0.rlib" "/tmp/rustccwqKEu/libopenssl_sys-9cf4f5ec2eb65221.rlib" "-lunwind" "-lc" "/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/libcompiler_builtins-df49b7e25485b7d5.rlib" "-Wl,-Bdynamic" "-latomic" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-nostartfiles" "-L" "/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib" "-L" "/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/self-contained" "-o" "/home/link2xt/deltachat-core-rust/target/i686-unknown-linux-musl/release/deps/deltachat_rpc_server-ca966cdcd6e2b2a0" "-Wl,--gc-sections" "-static" "-no-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/self-contained/crtend.o" "/home/link2xt/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/self-contained/crtn.o"
  = note: ld.lld: error: undefined symbol: __atomic_is_lock_free
          >>> referenced by threads_pthread.c:229 (crypto/threads_pthread.c:229)
          >>>               libcrypto-lib-threads_pthread.o:(CRYPTO_atomic_or) in archive /tmp/rustccwqKEu/libopenssl_sys-9cf4f5ec2eb65221.rlib
          >>> referenced by threads_pthread.c:254 (crypto/threads_pthread.c:254)
          >>>               libcrypto-lib-threads_pthread.o:(CRYPTO_atomic_load) in archive /tmp/rustccwqKEu/libopenssl_sys-9cf4f5ec2eb65221.rlib

@link2xt
Copy link
Collaborator Author

link2xt commented Oct 15, 2023

I have pushed a workaround: 54ea3ec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working
Projects
None yet
Development

No branches or pull requests

1 participant