-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Compilation on windows Fails after PR #2053 #2079
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
Comments
I can't reproduce your issue. Furthermore, the intention of the PR you mention, which I authored, was precisely to fix problems like this. If you setup a bare bones CMakeLists.txt like this: project(test)
add_subdirectory(pybind11) and use the following command:
Everything works fine, CMake is perfectly able to find the required .lib file, see my log here:
Maybe you have set the PYTHON_LIBRARY variable manually? This isn't required on Windows, except if you're using a Unix emulator of some kind like MSYS or Cygwin. |
Hi and thank you for your reply, The setup CMakeLists.txt is as you described, the only difference is Maybe I wasn't clear enough, the installation works perfectly fine when running from a windows shell, in our case it doesn't work when running from our shell (MinGW). Your second solution makes it work, setting manually BTW, is it written somewhere about setting I'll prepare a PR to just discuss my solution, if it doesn't provide anything useful, we'll drop it and indicates to our users the steps to make it work if they develop on Windows. Our objective would be that users should not indicate any paths, and the "finding" scripts could provide everything needed to make it compile. Maybe I dream to much of unicorns, I don't know. Thank you for your time and the indications your provide us :) Cheers, |
Then, what shell are you using? Is it Cygwin, MSYS, WSL or another one? In this last case, what shell is it? If you provide enough information, we can expand the check I changed recently in
I don't think it's written somewhere, I said that because it's the way |
Okay, now I understand why I was giving you wrong information. I use directly the shell which comes when downloading git for windows, which I cannot find if it's related to Cygwin, MSYS. etc. It seems that it uses
Well, in my case, Maybe if it can help you more, Let me know if you want more information, I have some time for this issue. |
Ok I understand your issue now. One more information, are you using MSVC on Git Bash, or are you using GCC? |
I'm using MSVC, compiler version 14.24.28314 |
In attachment a solution I found which works on my side without providing library path location, with my setup. The file is a patch, but Github does not support *.patch extension. |
I made a PR which will hopefully fix your issue, can you check against it? |
Hello everyone,
First, thank you everyone for this great tool !
Issue description
Current system:
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 filetools/FindPythonLibsNew.cmake
was not set to the correct path.PYTHON_LIBRARY
=C:/Users/user/Anaconda3/libs/python37.lib
PYTHON_LIBRARY
=python37.lib
Debugging each step of the previous file resulted that:
PYTHON_LIBDIR
is emptyPYTHON_LIBRARY
is set topython37.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
In the
CmakeLists.txt
file, we useadd_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
The text was updated successfully, but these errors were encountered: