Issues Regarding Development Tools and TiKV Compilation

This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 关于开发工具以及tikv编译的问题

| username: Zhoutzzz

I want to know if you use the VSCode or Intellij Rust plugin to write Rust. Recently, I pulled down the TiKV source code and encountered some issues compiling it with both the VSCode and Intellij plugins. I’m not sure how to resolve these problems. Below are the issues that occurred with VSCode and the Rust plugin. Any advice would be appreciated.

This is the error that VSCode always reports during compilation.
未命名.md (3.8 KB)

| username: pingyu | Original post link

Based on my personal experience, the Intellij Rust plugin is relatively more stable than rust-analyzer. Sometimes rust-analyzer fails to output the outline and cannot go to definition, requiring a window reload.

However, both plugins have some bad cases where they consider some code that can compile normally to have issues. Macros are more prone to problems, and I guess the plugins’ implementation of macros differs from rustc.

For the second issue of “Unresolved reference: enumerate,” I tried adding a line “use std::iter::Iterator as StdIterator;” which resolved the error. Here, enumerate is obtained through the trait Itertools: Iterator. It seems the Rust plugin cannot handle this situation well.

Lastly, afl compilation failed. I encountered this a long time ago but forgot how I resolved it. From some online resources, it might be related to your compilation environment (How to compile AFL's LLVM mode in OS X | Reverse Engineering). If you are not using the latest version of macOS and Xcode toolchain, I suggest upgrading to the latest version.

Additionally, cargo check error: failed to run custom build command for `afl v0.6.0` · Issue #7675 · tikv/tikv · GitHub explains how to skip afl (using --exclude fuzzer-afl), which you can also try.

| username: Zhoutzzz | Original post link

I recently switched to VSCode and tried it out. Indeed, there are some issues with the “go to” functionality, specifically issues 2 and 3. Although VSCode itself is fine, the plugins have some problems. After looking around, it seems that to avoid IDE errors, some modifications are necessary. For the AFL issue, I resolved it by commenting out the dependency. I still find VSCode a bit hard to get used to, but one good thing about it is that it can jump to protobuf, whereas the Rust plugin cannot. The code suggestions in VSCode also don’t seem as good as the Rust plugin. Last time I asked in Discord, someone mentioned that the Rust plugin doesn’t support proc macros. Both of these IDEs have limited support for Rust, so I guess I’ll just have to make do.

| username: pingyu | Original post link

The Rust plugin currently has experimental support for proc macros, which was previously disabled by default (not sure if there have been changes in recent versions). If you need to enable it, refer to

| username: system | Original post link

This topic was automatically closed 1 minute after the last reply. No new replies are allowed.