cardiff space man
cardiff space man

Reputation: 1526

How do I install libpng on MSYS2?

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?

Upvotes: 1

Views: 3851

Answers (3)

Rainb
Rainb

Reputation: 2465

if you really want libpng on MSYS2 then use

wget https://downloads.sourceforge.net/sourceforge/libpng/libpng-1.6.43.tar.xz
tar -xvf libpng-1.6.43.tar.xz
cd libpng-1.6.43.tar.xz
./configure
make install

However if you want it for the mingw/ucrt/clang.. etc enviroment then it should be available pacboy -S libng:p where p is {u,x} etc. (pactools should be installed)

Upvotes: 0

yashrajaman
yashrajaman

Reputation: 1

I came across the same problem. I have just learned about this project and thought of trying. I was trying to download and install The Silver Searcher or ag which is a similar command to grep/ack. I was trying to install using package name from the repository.

pacman -S mingw-w64-ag

Also tried,

 pacman -Ss mingw-w64-ag

Solution: We need binary file name. We can click on the repository name and find the binary file names mentioned there. We can use the binary file name to install any package.SS for file names.

Upvotes: 0

Sam Rice
Sam Rice

Reputation: 281

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

Upvotes: 5

Related Questions