Skip to content

native_add test project now lists a .h source, which breaks the Dart SDK's dart install tests with published native_toolchain_c #3743

Closed

Description

@natebosch

Summary

The Dart SDK rolls this repo into its DEPS file. #3728 ("Track header
files as build dependencies") makes the Dart SDK test
pkg/dartdev/test/native_assets/install_test.dart fail. Because of that,
the latest SDK dependency roll holds dart-lang/native at 10515af, the
commit just before #3728. The other dependencies in that roll were updated
as usual.

Until this is resolved and native_rev in the SDK DEPS moves past
#3728, the SDK will not pick up new commits from this repo.

What fails

The SDK bots fail two tests in install_test.dart:

  • dart install dart_app (with build hooks and code assets)
  • dart install --overwrite

Both fail while building native_add:

clang --target=arm64-apple-darwin ... -fPIC -O3 ... -DRELEASE -DNDEBUG \
  .../native_add/src/native_add.c .../native_add/src/native_add.h \
  -framework Foundation --shared -o .../libnative_add.dylib ...
clang: error: cannot specify -o when generating multiple output files

Failing build (mac-arm64):
https://ci.chromium.org/b/8668117913278491681

Cause

#3728 makes two changes that only work together:

  1. pkgs/hooks_runner/test_data/native_add/hook/build.dart now passes
    sources: ['src/$packageName.c', 'src/$packageName.h'].
  2. CBuilder in native_toolchain_c now removes .h files from
    sources before calling the compiler. This change is only in
    0.19.6-wip. The published version is still 0.19.5.

The SDK's dart install tests copy the test_data projects from this repo.
dart install resolves dependencies in a temporary helper package, so the
dependency_overrides in the copied projects (which point at the local
checkout) are ignored. native_add depends on native_toolchain_c: any,
so dart install resolves to the published 0.19.5. That version still
passes the .h file to clang, and clang fails as shown above.

In short, the test_data changes are released together with the SDK
checkout, but the package they depend on resolves to the published
version. When a test project needs an unreleased native_toolchain_c
feature, dart install breaks.

Possible resolutions

We would like the maintainers of this repo to choose the approach. Some
options:

  • Revert the .h entry in test_data/native_add (and any other test
    projects that dart install uses) until native_toolchain_c 0.19.6 is
    published.
  • Publish native_toolchain_c 0.19.6, so the any constraint resolves to
    a version that filters headers.
  • Keep test_data projects that the SDK tests use compatible with the
    latest published versions of this repo's packages.

The SDK tests could also be changed to point native_toolchain_c at the
local checkout, the way install_test.dart already does for hooks and
record_use. Any of these changes needs a follow-up SDK roll that moves
native_rev past #3728. The SDK side will handle that roll once a fix
lands here.

Reproduce

In a Dart SDK checkout with native_rev at 237524d or later (after
gclient sync):

python3 tools/test.py -n unittest-asserts-release-<os>-<arch> \
  pkg/dartdev/test/native_assets/install_test

Related SDK roll CL: https://dart-review.googlesource.com/c/sdk/+/563220

Activity

  1. dcharkes commented on Oct 13, 2026

    @dcharkes
    Collaborator

    The SDK tests could also be changed to point native_toolchain_c at the
    local checkout, the way install_test.dart already does for hooks and
    record_use

    I believe this is the best course of action.

  2. self-assigned this
    on Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions