Skip to content

[Docs] Add note in setupscript.rst noting that runtime_library_dirs errors on Windows #2753

Open
@phetdam

Description

@phetdam

Summary

runtime_library_dirs named argument of the Extension causes MSVC to error on Windows and so cannot be used to specify directories to search for DLLs. setupscript.rst, i.e. Writing the Setup Script, should be updated to reflect this and should specify additional methods of locating DLLs, e.g. updating %PATH% or using data_files kwarg of the setup function.

OS / Environment

Occurred on Windows Server 2019 GitHub Actions runner with Visual Studio Enterprise 2019 installed for Python 3.6 with setuptools==57.1 while running cibuildwheel. Likely replicable on Windows machines in general.

Additional Information

When using setuptools to build C extensions on Windows that link against external DLLs with import libraries (.lib), users (including me) are likely to use the runtime_library_dirs named argument of the Extension to specify path to DLLs while using library_dirs to specify path to the corresponding import libraries.

However, specifying runtime_library_dirs on Windows leads to the following MSVC error:

warning: I don't know what to do with 'runtime_library_dirs': [<list-of-directories>]
error: don't know how to set runtime library search path for MSVC

There is a note in the link method of the distutils CCompiler that states that "runtime_library_dirs is a list of directories that will be embedded into the shared library and used to search for other shared libraries that *it* depends on at run-time. (This may only be relevant on Unix.)", but a similar note should be added in docs/deprecated/distutils/setupscript.rst to make this fact more visible to the end user, saving them the pain of reading the distutils docs.

Furthermore, alternate methods of locating DLLs on Windows should also be documented, for example updating %PATH% or copying DLLs to a known directory by using the data_files argument of the setup function, to give workarounds for not being able to use runtime_library_dirs on Windows as is possible for *nix systems.

Code of Conduct

  • I agree to follow the PSF Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageIssues that need to be evaluated for severity and status.documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions