Open zyrkiel opened 3 months ago
It seems more logic to find python3 before pybind11. So I have switched the 2 lines.
After that, I have realized that I should use Python3_FIND_ABI
instead of Python_FIND_ABI
since I am trying to find Python3.
Finally, removing Python3 from the vcpkg.json dependencies enables the configure to end successfully and to link to local Python.
You can find the workaround.patch in the repository.
However, I still would like to use vcpkg python3 package and not to specify the build type at the configure phase.
Describe the bug While linking to a custom library depending on pybind11 in Debug I get an undefined reference. It is due to the fact that the release Python3 lib is given to the link instead of the debug one.
This issue might be related to #33724
Environment
To Reproduce Code is available here: https://github.com/zyrkiel/test_link_python_debug
Steps to reproduce the behavior:
git clone --recurse-submodules https://github.com/zyrkiel/test_link_python_debug.git
cd test_link_python_debug
cmake -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_MANIFEST_INSTALL:BOOL=ON -DVCPKG_HOST_TRIPLET=x64-linux -DVCPKG_TARGET_TRIPLET=x64-linux -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:STRING=install -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -S . -B build
cmake --build build --config Debug
However, running again the configuration and the build will lead to a success.
Expected behavior cmake should find the debug library of python and links it
Failure logs
First Configure output:
First Build output:
Second Configure output:
Second Build output:
Additional context The issue is not dependent from compiler, nor generator. As you can see, the link is trying to use the release lib
foo_lib/libFoo.a vcpkg_installed/x64-linux/lib/libpython3.11.a
The proposed solution to #33724 isn't working:
set(Python_FIND_ABI "ON" "ANY" "ANY")
before trying to find packages. It gives the same behavior.