Ramon Roche c9f1d2ab0f build(cmake): silence benign macOS ranlib and ld warnings
POSIX/SITL builds on macOS produce two classes of benign warnings that
clutter output and obscure real issues:

  ranlib: warning: 'lib*.a(foo.o)' has no symbols
  ld: warning: ignoring duplicate libraries: ...

The ranlib warnings come from sources wrapped in #if defined(CONFIG_*)
guards (i2c.cpp, spi.cpp, board_common.c, pab_manifest.c,
px4_log_history.cpp) and dummy.cpp placeholders, which legitimately
compile to empty object files on POSIX. GNU ranlib ignores this;
Apple's warns. The warning is emitted by 'ar qc' (which implicitly
builds a symbol table), not by ranlib itself, so overriding only
ARCHIVE_FINISH is insufficient. Use 'ar qcS' to skip the implicit
symbol table, then let ranlib -no_warning_for_no_symbols build it
quietly via ARCHIVE_FINISH.

The duplicate-library warnings come from CMake intentionally
re-emitting static libraries on the link line to resolve circular
dependencies between px4_layer, px4_work_queue, px4_daemon and
lockstep_scheduler. GNU ld silently dedupes; Apple's ld-prime
(Xcode 15+) warns. Pass -no_warn_duplicate_libraries to the linker.

Both fixes are Darwin-only and have no effect on Linux CI or NuttX
builds.

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-04-08 22:45:28 -06:00
..