Skip to content

generator.process() doesn't handle custom target/index from subdirectories correctly #13168

Closed

Description

@anarazel

meson (a0ff145 in my case, but the bug is older) with the ninja backend doesn't correctly handle generator.process() being used to process a generated file, if that file is in a subdirectory. It looks like something looses track of the path for the generated file.

meson.build:

project('testme',
  ['c'],
)

touch = find_program('touch')

subdir('include')

gen = generator(
  touch,
  arguments: ['@OUTPUT@'],
  output: '@[email protected]'
)

custom_target('check-headers.stamp',
  command: [touch, '@INPUT@'],
  input: gen.process(test_header),
  output: 'check-headers.stamp',
  build_by_default: true,
)

include/meson.build:

test_header = custom_target(
    output: 'test_header.h',
    command: [touch, '@OUTPUT@']
)

Test:

$ m setup build && ninja -C build
...
ninja: error: 'test_header.h', needed by 'check-headers.stamp.p/test_header.h.t', missing and no known rule to make it

The problem is that test_header.h.t omitted the path in the dependency on test_header.h:

$ grep -E 'test_header.h(.t|):' build/build.ninja 
build include/test_header.h: CUSTOM_COMMAND  | /usr/bin/touch
build check-headers.stamp.p/test_header.h.t: CUSTOM_COMMAND test_header.h | /usr/bin/touch

Activity

  1. tristan957 commented on May 2, 2024

    @tristan957
    Member

    Investigating

  2. added 3 commits that reference this issue on May 2, 2024
    5e1dff2
    8a35778
    25ed2b2
  3. tristan957 commented on May 2, 2024

    @tristan957
    Member
  4. added 2 commits that reference this issue on May 2, 2024
    4287858
    47ce689
  5. added a commit that references this issue on May 7, 2024
    23eb7ba
  6. anarazel commented on May 8, 2024

    @anarazel
    ContributorAuthor

    Thanks!

  7. added a commit that references this issue on May 29, 2024
    f800b31
  8. added a commit that references this issue on Jun 4, 2024
    2f5d40f
  9. added a commit that references this issue on May 1, 2025
    0179a8d
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions