crashappsec / crashappsec/ncc

Build fails on clang 18: --embed-dir requires clang 19+ (README claim of 'Clang 18+' is stale)

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
0
Forks
0
Avg merge
5d 4h
Merged PRs (30d)
1

Description

## Summary

The README states `Clang 18+, or gcc 14+ should both work`, but the build fails on clang 18. `meson.build` passes `--embed-dir=...` to the C compiler for `#embed` support, and that flag was not introduced in clang until version 19.

## Repro

On Ubuntu 24.04 (default `clang` is 18):

```
$ CC=clang meson setup build && meson compile -C build
...
clang: error: unknown argument: '--embed-dir=/path/to/ncc'
```

## Where it comes from

`meson.build` line 181 (current `main`):

```meson
c_args : c_args + coverage_args + ['--embed-dir=' + meson.current_source_dir()],
```

The flag was added in commit `bbdc5ea` ("Add --embed-dir to ncc executable build for #embed support"), pre-dating the Windows portability PR.

## Suggested fixes (any one)

1. Update README to say `Clang 19+` (and bump the gcc claim if `#embed` support there is similarly version-gated).
2. Guard the flag: only add it if the compiler accepts it.
```meson
if cc.has_argument('--embed-dir=' + meson.current_source_dir())
c_args_ncc += ['--embed-dir=' + meson.current_source_dir()]
endif
```
3. Drop `--embed-dir` if `#embed` isn't actually used in code paths that matter for current builds.

Encountered while validating PR #1 (Windows portability) on a fresh Ubuntu 24.04 + clang 18 environment.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.