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
Broken pkg-config Libs.private OpenGL libraries with MinGW cross compilation. #2837
Comments
Is it valid to add a |
No, it would also be wrong to have Perhaps you could check for Windows, then hardcode the OpenGL libs used in the pkg-config scripts to |
Looks like we'll need some very specific solution where we check the value of those two cache variables produced by You might have found something worth reporting to Kitware as a CMake bug. You should consider reaching out. https://gitlab.kitware.com/cmake/cmake/-/issues |
OpenGL detection is already working for building SFML, right? So all you need is a dedicated variable for the pkg-config scripts, where you hardcode the result for Windows builds, instead of using the detected OpenGL. |
Prerequisite Checklist
Describe your issue here
The
sfml-window.pc
andsfml-graphics.pc
scripts have incorrect expansions for the OpenGL libraries in theLibs.private
variable.When invoking
pkg-config --libs --static sfml-window
on a MinGW cross-compilation, the OpenGL libraries are reported asopengl32 glu32
. Same thing happens withsfml-graphics
.These are not valid libraries for linking, it should either be the full path (e.g.
/usr/i686-w64-mingw32/sys-root/mingw/lib/libglu32.a /usr/i686-w64-mingw32/sys-root/mingw/lib/libopengl32.a
) or specified with the-l
option (e.g.-lglu32 -lopengl32
).This problem does not occur with native Linux compilation; the reported libraries are
/usr/lib64/libGL.so /usr/lib64/libGLU.so
(although the order should beGLU
thenGL
.)This problem also does not occur in
sfml-audio.pc
, where OpenAL is used inLibs.private
; it correctly expands to the full path (e.g./usr/i686-w64-mingw32/sys-root/mingw/lib/libOpenAL32.dll.a
).Your Environment
-DCMAKE_TOOLCHAIN_FILE=/usr/share/mingw/toolchain-mingw32.cmake
-DBUILD_SHARED_LIBS=TRUE
-DSFML_USE_SYSTEM_DEPS=TRUE
-DSFML_INSTALL_PKGCONFIG_FILES=TRUE
Steps to reproduce
i686-w64-mingw32-pkg-config --libs --static sfml-window
Expected behavior
It should print
-lsfml-window -lglu32 -lopengl32 -lsfml-system
, which is what can be used by the linker.Actual behavior
It prints
-lsfml-window opengl32 glu32 -lsfml-system
, and any attempt to use that for linking causes errors:The text was updated successfully, but these errors were encountered: