Skip to content

bug: Ninja shared-library links omit toolchain linker flags and sysroot #139

Closed

Description

@SJ-14-SJ

What happened?

The Ninja backend omits toolchain linker flags and sysroot when linking shared-library targets. Executable and test targets include these settings, but shared libraries do not.

This can silently ignore linker checks such as -Wl,--no-undefined and omit the configured --sysroot.

The fix and regression tests are submitted in PR #125:
#125

Expected behavior

Shared-library links should include toolchain linker flags and sysroot before target-specific linker flags, matching executable targets. Neither the toolchain nor target flag lists should be mutated.

Reproduction steps

  1. Use the code before the fix in PR fix(ebuild): preserve toolchain linker flags for shared libraries #125.
  2. Configure a shared_library target with toolchain linker flags containing -Wl,--no-undefined and a sysroot.
  3. Generate the Ninja build manifest.
  4. Inspect the shared-library ldflags: the toolchain linker flag and --sysroot are missing.
  5. On Linux/GCC, build a shared library containing an unresolved external symbol. The requested --no-undefined check is not enforced.

PR #125 adds manifest tests and a Linux/GCC CLI regression test for this behaviour.

Version or commit

8b623d5 (baseline before the fix in PR #125)

Environment

Linux, Python 3.12, Ninja backend, GCC.

Exact Linux distribution, GCC version and Ninja version were not recorded.

Real Windows/macOS linking and cross-compilation with an SDK were not tested.

Logs or diagnostics

Historical verification recorded for PR #125:

pytest tests/unit/test_shared_library_toolchain.py -q

All three regression cases failed against the original backend and passed with the fix.

Full-suite result: 9 failed, 672 passed, 3 skipped.
The nine failures were pre-existing test_index_sync.py failures involving a missing PackageRecipe.to_dict method, also reproduced on the baseline.

These are recorded verification results, not a fresh test run.

Submission checks

  • I searched existing issues for a duplicate.
  • This report contains no security-sensitive details.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions