1

I want to build a program with mingw w64 and I have msys2 installed.

I tried to work with pacman from the msys2 prompt.

$ pacman -Q libpng
error: package 'libpng' was not found
$ pacman -S libpng
error: target not found: libpng
$ pacman -S *libpng
error: target not found: *libpng

I attempted to use google and came up with:

$ pacman -S mingw-w64-libpng
error: target not found: mingw-w64-libpng
$ pacman -F mingw-w64-libpng
warning: database file for 'mingw32' does not exist (use '-Fy' to download)
warning: database file for 'mingw64' does not exist (use '-Fy' to download)
warning: database file for 'msys' does not exist (use '-Fy' to download)
error: no options specified (use -h for help)

Very peculiar that after all the downloading I did, which I distinctly recall including a database for pacman, that these database files don't seem to exist.

$ pacman -Fy mingw-w64-libpng
[... stuff downloads ... ]
error: no options specified (use -h for help)
$ pacman -U mingw-w64-libpng
loading packages...
error: 'mingw-w64-libpng': could not find or read package

So now the questions are,

1) How in the future will I find the magic prefix for a well-known library in order to be able to tell pacman what to install?

2) How at the moment do I instruct pacman to install the libpng package which seems to be in the mingw-w64-libpng package?

3) Is that the package with the development headers or is that yet another package, as I have adjusted to on Deb/Ubuntu by looking for something like libpng-dev?

cardiff space man
  • 1,254
  • 12
  • 26

1 Answers1

2

Have you tried pacman -Ss libpng? This will list all packages mentioning libpng, prefix and all:

$ pacman -Ss libpng
mingw32/mingw-w64-i686-libpng 1.6.35-1
    A collection of routines used to create PNG format graphics (mingw-w64)
mingw64/mingw-w64-x86_64-libpng 1.6.35-1 [installed]
    A collection of routines used to create PNG format graphics (mingw-w64)

I notice that these names include an architecture (i686/x86_64), which is fairly common in MinGW package names.

EDIT: The headers end up here:

$ ls /mingw64/include/libpng16/
png.h  pngconf.h  pnglibconf.h
Samuel Rice
  • 251
  • 2
  • 5
  • I did `pacman -S git` and git was then installed. I did `pacman -Ss libpng` and it gave the same output you showed. I then did `pacman -S mingw-w64-x86_64-libpng` and it suggested to install ` mingw-w64-x86_64-gcc-libs-8.3.0-2 mingw-w64-x86_64-gmp-6.1.2-1 mingw-w64-x86_64-libwinpthread-git-7.0.0.5447.a2d94c81-1 mingw-w64-x86_64-mpc-1.1.0-1 mingw-w64-x86_64-mpfr-4.0.2-2 mingw-w64-x86_64-zlib-1.2.11-7 mingw-w64-x86_64-libpng-1.6.37-3` which includes the runtime library for the winpthread system if I read that right. I installed mingw64 intending to have win32 threads. Wrong? – cardiff space man Jun 16 '19 at 19:10
  • 1
    May I see the full output of `pacman -S mingw-w64-x86_64-libpng`? Did libpng install anyway, or did it insist you install these packages first? I would expect that libwinpthread uses windows threads underneath, and just wraps it in a pthread-like interface, but I'm afraid this is pure speculation. Perhaps you could ask a separate question? I'd be interested to know too. – Samuel Rice Jun 16 '19 at 19:33
  • Samuel Rice has provided the correct answer for the original question, so the OP should click the checkmark to accept it. You could ask a new question about threading models if you are concerned about that now. Discussions here are supposed to be tightly focussed. – David Grayson Jun 16 '19 at 23:27
  • @DavidGrayson if a focused discussion is valued then it should be focused on the results I need. Either the threading aspect is on topic to THIS question because it factors in to actual success, or I should delete this question. Then I could start over, so that the question I ask has as its explicit goal to get libpng installed matching the MSYS2 system I am trying to match. After deleting the question, another alternative is to drop msys2/mingw-w64 instead of trying the question again. Samuel Rice's answer is right in some context but it's not sufficient for me. – cardiff space man Jun 18 '19 at 15:50
  • You should not move the goal posts after asking the question. The libpng that Samuel Rice pointed to you to does match MSYS2 and is right in the context of the question you actually asked. Much of the MinGW software in MSYS2 depends on libwinpthread. It's just another DLL you have to include when redistributing. – David Grayson Jun 18 '19 at 17:25
  • Just because you disagree with the MSYS2 developers about some detail about how they compiled libpng doesn't mean you should punish other people like Samuel Rice who are trying to help you and have provided the correct answer to the main question you asked. I don't see what is so hard about clicking the checkmark, upvoting his answer, and then asking another question with all of your actual requirements in it. – David Grayson Jun 18 '19 at 17:30
  • I don't really believe this should be part of this question, but since I would like to help you as best I can, I've done some digging. libwinpthread does seem to be just a wrapper around win32 threads. You can see the calls to the Windows threading API for yourself in the source code [here](https://github.com/mirror/mingw-w64/blob/master/mingw-w64-libraries/winpthreads/src/thread.c). – Samuel Rice Jun 21 '19 at 00:13
  • I also found [this](https://stackoverflow.com/questions/17242516/mingw-w64-threads-posix-vs-win32) and [this](https://stackoverflow.com/questions/37358856/does-mingw-w64-support-stdthread-out-of-the-box-when-using-the-win32-threading). – Samuel Rice Jun 21 '19 at 00:13