-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
[Python3] No target named Python::Interpreter
; Build failure under Debug; Runtime error under Release
#16956
Comments
Update: Under Debug, adding the
|
Hi @lukedan Thanks for posting this issue again. Also I want to confirm why you need The package python3 is compatible with built-in CMake targets:
https://github.com/microsoft/vcpkg/blob/master/ports/python3/usage So I'm not clear why you not use python3 like this. Does it not meet your demands? |
The project can be found at https://github.com/lukedan/codepad. Regarding |
Update: In /* For an MSVC DLL, we can nominate the .lib files used by extensions */
#ifdef MS_COREDLL
# if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
/* not building the core - must be an ext */
# if defined(_MSC_VER)
/* So MSVC users need not specify the .lib
file in their Makefile (other compilers are
generally taken care of by distutils.) */
# if defined(_DEBUG)
# pragma comment(lib,"python39_d.lib")
# elif defined(Py_LIMITED_API)
# pragma comment(lib,"python3.lib")
# else
# pragma comment(lib,"python39.lib")
# endif /* _DEBUG */
# endif /* _MSC_VER */
# endif /* Py_BUILD_CORE */
#endif /* MS_COREDLL */ In /// Include Python header, disable linking to pythonX_d.lib on Windows in debug mode
#if defined(_MSC_VER)
# if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 4)
# define HAVE_ROUND 1
# endif
# pragma warning(push)
# pragma warning(disable: 4510 4610 4512 4005)
# if defined(_DEBUG) && !defined(Py_DEBUG)
# define PYBIND11_DEBUG_MARKER
# undef _DEBUG
# endif
#endif
#include <Python.h>
#include <frameobject.h>
#include <pythread.h>
...
#if defined(_MSC_VER)
# if defined(PYBIND11_DEBUG_MARKER)
# define _DEBUG
# undef PYBIND11_DEBUG_MARKER
# endif
# pragma warning(pop)
#endif Perhaps |
Also, without linking to |
I realized that there's another |
This issue still persists. To sum it up: Python links against python39(d).dll based on whether a "Release interpreter" or a "Debug Interpreter" is present (rather than build options). Since vcpkg only ships a Release interpreter, it tries to link against the release version of python39.dll even in debug builds, but this is not present because vcpkg has set up paths to debug libraries only. (The release interpreter is located in /vcpkg/installed/x64-windows/tools/python3). The ad-hoc fix would be to force a debug-build regardless of present interpreter by defining Py_DEBUG for debug builds automatically. This can be done manually right now with
(However, the resulting binary cant be used with the release interpreter of vcpkg.) And the proper solution is to ship a debug interpreter and wire it up for python to find in debug builds. Additionally I agree that the interpreter should probably be copied to the output along with the .dll files, perhaps as a zip archive. |
Since nobody can fix this bug, every time I build DEBUG target I have to do this command in VS.
or
Now, R.I.P. |
The python3 in vcpkg is currently not complete, some libraries and py scripts are not normally built and installed, and the python3 executable is not packaged as expected. |
Now I got a wired DEBUG binary. and I have a question: Why do those guys have to define and this line is the reason |
@ssrlive Should be a port bug. |
Host Environment
To Reproduce
Steps to reproduce the behavior:
./vcpkg install python3:x64-windows
Failure logs
Using the following CMake commands:
Project generation fails with the following output (Notice that
Python3_Interpreter_FOUND
isTRUE
):Using the following CMake commands (without linking to
Python3::Interpreter
):Under
Debug
, build fails with the following output:There may be a bit of noise in the command line, but it only links to
python39_d.lib
using its full pathD:\Software\vcpkg\installed\x64-windows\debug\lib\python39_d.lib
. InD:\Software\vcpkg\installed\x64-windows\debug\lib\
,python39_d.lib
is present butpython39.lib
is not (it's inD:\Software\vcpkg\installed\x64-windows\lib\
).Under
RelWithDebInfo
, the program compiles but fails to run with the following message:Since it mentions
D:\\Documents\\Projects\\codepad\\out\\build\\x64-Release\\python39.zip
, I downloaded an embedded version of Python 3.9 and put it inD:\Documents\Projects\codepad\out\build\x64-Release\
, but it didn't help.Additional context
Make sure you don't have Python installed system-wide before attempting to reproduce this issue.
The text was updated successfully, but these errors were encountered: