ImportError: DLL load failed while importing nanobind_example_ext: Le module spécifié est introuvable.
Hi, thanks for py/nano binds ! I'm facing problems on my machine (Windows + MinGW) building valid extensions ... yet I am able to compile pure C++ Ok :
#include <iostream>
using namespace std;
int main() {
cout << "Hello World";
return 0;
}
g++ hello.cpp -o hello.exe
hello.exe
> Hello World
build this example runs smoothly, no errors, no warnings ... nanobind_example_ext.pyd is generated ok ... but importing it or from it leads to an ImportError:
----> 1 from .nanobind_example_ext import add, __doc__
ImportError: DLL load failed while importing nanobind_example_ext: Le module spécifié est introuvable.
I tried to investigate the extension using dependencies walker ... it lacks QueryOOBESupport, ext-ms-win-oobe-query-l1-1-0.dll BUT this has been reported as a false alarm ... I'm a bit confused on where / how to fix this :s
- https://github.com/lucasg/Dependencies/issues/220
- https://learn.microsoft.com/en-us/answers/questions/1195445/kernel32-dll-dependenci-ext-ms-win-oobe-query-l1-1)
Oh and I've got the exact same problem on multiple projects :(
Same problem, did you fix it?
Oh, sorry my bad i didn't follow up the issue ...
Yes we did ! it was a CMAKE configuration issue on our side, we had to staticaly link the std libs !
For those who encounter the same issue, adding the following line to the CMakeLists.txt, should fix it:
# link c/c++ stl statically
target_link_options(${CMAKE_PROJECT_NAME} PRIVATE -static-libgcc
-static-libstdc++)
I could add it to the CMakeLists.txt of this project to prevent the error from happening for Windows/MinGW users ... if you think it's relevant ... just tell