Bear 4.2.4
Permanent link:
cppdashboard.dev/r/2026/11/bear-4-2-4Generate compile_commands.json for any C or C++ build
Release notes
Bear 4.2.4 is a maintenance release. It fixes a hang when appending to a truncated database, records MSVC environment flags correctly, builds for Android without patches, and makes packaging easier. Building Bear now needs Rust 1.89. ### Features - **`LIBEXECDIR` install variable** - `scripts/install.sh` can now put Bear's helpers somewhere other than `$PREFIX/libexec`, for distributions without that directory. For example, `PREFIX=/usr LIBEXECDIR=/usr/lib`. Like `PREFIX`, it is an on-system path and `DESTDIR` is prepended to it. ### Bug Fixes - **Append no longer hangs on a broken database** - appending to an empty or truncated `compile_commands.json` hung forever and flooded stderr with "failed to fill whole buffer". Bear now warns and goes on. - **MSVC `CL` and `_CL_` values keep their backslashes** - they were split with POSIX shell rules, so `CL="/IC:\foo /W4"` became `/IC:foo`. They now use Windows command-line rules. - **The compiler stays first in an entry** - with `CL=/O2` or `ARMCOMPILER6_CLANGOPT`, the added flags landed before the compiler, so `arguments[0]` was not the compiler. - **Ada body files are recognized** - a typo in the extension list matched `.abd` instead of `.adb`. - **Drops from an unresolved directory are counted** - with the canonical directory format, an entry whose working directory could not be resolved was dropped with a vague warning and left out of the summary. Bear now warns once per file and counts these drops, so a run that drops every entry this way gives the all-dropped error. - **Wrapper mode rewrites only compiler program variables** - `CARGO`, `RUSTC` and `RUSTC_WRAPPER` are no longer pointed at wrappers, so cargo builds run untouched. CMake's language variables are added, so a `CUDACXX` or `OBJC` compiler is wrapped too. The make `*FLAGS` variables are no longer kept in the captured environment. If you read that environment from the events file, note the change. - **An empty compiler variable now logs a warning** - as a whitespace-only value already did. - **Android builds without patches** - the supervisor no longer needs `confstr`. The preload library leaves `popen`, `pclose` and `system` to bionic, and keeps the `exec` family. `posix_spawn` and `posix_spawnp` are intercepted on API 28 and later only. - **Build probes check the target** - cross builds used the answers from the host libc. Symbol probes now link against the target libc, and a missing `execve` shows the compiler's output. - **The preload library build picks a linker that works** - each linker is tried with a small test link first. The `rust-lld` from rustup, which has no zlib support, is skipped on hosts such as FreeBSD, and Bear reports the downgrade. (#722) - **The preload library installs as an executable** - mode 0755, so RPM's debuginfo and strip steps process it. openSUSE, Slackware and Fedora no longer need their own `chmod` or install step. - Removed the musl `__execvpe` wrapper. musl does not export that symbol, so it could never run. ### Internal Refactoring - **Rust 1.89 is now required and declared** - `INSTALL.md` said 1.85, but the code already needed more. An older toolchain now fails with a clear message instead of a compile error. - **Fewer dependencies** - `tempfile` left the shipped binaries, and five crates with it. `crossbeam-channel` was replaced by std channels. - Moved to `serde-saphyr` 2.0. Updated `cc`, `insta` and `proptest`. - Stricter lints: no `unwrap` outside test code, a `SAFETY` comment on every `unsafe` block, and a reason on every `allow`. - CI now runs the tests on Alpine (musl) and aarch64 Linux, cross-builds for Android, and checks crates with `cargo-deny`, with advisories on a schedule. - Build warnings fixed for hosts without `setsid`, and a test fixed for hosts where `execvp` cannot be intercepted. (#720, #721) ### Documentation - The requirements and rationale were swept and trimmed, with one own…
Share this resource