github rizsotto/Bear 4.3.0

2 hours ago

Bear 4.3.0 changes some defaults. Response files are now read, and entries
for missing source files are dropped again. Bear also ends the way the build
ends, handles Ctrl-C with care, and reports over a UNIX socket. Logs from
another machine get their own switch. Building Bear now needs Rust 1.90.

Features

  • Response files are inlined by default - @file arguments are replaced
    by the file's flags, so a source or a -E inside the file is seen. Set
    arguments.from_response_files: false to keep the old behavior. Bear logs
    once whether it reads them. A flag value that starts with @, such as
    -install_name @rpath/x, is no longer taken for a response file, so macOS
    links stop warning. A file that is gone (Ninja deletes them) stays as
    @file with a warning.
  • sources.only_existing_files works again, on by default - the key was
    ignored since 4.0.3. Entries whose source file is known to be missing are
    dropped. Entries read back with --append are checked too, so
    --append with a no-op build trims a stale database. When nothing is written,
    one error line names every cause. In combined mode a file the build deletes
    after compiling is usually kept. In semantic and parse-sh mode it is
    dropped.
  • --no-local-lookups for bear semantic and bear parse-sh - use it
    for a log or events file from another machine. The missing-source filter
    is off, configured compiler paths need not exist here, parse-sh starts
    from an empty environment, and response files are not read. No compiler is
    run and no path is resolved. An unconfigured cc, c++ or CC is parsed
    with the Clang table, which can misread rare GCC-only flags such as -load.
    Settings that read this machine's files are rejected with an error that
    names the key.
  • Reports travel over a UNIX socket - on Unix, each intercepted call
    reports to Bear through a private socket, not loopback TCP. A build step in
    its own network namespace (bitbake, discussion #724) is now captured, and
    other local users cannot write to it. If no socket can be made, Bear falls
    back to loopback TCP. Windows keeps TCP.
  • New intercept.socket config section - socket.dir sets the base
    directory and socket.access is owner or all. The default is owner,
    or all when Bear runs as root. Any key in the section turns the TCP
    fallback off. It is an error on Windows.
  • Bear ends like the build - the exit code is the build's. If the build
    dies by a signal, Bear dies by the same signal, so a script that runs
    Bear stops at Ctrl-C. The wrapper does the same. Bear turns
    off its own core dump, so a crashing build leaves no core file for Bear.
  • Better Ctrl-C and signal handling - Bear never kills the build now. It
    relays each termination signal to the build and waits as long as the build
    needs. The build stays in Bear's process group, so Ctrl-Z, terminal
    reads and a closed terminal work as without Bear. Ignored signals stay
    ignored, so background runs and nohup behave. SIGHUP is handled. A
    signal that arrives before the build starts, while Bear writes, or in
    semantic and parse-sh mode stops Bear cleanly, removes its temp files and
    prints "interrupted by SIG; stopped before finishing".
  • An interrupted build publishes only when overwriting - with --append,
    Ctrl-C leaves the output as it was. With --overwrite, the captured
    entries replace it, and one warning says so. Intercept mode writes the
    events captured so far. A build that exits 0 always publishes.
  • Assemblers are their own kind - nasm, yasm and fasm get compile
    steps and no link step.
  • A language flag makes files sources - gcc -x c -c gen.inc, glued
    -xc, and MSVC /TC, /TP, /Tc and /Tp now give an entry for files
    with an unknown extension. The null device is never a source.

Bug Fixes

  • Linker flags on cross builds (#725) - the build script picked the
    platform from the host, so a macOS host building for Android passed
    -force_load to ld.lld. It now reads the target.
  • install.sh installs the preload library on cross builds (#725) - it
    chose libexec.so or libexec.dylib from the host and skipped the library
    without a word. It now installs whichever the build made.
  • gcc -S foo.s gets no entry - the compiler does not use the input.
    gcc -S foo.S keeps its entry.
  • The output field is the object - cl /Feapp.exe /Foa.obj a.c records
    a.obj, not app.exe, whichever comes first.
  • Environment flags are read like command-line flags - CL=/c /Fofoo.obj
    now means a stop flag and an output. A stop flag in CL such as /E gives
    no entry. Values are split with response-file rules, which changes
    ARMCOMPILER6_CLANGOPT. An unknown key in a YAML environment entry is an
    error.
  • Info-only calls get no entry - gcc -###, armclang --vsn and
    --version_number, and valac --version, --help and --api-version.
  • Flag parsing fixes - each was checked against the vendor docs:
    • MSVC cl and clang-cl accept - as well as / for options. /Fi
      names the output, /o names the clang-cl output, and /Tc and /Tp
      files are inputs.
    • -fsyntax-only and /Zs stop at compiling.
    • nvcc: the whole option table follows NVIDIA's guide. -odir, -link
      and -lto no longer make bogus outputs or libraries. --ptx, --cubin
      and --fatbin stop at compiling. Some options give no entry.
    • NVIDIA HPC and PGI: -acc, -gpu, -mp, -Minfo, -Mneginfo,
      -Mvect, -Mconcur, -Mcuda, -Mipa and -Mprof no longer swallow
      the next argument, so nvc -acc -o a a.c keeps its output and source.
    • Clang -x knows more languages, and -x c++-module gives a module
      interface. Intel -x c and -Tf work.
    • TI --silicon_version is recognized. clang -rpath takes its value as
      a separate token.
  • Header entries for symlinked headers - a header that is a symlink to a
    header file now gets an entry.
  • Path formats resolve against the right base - the symlink-resolving
    format used the working directory, not the entry's directory. A relative
    working directory such as build no longer becomes build/build.
  • A clearer interrupt warning - overwriting no longer names a flag you
    may not have typed. Appending to a missing output says it was not written.
  • Lost reports are explained - the UNIX read timeout is 200 ms, up from
    100 ms, after a Yocto build lost reports on a loaded machine. The warning
    now says how long Bear waited and how much it received.

Removed

  • relative is rejected for format.paths.directory - it wrote . for
    every entry, and released clang tools ignore such entries. Use absolute.
    relative still works for file.
  • A launcher is rejected as a configured compiler family - as: wrapper,
    as: ccache, distcc, sccache or icecc fails at startup with a message
    that names the entry. A renamed launcher is not supported. Launchers are
    still found by their file name.

Internal Refactoring

  • Rust 1.90 is now required - the UNIX socket write needs SIGPIPE
    handling that std provides only from 1.90.
  • Semantic recognition now builds one interpretation of each call, and the
    output step builds entries from it. Pass and file-role rules live in
    semantic, next to the flag knowledge. shell-words left semantic.
  • Naming now follows the terms launcher, compiler wrapper and masquerade.
  • CI lints on Linux, macOS and Windows, runs nightly on Linux only, and uses
    a workflow lockfile for actions.
  • Test and comment cleanups across the crates. Dev container uses Fedora 45.

Documentation

  • Man page and site - they state the new defaults, the socket section,
    --no-local-lookups, config search and compiler path checks, and what an
    interrupted build does to the output. The Windows page is rewritten.
  • Known limit - on FreeBSD, a burst of reports over loopback TCP can be
    lost, with no error on the sender.
  • New requirements and rationale entries cover these changes.

Closed Issues

  • #725 - ld.lld: error: unknown argument '-force_load' on a macOS host building for Android

Thanks

Thanks to @leleliu008 for #725 and #726, and for testing the cross-build fix
on their own CI until it worked end to end. Thanks to @Avinesh for the
openSUSE install instructions in #727.

Thanks to the downstream packagers who keep Bear available and current -
chronically invisible work that this project depends on.

New Contributors

Full Changelog: 4.2.4...4.3.0

Don't miss a new Bear release

NewReleases is sending notifications on new releases.