From bd0afe08327836fc020f3058f4d26a4ef778c61d Mon Sep 17 00:00:00 2001 From: memento Date: Thu, 21 Dec 2023 09:44:50 -0600 Subject: [PATCH] (fix) linking on windows requires to prepend with 'lib' --- setup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c36aac93c..4ace1266f 100644 --- a/setup.py +++ b/setup.py @@ -221,7 +221,12 @@ def run(self): self.define = _build_clib.build_flags['define'] - print(self) + if os.name == 'nt' or sys.platform == 'win32': + # Apparently, the linker on Windows interprets -lxxx as xxx.lib, not libxxx.lib + for i, v in enumerate(self.__dict__.get('extra_link_args')): + if v.endswith('.lib'): + self.__dict__['extra_link_args'][i] = f'lib{v}' + return _build_ext.run(self)