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

[0.60.0] Failed custom_target with command as list containing environment. #9455

Closed
bartoszek opened this issue Oct 26, 2021 · 2 comments
Closed

Comments

@bartoszek
Copy link

bartoszek commented Oct 26, 2021

Describe the bug
80c89a6 breaks passing extrenal_program to custom_targat:commad with additional environment variables.
Last working version meson:0.59.3

To Reproduce
Excerpt from gimp meson.build ( reference issue https://gitlab.gnome.org/GNOME/gimp/-/issues/7420 )

perl = find_program('perl5', 'perl', 'perl5.005', 'perl5.004', 'perl')

perlsrcdir = meson.current_source_dir()
perlbindir = meson.current_build_dir()

perl_env = [
PDBGEN_BACKUP=0
perl,
'-I', perlbindir,
'-I', perlsrcdir,
]

enums_pl = custom_target('enums.pl',
input : [ 'enumgen.pl', 'enums-external.pl', enum_headers, ],
output: [ 'enums.pl', ],
command: [
perl_env, '@INPUT0@',
enum_headers,
],
)

meson setup error:

Program PDBGEN_BACKUP=0 found: NO
gimp/pdb/meson.build:107:0: ERROR: Program 'PDBGEN_BACKUP=0' not found

Expected behavior
Interpreter:_func_custom_target_impl() should check if any element of the list passed as command is an instance of external_program instead of bluntly running _func_find_program on command[0].

system parameters

  • Os:ArchLinux
  • python:3.9.7
  • meson:0.60.0
@bartoszek bartoszek changed the title [0.60.0] Custom target with command as list containing environment. [0.60.0] Failed with custom_target with command as list containing environment. Oct 26, 2021
@bartoszek bartoszek changed the title [0.60.0] Failed with custom_target with command as list containing environment. [0.60.0] Failed custom_target with command as list containing environment. Oct 26, 2021
@eli-schwartz
Copy link
Member

eli-schwartz commented Oct 26, 2021

You are explicitly not allowed to do this, command is NOT a unix shell command, it is an array containing a program followed by argv.

It will guarantee to break on any platform or backend where the backend (which may or may not be ninja) doesn't use the unix shell. Like Windows.

Since 0.57 the custom_target function accepts an env kwarg that does what you want. Alternatively you may use /usr/bin/env as the custom_target program and pass your env as argv to that.

@eli-schwartz
Copy link
Member

eli-schwartz commented Oct 26, 2021

Also this should be a duplicate of #8641 (and should not be related to 0.60)

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

No branches or pull requests

2 participants