Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: tikv编译问题
When compiling the release-7.2 version of TiKV, the above issue occurred. Has anyone encountered this before?
Currently, compiling separately under the downloaded rocksdb also results in errors. Could it be that there is an issue with rocksdb?
When compiling, I encountered an issue with the date format. It looks like the Git version is a bit old. Check if there is a hardcoded date format in your build files and see where this date format is being referenced.
Encountered another problem.
Setting up the compilation environment is really exhausting.
I strongly suggest you write a document about it once you’re done, and I’ll definitely support it.
This seems to be an issue with the C++ standard, but I’m not sure how to handle it.
Initially, I directly modified the code for RocksDB and it compiled successfully. This one is not easy to modify.
/root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/grpcio-sys-0.10.3+1.44.0-patched/grpc/third_party/abseil-cpp
What is the reason for this TiKV compilation issue?
There are also related issues when compiling small test cases on Rust’s wiki. This is really something I can’t figure out at the moment.
I guess a specific version of Rust is needed to compile successfully.
[root@tikv1 bin]# ./tikv-server --version
TiKV
Release Version: 7.1.0
Edition: Community
Git Commit Hash: 0c34464e386940a60f2a2ce279a4ef18c9c6c45b
Git Commit Branch: heads/refs/tags/v7.1.0
UTC Build Time: 2023-05-25 01:58:10
Rust Version: rustc 1.67.0-nightly (96ddd32c4 2022-11-14)
Enable Features: pprof-fp jemalloc mem-profiling portable sse test-engine-kv-rocksdb test-engine-raft-raft-engine cloud-aws cloud-gcp cloud-azure
Profile: dist_release
The version parameters of the running TiKV are like this.
The Rust version is 1.67.0
opened 10:06PM - 15 Oct 20 UTC
T-libs-api
B-unstable
C-tracking-issue
A-iterators
A-str
Libs-Tracked
<!--
Thank you for creating a tracking issue! 📜 Tracking issues are for trackin… g a
feature from implementation to stabilisation. Make sure to include the relevant
RFC for the feature if it has one. Otherwise provide a short summary of the
feature and link any relevant PRs or issues, and remove any sections that are
not relevant to the feature.
Remember to add team labels to the tracking issue.
For a language team feature, this would e.g., be `T-lang`.
Such a feature should also be labeled with e.g., `F-my_feature`.
This label is used to associate issues (e.g., bugs and design questions) to the feature.
-->
This is a tracking issue for the methods implemented in #75265 and #82570, which allow viewing the remainder of the underlying string in str-split iterators. E.g.:
```rust
let mut split = "Mary had a little lamb".split(' ');
assert_eq!(split.remainder(), Some("Mary had a little lamb"));
_ = split.next();
assert_eq!(split.remainder(), Some("had a little lamb"));
split.by_ref().for_each(drop);
assert_eq!(split.remainder(), None);
```
The feature gates for the issue are `#![feature(str_split_remainder)]` (for most split iterators), `#![feature(str_split_inclusive_remainder)]` (for `SplitInclusive`) and `#![feature(str_split_whitespace_remainder)]` (for `SplitWhitespace` and `SplitAsciiWhitespace`).
### Public API
```rust
// mod core::str
impl<'a, P: Pattern<'a>> Split<'a, P> {
fn remainder(&self) -> Option<&'a str>;
}
// And the same for
// - `RSplit<'a, P>`
// - `SplitTerminator<'a, P>`
// - `RSplitTerminator<'a, P>`
// - `SplitN<'a, P>`
// - `RSplitN<'a, P>`
// - `SplitWhitespace<'a>`
// - `SplitAsciiWhitespace<'a>`
// - `SplitInclusive<'a, P>`
```
### Steps
<!--
Include each step required to complete the feature. Typically this is a PR
implementing a feature, followed by a PR that stabilises the feature. However
for larger features an implementation could be broken up into multiple PRs.
-->
- [x] Implement the feature
- [x] Adjust documentation ([see instructions on rustc-dev-guide][doc-guide])
- [ ] Stabilization PR ([see instructions on rustc-dev-guide][stabilization-guide])
[stabilization-guide]: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#stabilization-pr
[doc-guide]: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#documentation-prs
### Unresolved Questions
<!--
Include any open questions that need to be answered before the feature can be
stabilised.
-->
- ~~Should empty strings point to the end of the haystack, or they can be arbitrary constants? (see https://github.com/rust-lang/rust/pull/75265#discussion_r487358752)~~ `None` is now returned instead of an empty string, making this irrelevant
### Implementation history
- #75265 — implemented `as_str` methods on `core::str::{Split,RSplit,SplitN,RSplitN,SplitTerminator,RSplitTerminator,SplitInclusive}`
- #82570 — implemented `as_str` methods on `core::str::{SplitWhitespace, SplitAsciiWhitespace}`
- #95644 — renamed `as_str`=>`remainder` and changed return type to `Option<&str>`
I also found a similar bug under rust-lang on GitHub. It was closed and then reopened.
The reopen date is exactly 2023.1.30, which is right after this
Rust Version: rustc 1.67.0-nightly (96ddd32c4 2022-11-14)
Consider trying again with a specific Rust version.
Currently, this can be compiled using Rust 2022.
However, currently, there are errors when compiling the last two modules tikv-ctl(bin) and tikv-server(bin). According to online sources, the issue is caused by cross-compilation problems.
I am still looking for the cause.
I compiled the release 7.2 version.
I think you are very close to success.
The documentation says to use rustup to manage the toolchain, and the toolchain only installed two tools: rustfmt and clippy.
# Contributing to TiKV
Thanks for your interest in contributing to TiKV! This document outlines some of the conventions on building, running, and testing TiKV, the development workflow, commit message formatting, contact points and other resources.
TiKV has many dependent repositories. If you need any help or mentoring getting started, understanding the codebase, or making a PR (or anything else really), please ask on [Slack](https://tikv.org/chat). If you don't know where to start, please click on the contributor icon below to get you on the right contributing path.
[<img src="images/contribution-map.png" alt="contribution-map" width="180">](https://github.com/pingcap/tidb-map/blob/master/maps/contribution-map.md#tikv-distributed-transactional-key-value-database)
## Building and setting up a development workspace
TiKV is mostly written in Rust, but has components written in C++ (RocksDB, gRPC). We are currently using the Rust nightly toolchain. To provide consistency, we use linters and automated formatting tools.
### Prerequisites
To build TiKV you'll need to at least have the following installed:
* `git` - Version control
* [`rustup`](https://rustup.rs/) - Rust installer and toolchain manager
* `make` - Build tool (run common workflows)
* `cmake` - Build tool (required for gRPC)
This file has been truncated. show original
If convenient, please provide a complete screenshot to see which specific third-party dependency is missing.
Nowadays, everything is done in containers. I suggest you take a look at the official Dockerfile and follow it.
# This Docker image contains a minimal build environment for TiKV
#
# It contains all the tools necessary to reproduce official production builds of TiKV
# We need to use CentOS 7 because many of our users choose this as their deploy machine.
# Since the glibc it uses (2.17) is from 2012 (https://sourceware.org/glibc/wiki/Glibc%20Timeline)
# it is our lowest common denominator in terms of distro support.
# Some commands in this script are structured in order to reduce the number of layers Docker
# generates. Unfortunately Docker is limited to only 125 layers:
# https://github.com/moby/moby/blob/a9507c6f76627fdc092edc542d5a7ef4a6df5eec/layer/layer.go#L50-L53
# We require epel packages, so enable the fedora EPEL repo then install dependencies.
# Install the system dependencies
# Attempt to clean and rebuild the cache to avoid 404s
# To avoid rebuilds we first install all Cargo dependencies
# The prepare image avoid ruining the cache of the builder
This file has been truncated. show original
The compilation has been completed, and it is currently in the code debugging stage.
Awesome, I want to compile one too…
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.