0

I wanted to compile mosaic on my ubuntu machine, but while compiling, I did not have right libpng version, so the compilation aborted with error:

error: invalid use of incomplete typedef ‘png_struct’ {aka ‘struct png_struct_def’}
  179 |     *width = (int)png_ptr->width;

So I install the ritgh pnglib version:

$ wget https://downloads.sourceforge.net/project/libpng/libpng16/older-releases/1.2.21/libpng-1.2.21.tar.gz -O libpng.tar.gz
$ tar -xvf libpng.tar.gz
$ cd libpng-1.2.21
$ sudo bash configure --prefix=/usr/local/libpng
$ sudo make install

which contain the definition for struct png_struct. But now the library is in /usr/local/libpng. So the compilation of the mosaic do not see it (and thus do not have the struct definition and aborts).

the library dir is:

$/usr/local/libpng$ tree .
.
├── bin
│   ├── libpng12-config
│   └── libpng-config -> libpng12-config
├── include
│   ├── libpng12
│   │   ├── pngconf.h
│   │   └── png.h
│   ├── pngconf.h -> libpng12/pngconf.h
│   └── png.h -> libpng12/png.h
├── lib
│   ├── libpng12.a
│   ├── libpng12.la
│   ├── libpng12.so -> libpng12.so.0.59.0
│   ├── libpng12.so.0 -> libpng12.so.0.59.0
│   ├── libpng12.so.0.59.0
│   ├── libpng.a -> libpng12.a
│   ├── libpng.la -> libpng12.la
│   ├── libpng.so -> libpng12.so
│   ├── libpng.so.3 -> libpng.so.3.59.0
│   ├── libpng.so.3.59.0
│   └── pkgconfig
│       ├── libpng12.pc
│       └── libpng.pc -> libpng12.pc
└── share
    └── man
        ├── man3
        │   ├── libpng.3
        │   └── libpngpf.3
        └── man5
            └── png.5

9 directories, 21 files

The question is simple, what directory (e.g. include or lib) should I move elsewhere (e.g. /src/include) in order to make to compilation of mosaic successful (by getting the proper definition it needs)?

  • I'm not familiar with this library in particular, but typically if you use --prefix=/usr/local then the headers will be installed to /usr/local/include while the library file(s) will go into /usr/local/lib, both of which should be on the standard compiler search paths. You may additionally need to run ldconfig to allow programs to find the library at run-time. – steeldriver Jan 29 '21 at 15:08
  • ... alternatively of course you can specify non-standard include / library paths using -I / -L on the compiler command line, either directly or via appropriate variables such as CFLAGS – steeldriver Jan 29 '21 at 15:57

0 Answers0