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
[SDL2_ttf] Missing C++ symbols statically linked with C #20756
Comments
Seems like there have been related issues with harfbuzz in the past: #2635 |
For static linking you have to add all the required libraries. See the output of |
@Biswa96 I believe meson automagically pulls in the pkgconfig dependencies. Comparing the first line of the above logs with the output of |
You are probably missing |
Adding |
Those libraries depends on stdc++ |
Is there documentation surrounding that? I didn't find anything on the SDL website. I would have thought the library should be compiled with static stdc++, rather than passing the buck to the user. Though maybe that's not possible. |
Could be that meson fails to detect the c++ dep(?). Since adding
|
pkgconf (which I believe meson uses under the hood) doesn't list C++ as a dependency for any of the related packages ("sdl2", "sdl2_ttf", "harfbuzz" or "graphite2"). It is of course not a big issue to link against C++, but it feels unintuitive for an end user building a C app, and wanting to use a C library. |
I agree. It's not clear to me where this could/should be improved though. |
You need to satisfy the library's dependencies, and the dependencies of the dependencies... pkgconf is failing to do that for you, but it's the same basic, messy stuff programmers are dealing with since the dawn of times. |
That shouldn't be to say we shouldn't fix it when we can! 😄 |
Which dependency of SDL2_ttf needs C++/libstdc++? |
Or it's just a purely a build system misconfiguration? |
Both harfbuzz and graphite2 both depend on C++ symbols, but in this case graphite2 is a dependency of harfbuzz. Sdl2_ttf is not directly dependent on C++. Interestingly, when sdl2_ttf is built using its bundled harfbuzz version, it does make sure to enable linking against c++: https://github.com/libsdl-org/SDL_ttf/blob/SDL2/CMakeLists.txt#L192 |
This is by-design and not actionable from msys2 packaging perspective. |
Description / Steps to reproduce the issue
When statically linking "SDL2_ttf" in a C project, the linker throws errors for missing symbols. This can be worked around by including "stdlibc++", but this shouldn't be required?
Error
Minimal reproduction
main.c;
meson.build:
Expected behavior
The project is successfully linked.
Actual behavior
The linker throws an error for missing "stdlibc++" symbols.
Verification
Windows Version
MSYS_NT-10.0-19045
MINGW environments affected
Are you willing to submit a PR?
Probably not :(
The text was updated successfully, but these errors were encountered: