Opened 7 months ago
Last modified 7 months ago
#10233 new defect
Compile with libraries with MSVC
| Reported by: | dimasafonis | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | build system |
| Version: | git-master | Keywords: | |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
I can't compile libraries using MSVC 2022.
This line:
./configure --toolchain=msvc
creates libraries in .a format which is incompatible with MSVC.
This line:
./configure --toolchain=msvc --enable-shared
creates normal .lib and .dll files, but I can't use it with pkg-config because pkg-config uses -lm flag but there's no m.lib file in Windows.
Change History (4)
comment:1 by , 7 months ago
comment:2 by , 7 months ago
creates libraries in .a format which is incompatible with MSVC.
Why? .a file is just a static linked library, called .lib in windows. .dll is on linux .so and is dynamic (well, except for the whole ld-linux.so mess, cause ld-linux.so is an executable really, link to ld-linux.so is absolute in all .so).
Does renaming to .lib work?
comment:3 by , 7 months ago
Renaming to .lib works. Thank you very much.
I thought it's an ar archive and msvc can't work with it.
Now it works, but why does configure set a static library prefix incorrectly?
And why does it search for the m library on windows? It checks if dlopen and dlsym are in a separate library or not. So why doesn't it do the same with m library?
comment:4 by , 7 months ago
but why does configure set a static library prefix incorrectly?
Does it even support VS 2022?
and why does it search for the m library on windows
You mean libm.so? You do understand windows math.h standard library is also called libm, right? https://github.com/amd/win-libm/blob/master/pow.asm#L108



Last time msvc worked was in 2021. https://github.com/mcmtroffaes/ffmpeg-msvc-build
There were some fixes since then but I dunno whether it works.
https://github.com/FFmpeg/FFmpeg/search?o=desc&q=msvc&s=committer-date&type=commits
And anyway, MSVC produces worse binaries than gcc for windows.