Skip to content

Commit ab67a57

Browse files
authored
Add errors.md (#2)
* Add errors.md * refer to errors.md * Update errors.md * Update errors.md * Update errors.md
1 parent 15fa9ec commit ab67a57

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

pkgs/ffigen/errors.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Errors in ffigen
2+
3+
This file documents various errors and their potential fixes related to ffigen.
4+
5+
## Errors in source header files
6+
7+
Under the hood ffigen uses libclang to parse header files. Any compiler warnings/errors should be logged (with SEVERE level), these should be resolved as it can potentially generate *incomplete* or *invalid* bindings that might cause silent errors at runtime.
8+
9+
> You can pass in args to libclang using `compiler-opts` via cmd line or yaml config or both.
10+
11+
Here we'll list some common usecases. You can find the full list of [supported args here](https://clang.llvm.org/docs/ClangCommandLineReference.html#id5).
12+
13+
### Missing headers
14+
15+
These are the most common source file errors. You can specify [include paths to clang](https://clang.llvm.org/docs/ClangCommandLineReference.html#id6) like this
16+
```yaml
17+
compiler-opts:
18+
- "-I/path/to/folder"
19+
```
20+
21+
### Ignoring source errors
22+
23+
As a last resort, you can pass in `--ignore-source-errors` or set `ignore-source-errors: true` in yaml config.

pkgs/ffigen/lib/src/header_parser/parser.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ List<Binding> parseToBindings(Config c) {
123123
_logger.warning("Ignored source errors. (ObjC)");
124124
} else {
125125
_logger.severe(
126-
"Skipped generating bindings due to errors in source files. Either resolve or ignore them (Set --ignore-source-errors on cmd or ignore-source-errors:true in config.");
126+
"Skipped generating bindings due to errors in source files. See https://github.com/dart-lang/native/blob/main/pkgs/ffigen/errors.md.");
127127
exit(1);
128128
}
129129
}

0 commit comments

Comments
 (0)