Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking against MSVC 2019/2022 from a MingW compilation #296

Open
ggarra13 opened this issue Oct 31, 2024 · 2 comments
Open

Linking against MSVC 2019/2022 from a MingW compilation #296

ggarra13 opened this issue Oct 31, 2024 · 2 comments

Comments

@ggarra13
Copy link

I managed to use libplacebo to handle tonemapping on both Linux and macOS without any issues, by reading all the metadata of FFmpeg, following the discussion on #294.

Now my issue is on Windows. I am able to compile a libplacebo DLL on Windows with MingW64 to link against MSVC, which I thought it would fine as I thought libplacebo was all .c code. However, there seems to be at least one c++ file that relies on c++ std (convert.cc) and as such is not compatible. Well there's also glslang.cc but I am not using that.

Are there plans to change that C++ file with a C implementation? It seems all (I know it is quite a lot) needed to create pl_str_parse_* and pl_str_print_* for all the different types and make libplacebo a pure C library, instead of using template functions.

@duiniuluantanqin
Copy link

How did you compile the libplacebo DLL on Windows? I'm getting errors when using MSYS2.

admin@DESKTOP-96PR2B9 MINGW64 ~/libplacebo
# meson setup build
The Meson build system
Version: 1.6.0
Source dir: C:\msys64\home\admin\libplacebo
Build dir: C:\msys64\home\admin\libplacebo\build
Build type: native build
Project name: libplacebo
Project version: 7.349.0

meson.build:1:0: ERROR: Found GNU link.exe instead of MSVC link.exe in C:\msys64\usr\bin\link.EXE.
This link.exe is not a linker.
You may need to reorder entries to your %PATH% variable to resolve this.

A full log can be found at C:\msys64\home\admin\libplacebo\build\meson-logs\meson-log.txt

@ggarra13
Copy link
Author

ggarra13 commented Nov 6, 2024

You need to compile it with clang, which is distributed with MSVC (it is an optional install).
Alternatively, you can compile it with the mingw compiler (but will only link against your own mingw).

You need to set the CC and CXX environment variables.

However, the particular error you are getting is due to "link.exe" which is an MSys command and "link.exe" which is the linker on MSVC getting mixed up. Just rename the Msys command from link.exe to link_msys.exe to avoid confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants