You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My previous problems with MinGW backend were due to the combination of native python 32-bit and 32-bit version of MinGW. (If it would be useful, I can test windows build with MinGW x64)
As we discussed, I tried msvc as a compiler. Using it with meson needs some magic passes described here.
Building a simple python app: Successful
Building a simple cython C app:
warning C4115: timeval: определение именованного типа в круглых скобках
simple_cy.pyx.c(1240): warning C4100: def: неиспользованный формальный параметр
simple_cy.pyx.c(1707): warning C4127: условное выражение является константой
...
Linking target cy.pyd
FAILED: cy.pyd cy.pdb
"link" /MACHINE:x64 /OUT:cy.pyd cy.pyd.p/meson-generated_.._simple_cy.pyx.c.obj "/nologo" "/release" "/nologo" "/DEBUG"
"/PDB:cy.pdb" "/DLL" "/IMPLIB:cy.lib" "C:\Users\Dmitry\anaconda3\envs\meson_win\libs\python37.lib"
"kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "shell32.lib" "ole32.lib" "oleaut32.lib"
"uuid.lib" "comdlg32.lib" "advapi32.lib"
LINK : fatal error LNK1104: не удается открыть файл "python37_d.lib"
ninja: build stopped: subcommand failed.
Seems like --buildtype=release solved this. I need some time for testing the installation.
Full command: meson build --buildtype=release --prefix=D:\GitKraken\meson_win\mc_lib\hello_world_dir
Log:
[3/3] Linking target cy.pyd
Создается библиотека cy.lib и объект cy.exp
Installing cy.pyd to D:\GitKraken\meson_win\mc_lib\hello_world_dir\lib\python3.7\site-packages\hello_world
Installing cy.lib to D:\GitKraken\meson_win\mc_lib\hello_world_dir\lib\python3.7\site-packages\hello_world
File 'cy.pdb' not found, skipping
Installing D:\GitKraken\meson_win\mc_lib\hello_world_dir\simple_py.py to D:\GitKraken\meson_win\mc_lib\hello_world_dir\lib\python3.7\site-packages\hello_world
Building wheel for mc-lib (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\Dmitry\anaconda3\envs\meson_win\python.exe' 'C:\Users\Dmitry\anaconda3\envs\meson_win\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' build_wheel 'C:\Users\Dmitry\AppData\Local\Temp\tmp1dzkf_k4'
cwd: C:\Users\Dmitry\AppData\Local\Temp\pip-req-build-axco_vi_
Complete output (21 lines):
C:\Users\Dmitry\AppData\Local\Temp\pip-build-env-4lsdrkdd\overlay\Lib\site-packages\mesonpep517\pep425tags.py:66: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
if get_flag("Py_DEBUG", hasattr(sys, "gettotalrefcount"), warn=precond):
meson-python-option-name not specified in the [tool.mesonpep517.metadata] section, assuming `python3`
Python Traceback (most recent call last):
File "C:\Users\Dmitry\anaconda3\envs\meson_win\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 349, in <module>
main()
File "C:\Users\Dmitry\anaconda3\envs\meson_win\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 331, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:\Users\Dmitry\anaconda3\envs\meson_win\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 249, in build_wheel
metadata_directory)
File "C:\Users\Dmitry\AppData\Local\Temp\pip-build-env-4lsdrkdd\overlay\Lib\site-packages\mesonpep517\buildapi.py", line 372, in build_wheel
wheel_directory), config_settings, metadata_directory)
File "C:\Users\Dmitry\AppData\Local\Temp\pip-build-env-4lsdrkdd\overlay\Lib\site-packages\mesonpep517\buildapi.py", line 340, in build
abi = get_abi(python)
File "C:\Users\Dmitry\AppData\Local\Temp\pip-build-env-4lsdrkdd\overlay\Lib\site-packages\mesonpep517\buildapi.py", line 302, in get_abi
return subprocess.check_output([python, '-c', GET_CHECK]).decode('utf-8').strip('\n')
File "C:\Users\Dmitry\anaconda3\envs\meson_win\lib\subprocess.py", line 411, in check_output
**kwargs).stdout
File "C:\Users\Dmitry\anaconda3\envs\meson_win\lib\subprocess.py", line 512, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command
'['python3', '-c', '\nfrom mesonpep517 import pep425tags\nprint("{0}{1}-{2}".format(pep425tags.get_abbr_impl(),\n
pep425tags.get_impl_ver(),\n
pep425tags.get_abi_tag())\n)\n']' returned non-zero exit status 9009.
----------------------------------------
ERROR: Failed building wheel for mc-lib
Failed to build mc-lib
ERROR: Could not build wheels for mc-lib which use PEP 517 and cannot be installed directly
Currest status: on CI dev build seems to work with a vanilla MSVC, see gh-62. The current blocker is how to cook up the incantation for the PYTHONPATH in PowerShell -- which GH actions use instead of cmd. With hardcoded paths the build seems to be OK if noisy.
replicate the build locally with cmd instead of Powershell. Will need https://mesonbuild.com/Using-with-Visual-Studio.html, as Dmitry was mentioning above. Once replicated, should be documented in a README (I think).
@ev-br, you may take a look at cpymad. This project was the first one using the msys2 toolchain for CI building of a standard CPython package. See also: hibtc/cpymad#81
@carlkl Thanks for the link! Will take a look.
TBH this is somewhat low prio for this project at the moment (if msvc works, it's good enough for now). That said, it's great to have a link to look at when the need arises! And if past experience is any guide, it will at some point :-).
Activity
noDGodiaev commentedon Aug 5, 2021
msvcas a compiler. Using it with meson needs some magic passes described here.Capp:Python == 3.7
Meson == 0.59
MSVC2019
ev-br commentedon Aug 5, 2021
No idea TBH. Is it looking for a debug python build (
_d)?noDGodiaev commentedon Aug 5, 2021
Seems like
--buildtype=releasesolved this. I need some time for testing the installation.Full command:
meson build --buildtype=release --prefix=D:\GitKraken\meson_win\mc_lib\hello_world_dirLog:
noDGodiaev commentedon Aug 5, 2021
--buildtype=releasealso works for mc_lib, pytest works.I still have questions to solve:
exporton windowsPEP517 installation
ev-br commentedon Aug 5, 2021
Quick googling gives two options: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/set_1 and https://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-in-windows-so-it-finds-my-modules-packages
Do not fiddle with registry keys though :-)
ev-br commentedon Aug 5, 2021
That's quite a rabbit hole. If the MSVC build works, it's good enough, I think.
noDGodiaev commentedon Aug 5, 2021
setmay be the option, but for me:echo %PYTHONPATH%returns%PYTHONPATH%I have no great desire to play with system variables. So as the option of testing I suggest
cdtoinstalldirand make tests there.ev-br commentedon Aug 5, 2021
If
cd installdirworks, it's OK for now. Please leave a comment somewhere though.noDGodiaev commentedon Aug 5, 2021
PEP517 installation with msvc:
noDGodiaev commentedon Aug 5, 2021
We can put this option inside
meson.build:ev-br commentedon Aug 5, 2021
Unless it messes up other OSes, that is. Which CI will tell us.
noDGodiaev commentedon Aug 5, 2021
The main reason for this error: build system try command with
python3, while on windows onlypythonexists.And, I don't know how to change this(
ev-br commentedon Aug 5, 2021
There has got to be a way to specify the interpreter and it's name, otherwise it's a royal mess (eg what if I've two interpreters, py3.8 and 3.9).
Edit : not that I have a slightest clue how to tell it that. Something with find_installation("python")?
ev-br commentedon Jan 20, 2022
Currest status: on CI dev build seems to work with a vanilla MSVC, see gh-62. The current blocker is how to cook up the incantation for the PYTHONPATH in PowerShell -- which GH actions use instead of cmd. With hardcoded paths the build seems to be OK if noisy.
@noDGodyaev @MoskalenkoRomanBorisovich is either of you is up to the challenge? :-).
ev-br commentedon Jan 21, 2022
OK, fine, #62 is in. Follow-ups:
pip install .is broken because of mesonpep517. I suspect it's https://gitlab.com/thiblahute/mesonpep517/-/issues/20 and is fixed by https://gitlab.com/thiblahute/mesonpep517/-/merge_requests/17, needs checking.carlkl commentedon Feb 2, 2022
@ev-br, you may take a look at cpymad. This project was the first one using the msys2 toolchain for CI building of a standard CPython package. See also: hibtc/cpymad#81
ev-br commentedon Feb 2, 2022
@carlkl Thanks for the link! Will take a look.
TBH this is somewhat low prio for this project at the moment (if msvc works, it's good enough for now). That said, it's great to have a link to look at when the need arises! And if past experience is any guide, it will at some point :-).
ev-br commentedon Apr 13, 2022
https://gitlab.com/thiblahute/mesonpep517/-/merge_requests/17 has been merged (April 2022), now waiting for a pypi release : the current version is v0.2, from Feb 2022.