adang1345 / delvewheel

Self-contained Python wheels for Windows
MIT License
116 stars 12 forks source link

Unable to find library #26

Closed pfebrer closed 2 years ago

pfebrer commented 2 years ago

Hi! We are trying to create wheels for windows for the first time using pypa/cibuildwheel and delvewheel. Our package uses fortran extensions compiled using f2py. When repairing the wheel, we get this error:

+ delvewheel repair --no-mangle-all -w C:\Users\RUNNER~1\AppData\Local\Temp\cibuildwheelldbcha4p\repaired_wheel --add-path C:\Users\RUNNER~1\AppData\Local\Temp\cibuildwheelldbcha4p\repaired_wheel\sisl\.libs C:\Users\RUNNER~1\AppData\Local\Temp\cibuildwheelldbcha4p\built_wheel\sisl-0.1.dev1+ga06a674-cp39-cp39-win32.whl
  Traceback (most recent call last):
    File "C:\cibw\python\pythonx86.3.9.9\tools\lib\runpy.py", line 197, in _run_module_as_main
      return _run_code(code, main_globals, None,
    File "C:\cibw\python\pythonx86.3.9.9\tools\lib\runpy.py", line 87, in _run_code
      exec(code, run_globals)
    File "C:\cibw\python\pythonx86.3.9.9\tools\Scripts\delvewheel.exe\__main__.py", line 7, in <module>
    File "C:\cibw\python\pythonx86.3.9.9\tools\lib\site-packages\delvewheel\__main__.py", line 70, in main
      wr.repair(args.target, no_mangles, args.no_mangle_all, args.lib_sdir)
    File "C:\cibw\python\pythonx86.3.9.9\tools\lib\site-packages\delvewheel\wheel_repair.py", line 392, in repair
      discovered, ignored = patch_dll.get_all_needed(extension_module_path, self._add_dlls, self._no_dlls, self._wheel_dirs)[:2]
    File "C:\cibw\python\pythonx86.3.9.9\tools\lib\site-packages\delvewheel\patch_dll.py", line 181, in get_all_needed
      raise FileNotFoundError(f'Unable to find library: {dll_name}')
  FileNotFoundError: Unable to find library: libio_m.z2qrulmp43yn7bzyxtwuv4l6mjf2c6ct.gfortran-win32.dll
  repairing C:\Users\RUNNER~1\AppData\Local\Temp\cibuildwheelldbcha4p\built_wheel\sisl-0.1.dev1+ga06a674-cp39-cp39-win32.whl
  finding DLL dependencies

Here are the CI logs: https://github.com/pfebrer/sisl/runs/4999376946?check_suite_focus=true And here is the wheel that is built and we are trying to repair: sisl-0.1.dev1+g1b94514-cp39-cp39-win32.zip

I should say that we are quite lost on how dll are managed by windows, so presumably we are doing things wrong :) Any pointers in the right direction would be very highly appreciated :sweat_smile:

Thanks!

adang1345 commented 2 years ago

The wheel you are trying to repair already has libio_m.z2qrulmp43yn7bzyxtwuv4l6mjf2c6ct.gfortran-win32.dll in it. By default, delvewheel does not check whether a DLL is already in the wheel and tries to find it from an external source. To change this behavior, use the --ignore-in-wheel flag.

pfebrer commented 2 years ago

Thank you very much! --ignore-in-wheel works for windows_amd64, but it doesn't seem to work for the 32bit version, is this intended/known?

See logs: https://github.com/pfebrer/sisl/runs/5003473146?check_suite_focus=true

adang1345 commented 2 years ago

Does the wheel you are trying to repair contain the file libio_m.z2qrulmp43yn7bzyxtwuv4l6mjf2c6ct.gfortran-win32.dll? If not, that's the problem. If so, upload the wheel here and I'll take a look at it.

pfebrer commented 2 years ago

Yes, it's exactly the one that I uploaded :)

pfebrer commented 2 years ago

Or where you able to repair that one? If so I can double check that the file is still there in the last CI runs, but I didn't change anything about the build process, so it should be there.

adang1345 commented 2 years ago

For the wheel you uploaded, libio_m.z2qrulmp43yn7bzyxtwuv4l6mjf2c6ct.gfortran-win32.dll is 64-bit. The FileNotFoundError is occurring because delvewheel is unable to find a 32-bit version of this file when you try to repair a 32-bit wheel.

pfebrer commented 2 years ago

Ok, nice! I guess that solves the mistery. I have no idea how to make this file be 32-bit but it is what it is :sweat_smile:

Thanks for the help!