numba / llvmlite

A lightweight LLVM python binding for writing JIT compilers
https://llvmlite.pydata.org/
BSD 2-Clause "Simplified" License
1.94k stars 321 forks source link

Wheel missing zlib.dll on windows #933

Closed sklam closed 1 year ago

sklam commented 1 year ago

The latest llvmlite-0.40.0rc1 wheels are missing the zlib.dll needed by llvmlite.dll.

Details in https://github.com/numba/numba/issues/8841#issuecomment-1500919832. Solution at https://github.com/numba/numba/issues/8841#issuecomment-1502036638

We will need something like the wheel_repair.py described in https://vinayak.io/2020/10/22/day-52-bundling-dlls-with-windows-wheels-the-dll-mangling-way/ to copy in the needed DLLs. Or; simply just copy in a zlib.dll from conda.

sklam commented 1 year ago

For reference, the list of dependency of llvmlite.dll is:

> dumpbin /dependents llvmlite.dll
Microsoft (R) COFF/PE Dumper Version 14.00.24245.0
Copyright (C) Microsoft Corporation.  All rights reserved.

Dump of file llvmlite.dll

File Type: DLL

  Image has the following dependencies:

    ADVAPI32.dll
    KERNEL32.dll
    MSVCP140.dll
    VCRUNTIME140.dll
    VCRUNTIME140_1.dll
    api-ms-win-crt-runtime-l1-1-0.dll
    api-ms-win-crt-heap-l1-1-0.dll
    api-ms-win-crt-locale-l1-1-0.dll
    api-ms-win-crt-stdio-l1-1-0.dll
    api-ms-win-crt-environment-l1-1-0.dll
    api-ms-win-crt-utility-l1-1-0.dll
    api-ms-win-crt-convert-l1-1-0.dll
    api-ms-win-crt-math-l1-1-0.dll
    api-ms-win-crt-string-l1-1-0.dll
    api-ms-win-crt-time-l1-1-0.dll
    zlib.dll

  Image has the following delay load dependencies:

    SHELL32.dll
    ole32.dll

  Summary

       B9000 .data
      140000 .pdata
     2052000 .rdata
       93000 .reloc
        1000 .rsrc
     296F000 .text

I checked, this list is the same across all python versions.

sklam commented 1 year ago

This python discourse thread mentions another tool for DLL fixing: https://discuss.python.org/t/delocate-auditwheel-but-for-windows/2589/11

sklam commented 1 year ago

After reviewing the use of zlib in LLVM, we probably can disable its use. The LLVM official windows build are built without ZLIB. We can control this with LLVM_ENABLE_ZLIB in the cmake config.

This is less risky than adopting/implementing a wheel repair tool for windows. There are known DLL hell problems that will make it very challenging.