Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to the minizip-ng-compat #569

Closed
ljavorsk opened this issue Nov 23, 2023 · 4 comments
Closed

Port to the minizip-ng-compat #569

ljavorsk opened this issue Nov 23, 2023 · 4 comments

Comments

@ljavorsk
Copy link
Contributor

The libdigidocpp is not able to build with minizip-ng [1] in compat mode.

I've disabled the requirements for the minizip < 2.0.0 in CMake, however, it still fails to build due to the following errors when building ZipSerialize.cpp:

/builddir/build/BUILD/libdigidocpp-3.16.0/src/util/ZipSerialize.cpp:114:80: error: ‘uLong’ was not declared in this scope; did you mean ‘ulong’?
  114 |         unzResult = unzGetCurrentFileInfo(d->open, &fileInfo, fileName.data(), uLong(fileName.size()), nullptr, 0, nullptr, 0);
      |                                                                                ^~~~~
      |                                                                                ulong
/builddir/build/BUILD/libdigidocpp-3.16.0/src/util/ZipSerialize.cpp: In member function ‘void digidoc::ZipSerialize::extract(const std::string&, std::ostream&) const’:
/builddir/build/BUILD/libdigidocpp-3.16.0/src/util/ZipSerialize.cpp:138:58: error: invalid conversion from ‘int’ to ‘unzFileNameComparer’ {aka ‘int (*)(void*, const char*, const char*)’} [-fpermissive]
  138 |     int unzResult = unzLocateFile(d->open, file.c_str(), 1);
      |                                                          ^
      |                                                          |
      |                                                          int
In file included from /usr/include/minizip/unzip.h:10,
                 from /builddir/build/BUILD/libdigidocpp-3.16.0/src/util/ZipSerialize.cpp:26:
/usr/include/minizip/mz_compat.h:352:87: note:   initializing argument 3 of ‘int unzLocateFile(unzFile, const char*, unzFileNameComparer)’
  352 | ZEXPORT int     unzLocateFile(unzFile file, const char *filename, unzFileNameComparer filename_compare_func);
      |                                                                   ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/libdigidocpp-3.16.0/src/util/ZipSerialize.cpp: In member function ‘void digidoc::ZipSerialize::addFile(const std::string&, std::istream&, const Properties&, Flags)’:
/builddir/build/BUILD/libdigidocpp-3.16.0/src/util/ZipSerialize.cpp:188:17: error: cannot convert ‘<brace-enclosed initializer list>’ to ‘uint32_t’ {aka ‘unsigned int’} in initialization
  188 |         0, 0, 0 };
      |                 ^
/builddir/build/BUILD/libdigidocpp-3.16.0/src/util/ZipSerialize.cpp:191:41: error: ‘Z_NULL’ was not declared in this scope; did you mean ‘NULL’?
  191 |     int method = flags & DontCompress ? Z_NULL : Z_DEFLATED;
      |                                         ^~~~~~
      |                                         NULL
/builddir/build/BUILD/libdigidocpp-3.16.0/src/util/ZipSerialize.cpp:192:40: error: ‘Z_NO_COMPRESSION’ was not declared in this scope
  192 |     int level = flags & DontCompress ? Z_NO_COMPRESSION : Z_DEFAULT_COMPRESSION;
      |                                        ^~~~~~~~~~~~~~~~
/builddir/build/BUILD/libdigidocpp-3.16.0/src/util/ZipSerialize.cpp:192:59: error: ‘Z_DEFAULT_COMPRESSION’ was not declared in this scope
  192 |     int level = flags & DontCompress ? Z_NO_COMPRESSION : Z_DEFAULT_COMPRESSION;
      |                                                           ^~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/libdigidocpp-3.16.0/src/util/ZipSerialize.cpp:193:5: error: ‘uLong’ was not declared in this scope; did you mean ‘ulong’?
  193 |     uLong UTF8_encoding = 1 << 11; // general purpose bit 11 for unicode
      |     ^~~~~
      |     ulong
/builddir/build/BUILD/libdigidocpp-3.16.0/src/util/ZipSerialize.cpp:196:36: error: ‘Z_DEFAULT_STRATEGY’ was not declared in this scope
  196 |         -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, nullptr, 0, 0, UTF8_encoding);
      |                                    ^~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/libdigidocpp-3.16.0/src/util/ZipSerialize.cpp:196:71: error: ‘UTF8_encoding’ was not declared in this scope
  196 |         -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, nullptr, 0, 0, UTF8_encoding);
      |                                                                       ^~~~~~~~~~~~~
/builddir/build/BUILD/libdigidocpp-3.16.0/src/util/ZipSerialize.cpp: In member function ‘digidoc::ZipSerialize::Properties digidoc::ZipSerialize::properties(const std::string&) const’:
/builddir/build/BUILD/libdigidocpp-3.16.0/src/util/ZipSerialize.cpp:224:58: error: invalid conversion from ‘int’ to ‘unzFileNameComparer’ {aka ‘int (*)(void*, const char*, const char*)’} [-fpermissive]
  224 |     int unzResult = unzLocateFile(d->open, file.c_str(), 1);
      |                                                          ^
      |                                                          |
      |                                                          int
/usr/include/minizip/mz_compat.h:352:87: note:   initializing argument 3 of ‘int unzLocateFile(unzFile, const char*, unzFileNameComparer)’
  352 | ZEXPORT int     unzLocateFile(unzFile file, const char *filename, unzFileNameComparer filename_compare_func);
      |                                                                   ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/libdigidocpp-3.16.0/src/util/ZipSerialize.cpp:244:97: error: ‘uLong’ was not declared in this scope; did you mean ‘ulong’?
  244 |     unzResult = unzGetCurrentFileInfo(d->open, &info, nullptr, 0, nullptr, 0, &prop.comment[0], uLong(prop.comment.size()));
      |                                                                                                 ^~~~~
      |                                                                                                 ulong
gmake[2]: *** [src/CMakeFiles/digidocpp.dir/build.make:489: src/CMakeFiles/digidocpp.dir/util/ZipSerialize.cpp.o] Error 1

[1] https://github.com/zlib-ng/minizip-ng/

@Neustradamus
Copy link

Dear @open-eid team,

Have you seen the @ljavorsk ticket?

@ljavorsk
Copy link
Contributor Author

ljavorsk commented Dec 6, 2023

Just to make it clear, we've found that this is actually incompatibility in minizip-ng tool, that's why I've linked the issue from their project here.

@Neustradamus
Copy link

Dear @open-eid team, @metsma, @Telgat, @uudisaru, @klemensn, @Counter178, @kristelmerilain, @olegprokofjev, @Germano0, @botovq, @eidins, @jsanko, @hniinemae, @tanelts, @martinpaljak, @kristiu,

A lot of OS have migrated from minizip to minizip-ng and from zlib to zlib-ng:

@ljavorsk is from Red Hat/Fedora team and he has worked on integration, he has done a good work.

Can you look the problem of libdigidocpp?

Thanks in advance.

Linked to:

@metsma
Copy link
Contributor

metsma commented Dec 6, 2023

The problem is not in libdigidocpp instead in minizip-ng.
It is not compatible with stock minizip and minizip-ng compatiblity layer needs to be fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants