Ffigen Troubleshooting
LLVM needs to be installed
The ffigen, a popular Flutter official package used by flutter_rust_bridge, requires the installation of LLVM.
According to its documentation, the commands are:
- Windows
- MacOS
- Linux apt-get
- Linux dnf
- Install Visual Studio with C++ development support.
- Install LLVM or
winget install -e --id LLVM.LLVM
.
- Install Xcode.
- Install Xcode command line tools -
xcode-select --install
. - Install LLVM -
brew install llvm
.
- Install libclangdev -
sudo apt-get install libclang-dev
.
- Install libclangdev -
sudo dnf install clang-devel
.
After installation, if the ffigen
used by flutter_rust_bridge_codegen
still cannot find LLVM,
you may specify it explicitly via --llvm-path <YOUR_LLVM_PATH>
(command line)
or llvm_path: <YOUR_LLVM_PATH>
(configuration file).
The generated store_dart_post_cobject() has the wrong signature / 'stdarg.h' file not found
in Linux / stdbool.h
/ ...
Try to run code generator with working directory at /
, or set the environment variable:
export CPATH="$(clang -v 2>&1 | grep "Selected GCC installation" | rev | cut -d' ' -f1 | rev)/include"
as described in ffigen #257, or add include path as is described in #108. This is a problem with Rust's builtin Command
. See also: #472 & #494.