Ubuntu install libpng prompt configure: error: ZLib not installed solution

       In the process of compiling and installing zlib, if you use prefix= to specify the output directory, when the libpng library is installed, an error that the zlib library cannot be found will be displayed, error message: configure: error: ZLib not installed

          Because of this problem, I checked many online solutions, basically using make clean to clear the original zlib installation library, and recompiling without prefix= instruction, but when the zlib library and other libraries are also used as third-party dependencies It is very troublesome when the library source has only one dependent library path. So the following solution can solve the problem without changing the installation path of zlib:

        To solve this problem, the most important thing is to understand that the libpng library does not require configure, because the makefile is already provided in the scripts directory, so there is no need to use configure to create the makefle file.

           Therefore, copy makefile.linux in the scripts directory to the root directory of the source code package and just make it directly. But in order to solve the problem of not being able to find the zlib library, this makefile needs to be modified.

       The following are the specific steps to install libpng:

          (1)cp scripts/makefile.linux makefile

          (2)vim makefile

          (3) Find the two lines related to zlib in the makefile, modify them to the actual zlib/lib and zlib/include, then find the prefix item, and modify it to the directory you want to prefix,

             If this is cross-compilation, you also need to modify gcc to your system's cross-compiler on the cc side, for example: arm-linux-gcc

          (4) Save and make make install

Guess you like

Origin blog.csdn.net/qq_27575841/article/details/108686331