CI: Fix Building with rocksdb #213

Closed
opened 2022-01-16 23:12:18 +00:00 by jfowl · 16 comments
jfowl commented 2022-01-16 23:12:18 +00:00 (Migrated from gitlab.com)

Since adding rocksdb, the CI fails to compile for arm, armv7 and aarch64.

Below, an log excerpt of the error (for armv7 in this case):

error: failed to run custom build command for `librocksdb-sys v6.20.3`

Caused by:
  process didn't exit successfully: `/home/rust/src/conduit/target/debug/build/librocksdb-sys-68ec048b6f8d2603/build-script-build` (exit status: 101)
  --- stderr
  /usr/include/stdint.h:26:10: fatal error: 'bits/libc-header-start.h' file not found
  /usr/include/stdint.h:26:10: fatal error: 'bits/libc-header-start.h' file not found, err: true
  thread 'main' panicked at 'unable to generate rocksdb bindings: ()', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/librocksdb-sys-6.20.3/build.rs:44:10

The relevant buildscript from rocksdb: https://github.com/rust-rocksdb/rust-rocksdb/blob/master/librocksdb-sys/build.rs#L37

I don't really know how to fix this.

Since adding rocksdb, the CI fails to compile for arm, armv7 and aarch64. Below, an [log excerpt](https://gitlab.com/famedly/conduit/-/jobs/1980441384) of the error (for armv7 in this case): ``` error: failed to run custom build command for `librocksdb-sys v6.20.3` Caused by: process didn't exit successfully: `/home/rust/src/conduit/target/debug/build/librocksdb-sys-68ec048b6f8d2603/build-script-build` (exit status: 101) --- stderr /usr/include/stdint.h:26:10: fatal error: 'bits/libc-header-start.h' file not found /usr/include/stdint.h:26:10: fatal error: 'bits/libc-header-start.h' file not found, err: true thread 'main' panicked at 'unable to generate rocksdb bindings: ()', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/librocksdb-sys-6.20.3/build.rs:44:10 ``` The relevant buildscript from rocksdb: https://github.com/rust-rocksdb/rust-rocksdb/blob/master/librocksdb-sys/build.rs#L37 I don't really know how to fix this.
jfowl commented 2022-01-16 23:14:10 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
jfowl commented 2022-01-16 23:25:00 +00:00 (Migrated from gitlab.com)

Related: https://github.com/rust-rocksdb/rust-rocksdb/issues/550

But I don't know, if something like this would solve our problem, since we want to use musl and not glibc

Related: https://github.com/rust-rocksdb/rust-rocksdb/issues/550 But I don't know, if something like this would solve our problem, since we want to use musl and not glibc
jfowl commented 2022-01-16 23:34:01 +00:00 (Migrated from gitlab.com)

So what appears to fix it:

apt update && apt install -qq gcc-arm-linux-gnueabihf

For armv7: BINDGEN_EXTRA_CLANG_ARGS="-I/usr/arm-linux-gnueabihf/include/" cargo build --target $TARGET

But holy moly, the build script for rocksdb-sys is really slow.

Maybe we can remove some unused compression options @timokoesters ? https://github.com/rust-rocksdb/rust-rocksdb/blob/master/Cargo.toml#L20

So what appears to fix it: ```bash apt update && apt install -qq gcc-arm-linux-gnueabihf ``` For armv7: `BINDGEN_EXTRA_CLANG_ARGS="-I/usr/arm-linux-gnueabihf/include/" cargo build --target $TARGET` But holy moly, the build script for rocksdb-sys is really slow. Maybe we can remove some unused compression options @timokoesters ? https://github.com/rust-rocksdb/rust-rocksdb/blob/master/Cargo.toml#L20
timokoesters commented 2022-01-17 08:26:22 +00:00 (Migrated from gitlab.com)

Good idea, I believe we only need Zstd

Good idea, I believe we only need Zstd
jfowl commented 2022-01-17 16:05:50 +00:00 (Migrated from gitlab.com)
rocksdb = { version = "0.17.0", default-features = false, features = ["multi-threaded-cf", "zstd"], optional = true }

It compiles without and creating an account works.
Any more tests needed?

```toml rocksdb = { version = "0.17.0", default-features = false, features = ["multi-threaded-cf", "zstd"], optional = true } ``` It compiles without and creating an account works. Any more tests needed?
jfowl commented 2022-01-17 18:05:43 +00:00 (Migrated from gitlab.com)

Incremental debug build after setting minimal rocksdb features:

image

Incremental debug build after setting minimal rocksdb features: ![image](/uploads/cd6ed72b71aba11db3396e2fbe44fd76/image.png)
timokoesters commented 2022-01-17 20:53:44 +00:00 (Migrated from gitlab.com)

I think that's okay.

I think that's okay.
jfowl commented 2022-01-17 22:39:31 +00:00 (Migrated from gitlab.com)

changed title from CI: Fix {-arm targets-} to CI: Fix {+Building with rocksdb+}

changed title from **CI: Fix {-arm targets-}** to **CI: Fix {+Building with rocksdb+}**
jfowl commented 2022-01-17 22:40:10 +00:00 (Migrated from gitlab.com)

Update: Everything is broken.

Apparently the x86 builds included libstdc++.

Rainer provides:

$ ldd conduit-x86_64-unknown-linux-musl 
	linux-vdso.so.1 (0x00007ffd5173f000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f73de52b000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f73de3e8000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f73de21f000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f73e0305000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f73de205000)

Might be worth trying to set the -static clang flag

Update: Everything is broken. Apparently the x86 builds included libstdc++. Rainer provides: ``` $ ldd conduit-x86_64-unknown-linux-musl linux-vdso.so.1 (0x00007ffd5173f000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f73de52b000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f73de3e8000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f73de21f000) /lib64/ld-linux-x86-64.so.2 (0x00007f73e0305000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f73de205000) ``` Might be worth trying to set the `-static` clang flag
jfowl commented 2022-01-18 10:19:18 +00:00 (Migrated from gitlab.com)

Nope, -static wasn't it.

BINDGEN_EXTRA_CLANG_ARGS="-static" cargo build --target x86_64-unknown-linux-musl

failed on Alpine.

Nope, `-static` wasn't it. ```bash BINDGEN_EXTRA_CLANG_ARGS="-static" cargo build --target x86_64-unknown-linux-musl ``` failed on Alpine.
timokoesters commented 2022-01-18 22:29:05 +00:00 (Migrated from gitlab.com)

Surprise! Disabling the snappy feature breaks all servers that currently run rocksdb.

Corruption: Unsupported compression method or corrupted compressed block contents: Snappy

Apparently snappy compression will be used even though we did not enable it. We have two options now: Actually use zstd compression and tell all current rocksdb users to do a migration (complicated, you have to migrate to sqlite and then back to a different rocksdb). The second option is to just use snappy compression, which is worse at compression.

Surprise! Disabling the snappy feature breaks all servers that currently run rocksdb. > Corruption: Unsupported compression method or corrupted compressed block contents: Snappy Apparently snappy compression will be used even though we did not enable it. We have two options now: Actually use zstd compression and tell all current rocksdb users to do a migration (complicated, you have to migrate to sqlite and then back to a different rocksdb). The second option is to just use snappy compression, which is worse at compression.
jfowl commented 2022-01-18 23:14:38 +00:00 (Migrated from gitlab.com)

Happy to see the good news stacking up in this issue :D

But in all seriousness: Upgrading from v0.2.0 already was or will be a switch from sqlite to rocksdb, so I would consider it okay to switch to zstd, if it is better.

Happy to see the good news stacking up in this issue :D But in all seriousness: Upgrading from v0.2.0 already was or will be a switch from sqlite to rocksdb, so I would consider it okay to switch to zstd, if it is better.
timokoesters commented 2022-01-19 06:11:05 +00:00 (Migrated from gitlab.com)

mentioned in merge request !259

mentioned in merge request !259
timokoesters commented 2022-01-19 06:32:58 +00:00 (Migrated from gitlab.com)

I pushed a breaking change to next now

I pushed a breaking change to `next` now
maximdeclercq commented 2022-01-21 16:17:34 +00:00 (Migrated from gitlab.com)

mentioned in merge request !261

mentioned in merge request !261
jfowl commented 2022-01-23 15:58:27 +00:00 (Migrated from gitlab.com)

mentioned in commit 4a34d757d7

mentioned in commit 4a34d757d774cbe09bd9fb2ef8fcd69a11c7bb85
Sign in to join this conversation.
No labels
Android
CS::needs customer feedback
CS::needs follow up
CS::needs on prem installation
CS::waiting
Chrome
Design:: Ready
Design:: in progress
Design::UX
E2EE
Edge
Firefox
GDPR
Iteration 13 IM
Linux
MacOS
Need::Discussion
Need::Steps to reproduce
Need::Upstream fix
Needs:: Planning
Needs::Dev-Team
Needs::More information
Needs::Priority
Needs::Product
Needs::Refinement
Needs::Severity
Priority::1-Critical
Priority::2-Max
Priority::3-Impending
Priority::4-High
Priority::5-Medium
Priority::6-Low
Priority::7-None
Progress::Backlog
Progress::Review
Progress::Started
Progress::Testing
Progress::Triage
Progress::Waiting
Reporter::Sentry
Safari
Target::Community
Target::Customer
Target::Internal
Target::PoC
Target::Security
Team:Customer-Success
Team:Design
Team:Infrastructure
Team:Instant-Messaging
Team:Product
Team:Workflows
Type::Bug
Type::Design
Type::Documentation
Type::Feature
Type::Improvement
Type::Support
Type::Tests
Windows
blocked
blocked-by-spec
cla-signed
conduit
contribution::advanced
contribution::easy
contribution::help needed
from::review
iOS
p::ti-tenant
performance
product::triage
proposal
refactor
release-blocker
s: dart_openapi_codegen
s::Famedly-Patient
s::Org-Directory
s::Passport-Generator
s::Requeuest
s:CRM
s:Famedly-App
s:Famedly-Web
s:Fhiroxide
s:Fhiroxide-cli
s:Fhiroxide-client
s:Fhirs
s:Hedwig
s:LISA
s:Matrix-Dart-SDK
s:Role-Manager
s:Synapse
s:User-Directory
s:WFS-Matrix
s:Workflow Engine
s:dtls
s:famedly-error
s:fcm-shared-isolate
s:matrix-api-lite
s:multiple-tab-detector
s:native-imaging
severity::1
severity::2
severity::3
severity::4
technical-debt
voip
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Matthias/conduit#213
No description provided.