It is very necessary dll'ka obtained when building one of the projects (any) in this repository: http://sourceforge.net/p/zint/code/ci/master/tree/

In this repository, as I understand it, there are several options: for qt, VC ++ and, I suppose, for C ++ in GCC. There are options for creating dll and options for creating a desktop program using this dll. I am interested in dll ...

The only problem is that I didn’t work with the above wound at a level sufficient to be able to build a project from the files presented in the repository. The project for VC ++ was not collected in my 15th studio "swoop", it swears for absence: I cannot open the inclusion file: png.h. Which is not observed in the project directory. Ideally, I would certainly like to get a working dll in VS. But if it does not, then any other option is also acceptable. Qtshny project also swears (I can not say what exactly, in the field of output gibberish some ...)

Question: What sequence of actions do I need to perform in order to compile one of the projects presented in the repository that creates the dll library.

PS: If someone compiles himself and throws a link to zint.dll, I, of course, would also appreciate it, but still I would like to know how it is done.

  • In general, on qt or when building with CMake + MinGW, the png.h error is also missing. How to deal with it is not clear ... - Alexey

1 answer 1

Build zint with PNG support

We will %BUILD_ROOT% in some %BUILD_ROOT% directory. Everywhere in the future, the directory separator should be a forward slash ( / ). When using the reverse ( \ ) possible assembly errors.

In this case, CMake version 3.3.2 and MinGW-builds version 5.2.0rev0 were used for the assembly.

  1. Build the zlib library (version 1.2.8 was used).

Download the zlib source archive and unpack it into the %BUILD_ROOT%/zlib directory. Next, collect:

 cd /d %BUILD_ROOT% mkdir zlib-build cd zlib-build cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%BUILD_ROOT%/zlib-out ../zlib cmake --build . mingw32-make install 

After that, the %BUILD_ROOT%/zlib-out directory will %BUILD_ROOT%/zlib-out compiled zlib library.

  1. Build libpng (version 1.6.19 was used).

Download the libpng source archive and unpack it into the %BUILD_ROOT%/libpng directory. We collect:

 cd /d %BUILD_ROOT% mkdir libpng-build cd libpng-build cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%BUILD_ROOT%/libpng-out -DZLIB_LIBRARY=%BUILD_ROOT%/zlib-out/lib/libzlib.dll.a -DZLIB_INCLUDE_DIR=%BUILD_ROOT%/zlib-out/include ../libpng cmake --build . mingw32-make install 

Warnings CMake ignored. After that, the %BUILD_ROOT%/libpng-out directory will %BUILD_ROOT%/libpng-out compiled libpng .

  1. Build the zint library (version 2.4.3 was used).

Download the zint source zint and unpack it into the %BUILD_ROOT%/zint . The CMakeLists.txt file is either not suitable for new versions of CMake , or it is initially an error, but in any case, an error occurs during the assembly, due to the inability to find the png.h file. To correct the error, you need to slightly edit this file, namely, in the 14th line, replace ${PNG_INCLUDES} with ${PNG_INCLUDE_DIRS} . Now you can collect:

 cd /d %BUILD_ROOT% mkdir zint-build cd zint-build cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%BUILD_ROOT%/zint-out -DZLIB_LIBRARY=%BUILD_ROOT%/zlib-out/lib/libzlib.dll.a -DZLIB_INCLUDE_DIR=%BUILD_ROOT%/zlib-out/include -DPNG_LIBRARY=%BUILD_ROOT%/libpng-out/lib/libpng.dll.a -DPNG_PNG_INCLUDE_DIR=%BUILD_ROOT%/libpng-out/include ../zint cmake --build . mingw32-make install 

Assembly warnings are ignored. After performing all the steps in the %BUILD_ROOT%/zint-out required libzint.dll library will be libzint.dll .

  1. Build without dependencies.

The resulting libzint.dll has libzint.dll dependencies, and that, in turn, has libzlib.dll . In addition, all of these libraries depend on libgcc*.dll . To remove all these dependencies and make the assembly (almost) completely independent, you can do the following.

We define two variables:

 set CFLAGS=-static set CXXFLAGS=%CFLAGS% 

These variables will remove the dependence of libraries on libgcc*.dll .

To remove libpng.dll dependency on zlib.dll , fix one parameter when running cmake :

 -DZLIB_LIBRARY=%BUILD_ROOT%/zlib-out/lib/libzlibstatic.a 

And to remove the dependency of libzint.dll from libpng16.dll and libzlib.dll , cmake needs to fix two parameters:

 -DZLIB_LIBRARY=%BUILD_ROOT%/zlib-out/lib/libzlibstatic.a -DPNG_LIBRARY=%BUILD_ROOT%/libpng-out/lib/libpng.a 

Done! The resulting library depends only on kernel32.dll and msvcrt.dll .

  • Why 2 answers? You either merge them or delete one. - ixSci
  • All gathered. Thank! - Alexey