fix building

This commit is contained in:
2026-02-17 12:32:09 -06:00
parent 027c1549fc
commit f7f26a1f00
3 changed files with 179 additions and 40 deletions

View File

@@ -255,6 +255,8 @@ If your package is at `/path/to/mypkg`, this becomes `-I/path/to/mypkg/sdk/publi
Absolute paths are passed through unchanged.
The build system also auto-discovers `include/` directories — if your package has an `include/` directory, it is automatically added to the include path. No need to add `-I$PACKAGE/include` in cell.toml.
### Library paths
Relative `-L` paths work the same way:
@@ -285,9 +287,13 @@ Available targets: `macos_arm64`, `macos_x86_64`, `linux`, `linux_arm64`, `windo
### Sigils
Use `$LOCAL` in flags to refer to the `.cell/local` directory (for prebuilt libraries):
Use sigils in flags to refer to standard directories:
- `$LOCAL` — absolute path to `.cell/local` (for prebuilt libraries)
- `$PACKAGE` — absolute path to the package root
```toml
CFLAGS = "-I$PACKAGE/vendor/include"
LDFLAGS = "-L$LOCAL -lmyprebuilt"
```
@@ -495,3 +501,32 @@ static int module_state = 0;
```
This prevents symbol conflicts between packages.
## Troubleshooting
### Missing header / SDK not installed
If a package wraps a third-party SDK that isn't installed on your system, the build will show:
```
module.c: fatal error: 'sdk/header.h' file not found (SDK not installed?)
```
Install the required SDK or skip that package. These warnings are harmless — other packages continue building normally.
### CFLAGS not applied
If your `cell.toml` has a `[compilation]` section but flags aren't being picked up, check:
1. The TOML syntax is valid (strings must be quoted)
2. The section header is exactly `[compilation]` (not `[compile]` etc.)
3. Target-specific sections use valid target names: `macos_arm64`, `macos_x86_64`, `linux`, `linux_arm64`, `windows`
### API changes from older versions
If C modules fail with errors about function signatures:
- `JS_IsArray` takes one argument (the value), not two — remove the context argument
- Use `JS_GetPropertyNumber` / `JS_SetPropertyNumber` instead of `JS_GetPropertyUint32` / `JS_SetPropertyUint32`
- Use `JS_NewString` instead of `JS_NewAtomString`
- There is no `undefined` — use `JS_IsNull` and `JS_NULL` only