mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Add rust sanitizer support with vendored deps
This commit is contained in:
parent
e274bd7b64
commit
88b11f7352
2
contrib/rust_vendor
vendored
2
contrib/rust_vendor
vendored
@ -1 +1 @@
|
||||
Subproject commit dfaa5b14e611bc7883a23b4c157275d2a4c63fae
|
||||
Subproject commit e7859fff9fcaa31256ef76afa1b65687f6814dbd
|
@ -1,24 +1,47 @@
|
||||
As we have multiple projects we use a workspace to manage them (it's way simpler and leads to less issues). In order
|
||||
to vendor all the dependencies we need to store both the registry and the packages themselves.
|
||||
|
||||
* First step: (Re)-generate the Cargo.lock file (run under `workspace/`)
|
||||
Note that this includes the exact `std` dependencies for the rustc version used in CI (currently nightly-2023-07-04),
|
||||
so you need to install `rustup component add rust-src` for the specific version.
|
||||
|
||||
* First step: (Re)-generate the Cargo.lock file (run under `workspace/`).
|
||||
|
||||
```bash
|
||||
$ cargo generate-lockfile
|
||||
cargo generate-lockfile
|
||||
```
|
||||
|
||||
* Generate the local registry:
|
||||
|
||||
To install the tool if you don't already have it:
|
||||
Note that we use both commands to vendor both registry and crates. No idea why both are necessary.
|
||||
|
||||
* First we need to install the tool if you don't already have it:
|
||||
```bash
|
||||
cargo install --version 0.2.6 cargo-local-registry
|
||||
```
|
||||
|
||||
Now run:
|
||||
* Now add the local packages:
|
||||
|
||||
```bash
|
||||
cargo local-registry --git --sync Cargo.lock ../../contrib/rust_vendor
|
||||
cargo vendor --no-delete --locked ../../contrib/rust_vendor
|
||||
export CH_TOP_DIR=$(git rev-parse --show-toplevel)
|
||||
export RUSTC_ROOT=$(rustc --print=sysroot)
|
||||
|
||||
cd "$CH_TOP_DIR"/rust/workspace
|
||||
|
||||
cargo local-registry --git --sync Cargo.lock "$CH_TOP_DIR"/contrib/rust_vendor
|
||||
cp "$RUSTC_ROOT"/lib/rustlib/src/rust/Cargo.lock "$RUSTC_ROOT"/lib/rustlib/src/rust/library/std/
|
||||
cargo local-registry --no-delete --git --sync "$RUSTC_ROOT"/lib/rustlib/src/rust/library/std/Cargo.lock "$CH_TOP_DIR"/contrib/rust_vendor
|
||||
cp "$RUSTC_ROOT"/lib/rustlib/src/rust/Cargo.lock "$RUSTC_ROOT"/lib/rustlib/src/rust/library/test/
|
||||
cargo local-registry --no-delete --git --sync "$RUSTC_ROOT"/lib/rustlib/src/rust/library/test/Cargo.lock "$CH_TOP_DIR"/contrib/rust_vendor
|
||||
|
||||
cargo vendor --no-delete --locked "$CH_TOP_DIR"/contrib/rust_vendor
|
||||
cd "$RUSTC_ROOT"/lib/rustlib/src/rust/library/std/
|
||||
cargo vendor --no-delete "$CH_TOP_DIR"/contrib/rust_vendor
|
||||
cd "$RUSTC_ROOT"/lib/rustlib/src/rust/library/test/
|
||||
cargo vendor --no-delete "$CH_TOP_DIR"/contrib/rust_vendor
|
||||
|
||||
rm "$RUSTC_ROOT"/lib/rustlib/src/rust/library/std/Cargo.lock "$RUSTC_ROOT"/lib/rustlib/src/rust/library/test/Cargo.lock
|
||||
cd "$CH_TOP_DIR"/rust/workspace
|
||||
```
|
||||
|
||||
Note that we use both commands to vendor both registry and crates. No idea why both are necessary.
|
||||
The `rustc --print=sysroot` part includes `std` dependencies, required to build with sanitizer flags. It must be kept
|
||||
in sync with the rustc version used in CI.
|
||||
|
@ -1,6 +1,15 @@
|
||||
[env]
|
||||
CFLAGS = "@RUST_CFLAGS@"
|
||||
CXXFLAGS = "@RUST_CXXFLAGS@"
|
||||
|
||||
[build]
|
||||
rustflags = @RUSTFLAGS@
|
||||
rustdocflags = @RUSTFLAGS@
|
||||
@RUSTCWRAPPER@
|
||||
|
||||
[unstable]
|
||||
@RUST_CARGO_BUILD_STD@
|
||||
|
||||
[source.crates-io]
|
||||
registry = 'sparse+https://index.crates.io/'
|
||||
replace-with = 'local-registry'
|
||||
|
Loading…
Reference in New Issue
Block a user