Skip to content

Compilation on windows Fails after PR #2053 #2079

Closed
@MonkeyBreaker

Description

@MonkeyBreaker

Hello everyone,

First, thank you everyone for this great tool !

Issue description

Current system:

  • Windows 10
  • MinGW
  • conda 4.8.1 installed on windows
  • python version 3.7.4 (the one in conda)
  • cmake 3.14.0 installed on windows
  • compiler MSVC 14.24.28314

After PR #2053 was merged, our building pipelines on windows started failing. The output message error is fatal error LNK1181: cannot open input file 'python37.lib.
After tracking the problem, I found out that PYTHON_LIBRARY in file tools/FindPythonLibsNew.cmake was not set to the correct path.

Debugging each step of the previous file resulted that:

  • PYTHON_LIBDIR is empty
  • After the patch, it tries to look in a Linux location for the library
  • PYTHON_LIBRARY is set to python37.lib

I found a solution changing some lines in tools/FindPythonLibsNew.cmake, without changing the behaviour for Linux or Mac.

I would like to know if you'll be interested for a PR, if yes the only thing is I don't have many more windows system to test on it. To I don't know if other Windows user with their build system could test ?

Or maybe do you have any other suggestion that could help us of course :) ?

Reproducible example code

  1. windows system
  2. install mingw
  3. install conda for windows
  4. import a C++ project using cmake for building process, and of course pybind

In the CmakeLists.txt file, we use add_subdirectory() to indicate where the folder of pybind11 is located.

Expected error: fatal error LNK1181: cannot open input file 'python37.lib

Let me know if you have any questions/suggestion.

Cheers,
Julián

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions