I wanted to give a raylib a try yesterday and wrote a minimal example in C. I don't program in C a lot, and when I do, I usually only need the standard library and the windows API. I'm on windows 11 and use the mingw64 toolchain to compile my C programs. So I installed raylib in mingw64 using pacman, and then tried to use pkgconf to output the right include and libs flags to gcc.
But the compilation failed, because the compiler couldn’t find the raylib functions. I have identified the problem, which is that pkgconf --cflags raylib returns nothing when I run it in my mingw64 terminal, and therefore raylib.h isn’t included. The --libs option also seems to be impacted.
This only happens within the mingw64 terminal. In cmd, it all works fine (see minimal reproducible example below):
pkgconf --cflags --libs raylib
# in cmd returns:
-IC:/msys64/mingw64/bin/../include -LC:/msys64/mingw64/bin/../lib -lraylib
# in mingw64 returns only:
-lraylib
To be clear, my issue is not with how to use pkgconf or how to compile raylib. My issue is specifically that pkgconf doesn’t work as intended in the mingw64 terminal.
After investigation, here's what I know:
which pkgconfis/mingw64/bin/pkgconf, both in mingw64 and cmd.- PKG_CONFIG_PATH is
/mingw64/lib/pkgconfig:/mingw64/share/pkconfig(but the latter doesn't exist) - there is indeed a raylib.pc file at
mingw64/lib/pkgconfig, and just one - however,
pkgconf --list-all | grep rayliblists raylib twice - when I try in debug mode, it seems that pkgconf does find the raylib.pc file, but also finds a raylib-uninstalled.pc file (
../pkgconf-2.5.1/libpkgconf/pkg.c:758 [pkgconf_pkg_try_specific_path]: found: C:\msys64\mingw64\lib\pkgconfig\raylib-uninstalled.pc) - there is no raylib-uninstalled.pc file at that location...
- specifying the whole address of the raylib.pc file in the pkgconf command doesn't change anything (although I could swear it worked yesterday…)
Does anyone have an idea of what is going on? Thanks