From: Martin S. <ma...@ma...> - 2022-01-22 12:39:30
|
Hi, On Sat, 22 Jan 2022, Matthew Brett wrote: > The Scipy build links against a static library `npymath.lib`, until > recently built with VS2017 v141 toolset. Mixing static libraries or object files between mingw and msvc is not supported, and not expected to work, in general. You might have been lucky and your library might have been simple enough not to hit any problematic case though. Or are the python pyd files linked with msvc tools - what parts are based on mingw in this constellation? > This build worked fine, until recently when the build for > `npymath.lib` switched to using the VS2019 v142 toolset. Our build > now runs to completion without error, but the generated dynamic link > libraries, _that link to the npymath.lib file_ all generate errors on > loading, of form: > > C:\repos\scipy\installdir\Lib\site-packages\scipy\spatial\_distance_wrap.cp39-win_amd64.pyd > Error 193: C:\repos\scipy\installdir\Lib\site-packages\scipy\spatial\_distance_wrap.cp39-win_amd64.pyd > is not a valid Win32 application. > > This is ERROR_BAD_EXE_FORMAT (193, 0xC1) So while this isn't a setup that is supported, this error doesn't sound like one of those that you'd expect to run into if mixing in msvc static libraries in a mingw environment. It sounds like some odd mixup of architectures or other details. I don't have any other clues offhand, but you'd have to sit down and inspect the generated dll (pyd) with tools like objdump, llvm-readobj etc, to pinpoint what's wrong in it. // Martin |