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

When building a python c-extension using the limited_api, windows should link with python3.lib #12008

Closed
mattip opened this issue Jul 18, 2023 · 2 comments · Fixed by #11745
Closed
Labels
modules:python Issues specific to the python module

Comments

@mattip
Copy link
Contributor

mattip commented Jul 18, 2023

Describe the bug
In dependencies/python.py:PythonSystemDependency::get_windows_link_args(), the link library will always be pythonxy.lib where xy is 311. But when building a c-extension using the limited api (i.e. -DPy_LIMITED_API=0x03060000) the name should be python3.lib

To Reproduce
This is from PR numpy/numpy#24206 where I am converting an existing test that uses setup.py to meson.

project('limited_api', 'c', 'cython')

py_mod = import('python')
py3 = py_mod.find_installation(pure: false)

cc = meson.get_compiler('c')

npy_include_path = run_command(py3, ['-c',
               'import os; os.chdir(".."); import numpy; print(os.path.abspath(numpy.get_include()))'],
                         check: true).stdout().strip()

py3.extension_module(
    'limited_api',
    'limited_api.c',
    install: false,
    c_args: [
      '-DNPY_NO_DEPRECATED_API=0',  # Cython still uses old NumPy C API
      '-DPy_LIMITED_API=0x03060000',
    ],
    include_directories: [npy_include_path],
)

Expected behavior
There should be a way to tell meson to build limited_api c-extensions.

system parameters

  • Is this a cross build or just a plain native build (for the same computer)? native build
  • what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.) windows
  • what Python version are you using e.g. 3.8.0 3.11
  • what meson --version latest
  • what ninja --version if it's a Ninja build from PyPI
@eli-schwartz
Copy link
Member

This exact feature is being prototyped by @amcn in #11745, please provide feedback.

@mattip
Copy link
Contributor Author

mattip commented Jul 19, 2023

thanks. I searched the issues but not the PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
modules:python Issues specific to the python module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants