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

Try to remove install_dir usage from all meson.build files #89

Closed
rgommers opened this issue Oct 28, 2021 · 11 comments
Closed

Try to remove install_dir usage from all meson.build files #89

rgommers opened this issue Oct 28, 2021 · 11 comments

Comments

@rgommers
Copy link
Owner

For context see mesonbuild/meson#9478 (comment). If it works with 0.60.0 then we can safely get rid of it.

@eli-schwartz
Copy link

For the record, it's mesonbuild/meson#9134 that fixed it.

@rgommers
Copy link
Owner Author

rgommers commented Nov 3, 2021

It's not fixed. I tried to remove two separate instances of install_dir, and both gave the same exception:

...
Dependency openblas found: YES 0.3.12 (cached)
Build targets in project: 199

SciPy 1.7.0.dev0+ababababab

  User defined options
    backend: ninja
    prefix : /home/rgommers/code/bldscipy/installdir

Found ninja-1.10.2 at /home/rgommers/anaconda3/envs/scipy-meson/bin/ninja
Traceback (most recent call last):                                                                  
  File "/home/rgommers/anaconda3/envs/scipy-meson/lib/python3.9/site-packages/mesonbuild/mesonmain.py", line 138, in run
    return options.run_func(options)
  File "/home/rgommers/anaconda3/envs/scipy-meson/lib/python3.9/site-packages/mesonbuild/msetup.py", line 294, in run
    app.generate()
  File "/home/rgommers/anaconda3/envs/scipy-meson/lib/python3.9/site-packages/mesonbuild/msetup.py", line 185, in generate
    self._generate(env)
  File "/home/rgommers/anaconda3/envs/scipy-meson/lib/python3.9/site-packages/mesonbuild/msetup.py", line 247, in _generate
    intr.backend.generate()
  File "/home/rgommers/anaconda3/envs/scipy-meson/lib/python3.9/site-packages/mesonbuild/backend/ninjabackend.py", line 557, in generate
    self.generate_install()
  File "/home/rgommers/anaconda3/envs/scipy-meson/lib/python3.9/site-packages/mesonbuild/backend/ninjabackend.py", line 1120, in generate_install
    self.create_install_data_files()
  File "/home/rgommers/anaconda3/envs/scipy-meson/lib/python3.9/site-packages/mesonbuild/backend/backends.py", line 1490, in create_install_data_files
    pickle.dump(self.create_install_data(), ofile)
  File "/home/rgommers/anaconda3/envs/scipy-meson/lib/python3.9/site-packages/mesonbuild/backend/backends.py", line 1478, in create_install_data
    self.generate_target_install(d)
  File "/home/rgommers/anaconda3/envs/scipy-meson/lib/python3.9/site-packages/mesonbuild/backend/backends.py", line 1622, in generate_target_install
    dir_name = os.path.join('{prefix}', outdir)
  File "/home/rgommers/anaconda3/envs/scipy-meson/lib/python3.9/posixpath.py", line 90, in join
    genericpath._check_arg_types('join', a, *p)
  File "/home/rgommers/anaconda3/envs/scipy-meson/lib/python3.9/genericpath.py", line 152, in _check_arg_types
    raise TypeError(f'{funcname}() argument must be str, bytes, or '
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'
FAILED: build.ninja 
/home/rgommers/anaconda3/envs/scipy-meson/bin/meson --internal regenerate /home/rgommers/code/bldscipy /home/rgommers/code/bldscipy/build --backend ninja
ninja: error: rebuilding 'build.ninja': subcommand failed

One of my code comments points to mesonbuild/meson#3206, which indeed looks related. Installing files generated by a custom_target call seems broken if install_dir isn't used.

@rgommers
Copy link
Owner Author

rgommers commented Nov 3, 2021

Ack one sec, I should replace install_dir by subdir.

@rgommers
Copy link
Owner Author

rgommers commented Nov 3, 2021

Which results in a saner error at least:

ERROR: custom_target got unknown keyword arguments "subdir"

EDIT: that is with meson 0.60.1

@eli-schwartz
Copy link

eli-schwartz commented Nov 3, 2021

subdir is a kwarg for py_installation.install_sources()

install_dir is a kwarg for custom_target() and without specifying a location to install to, a custom_target cannot install anywhere, since it does not know what to do.

However, it is supposed to give a useful error message, not a traceback, as reported in mesonbuild/meson#9522 (and fixed by me on meson master).

ERROR: "install_dir" must be specified when installing a target

@eli-schwartz
Copy link

The place where you can remove install_dir from is python_installation.extension_module() rather than custom_targets.

@rgommers
Copy link
Owner Author

rgommers commented Nov 3, 2021

Great, thanks for confirming. My only uses of install_dir are within custom_target - so we're all good here already.

For the record, usages:

scipy/meson.build
111:  install_dir: py3.get_install_dir() + '/scipy'
124:  install_dir: py3.get_install_dir() + '/scipy'

scipy/special/meson.build
480:    install_dir: py3.get_install_dir() + '/scipy/special/tests/data'

scipy/linalg/meson.build
25:  install_dir: py3.get_install_dir() + 'scipy/linalg'

@rgommers rgommers closed this as completed Nov 3, 2021
@eli-schwartz
Copy link

Ah okay, seems like I was confused about what functions you were using it for, in the linked ticket from the OP.

@rgommers
Copy link
Owner Author

rgommers commented Nov 3, 2021

No worries, I'm confused all the time here - nontrivial issues & design questions.

@eli-schwartz
Copy link

To be clear, actually passing the platlibdir to extension_module() would always be done internally by meson itself and joined to subdir and not exposed to users unless users really, really, really want to use install_dir there for some reason.

I'm pretty sure you only used install_dir because there was a bug (which I fixed) in the subdir kwarg?

This assumed you were using the python module functions (which may in fact be salvageable if install_sources is modified to learn how to handle generated sources. There is resistance to directly supporting install_sources(built_outputs), but perhaps adding a command: kwarg to install_sources() would be more palatable to those people?)

@rgommers
Copy link
Owner Author

rgommers commented Nov 3, 2021

which may in fact be salvageable if install_sources is modified to learn how to handle generated sources.

Yes, that'd be a great solution. I tried that, and then found mesonbuild/meson#7372.

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