-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Issues with python.extension_module() on Windows with MSVC #10775
Comments
That is odd indeed. The build is configured with Perhaps a duplicate of gh-10639. |
@dnicolodi if you build with Meson uses I had a look at CI coverage, and there are extensive MSVC tests, but Cython is skipped there. Nevertheless, I'd expect that to work smoothly, because all it needs is compiling C code. I'll see if I can enable those tests. |
Cython is skipped there because the cython suite is only run if cython is installed, and it doesn't seem that cython is installed as part of e.g. But cython shouldn't be relevant here -- instead, consider |
Yes, fairly sure the Side note: studying the Meson CI setup was quite enlightening, I think I'll try to borrow the way it installs the Intel Fortran compiler on Windows. That will fix a big gap in SciPy's CI coverage. |
Yep, of course. :D
I myself was greatly enlightened by MODFLOW-USGS/modflow6#978 (comment), direct all credit to @Hofer-Julian and co. |
And we took it from https://github.com/oneapi-src/oneapi-ci. As a sidenote: that scipy moved to meson was the final motivator for us to dare the jump to meson too. |
@rgommers @eli-schwartz Thank you for having a look. The whole project(
'python-siphash24', 'c', 'cython',
version: '1.0.0',
license: 'Apache-2.0 or LGPL-2.1-or-later',
meson_version: '>= 0.62.0',
default_options: [
'buildtype=release',
'c_std=c11',
]
)
py_mod = import('python')
py = py_mod.find_installation()
py_dep = py.dependency()
# MinGW-W64
if host_machine.system() == 'windows' and meson.get_compiler('c').get_id() == 'gcc'
add_project_link_arguments('-lucrt', '-static', language: 'c')
add_project_arguments('-mlong-double-64', language: 'c')
add_project_arguments('-DMS_WIN64', language: 'c')
endif
py.extension_module(
'siphash24', 'siphash24.pyx', 'c-siphash.c',
install: true,
dependencies: py_dep,
) thus @rgommers I have the impression that the error comes from |
I don't know too much about how pdb works on Windows. I do know that Meson marks both pdb and implib specially in the pickled installdata with a Note: for implib, which you need in order to link to the ABI of a shared object, only the implib for shared modules as those aren't necessarily linked to or provide an ABI -- regular dlls are presumed to have an ABI, and need an implib or they are useless (generally, they are buggy due to not dllexporting anything). When, exactly, a pdb is not built, is a question I cannot answer. |
FYI, I was looking into #10639, as part of my work on moving pandas to meson. After some investigating... Looks like in debug mode we are passing "/Zi" to MSVC's cl.exe which makes the pdb file. (Not too sure though) meson/mesonbuild/backend/backends.py Lines 1611 to 1618 in 167356a
Now, look at where Lines 2144 to 2149 in 167356a
We see here, Lines 2208 to 2209 in 167356a
that meson just hardcodes in the pdb path without even checking whether it should exist, when compiler == MSVC Now, this doesn't really matter, since ninja(???) I assume is just ignore files to install when they exist. @eli-schwartz Can you confirm if I'm on the right track? Thanks. This may be all wrong, so sorry if I'm just spewing noise. My fix locally does seem to work on a release build, but I haven't tested a debug build to make sure those are still generated. |
Also, slightly off-topic: I feel like I'm hitting a lot of sharp edges trying to get meson to work with pandas, which makes me suspect I'm doing something wrong. |
@lithomas1 no we aren't, I have never seen this. However, we are building with Mingw-w64. So it being an MSVC-specific flag would make sense here.
I don't think you are doing something wrong, it is mostly a case of both Just to be sure: with this |
It is a warning from |
I would like to build a simple Python extension. My
meson.build
looks something like this:the full code can be found here https://github.com/dnicolodi/python-siphash24
Everything works well on Linux and macOS however something is off on Windows when compiling with MSVC:
It seems that (what I think are) debug symbols are generated with the wrong filename extension.
This is on the Github Actions runners with the default MSVC installation. I'm not familiar with development on Windows thus I really don't know what may be going wrong.
The text was updated successfully, but these errors were encountered: