Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
anarazel opened this issue May 2, 2024 · 3 comments · Fixed by #13170
Closed

Comments

@anarazel
Copy link
Contributor

anarazel commented May 2, 2024

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
@tristan957
Copy link
Contributor

Investigating

tristan957 added a commit to tristan957/meson that referenced this issue May 2, 2024
We need the subdir of where the output file will actually be created,
not the current subdir of the interpreter.

Fixes: mesonbuild#13168
tristan957 added a commit to tristan957/meson that referenced this issue May 2, 2024
We need the subdir of where the output file will actually be created,
not the current subdir of the interpreter.

Fixes: mesonbuild#13168
tristan957 added a commit to tristan957/meson that referenced this issue May 2, 2024
We need the subdir of where the output file will actually be created,
not the current subdir of the interpreter.

Fixes: mesonbuild#13168
@tristan957
Copy link
Contributor

#13170

tristan957 added a commit to tristan957/meson that referenced this issue May 2, 2024
We need the subdir of where the output file will actually be created,
not the current subdir of the interpreter.

Fixes: mesonbuild#13168
tristan957 added a commit to tristan957/meson that referenced this issue May 3, 2024
We need the subdir of where the output file will actually be created,
not the current subdir of the interpreter.

Fixes: mesonbuild#13168
dcbaker pushed a commit that referenced this issue May 7, 2024
We need the subdir of where the output file will actually be created,
not the current subdir of the interpreter.

Fixes: #13168
@anarazel
Copy link
Contributor Author

anarazel commented May 8, 2024

Thanks!

eli-schwartz pushed a commit that referenced this issue May 29, 2024
We need the subdir of where the output file will actually be created,
not the current subdir of the interpreter.

Fixes: #13168
(cherry picked from commit 23eb7ba)
soumyaDghosh pushed a commit to soumyaDghosh/meson that referenced this issue Jun 4, 2024
We need the subdir of where the output file will actually be created,
not the current subdir of the interpreter.

Fixes: mesonbuild#13168
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants