ripose-jp / Memento

An mpv-based video player for studying Japanese
https://ripose-jp.github.io/Memento/
GNU General Public License v2.0
441 stars 21 forks source link

error: 'zip_get_num_files' is deprecated: use 'zip_get_num_entries' instead #171

Closed teto closed 11 months ago

teto commented 11 months ago

when building memento on nixpkgs, I get a deprecation notice due to a libzip bump probably:

 > [ 16%] Building CXX object src/dict/CMakeFiles/yomidbbuilder.dir/yomidbbuilder_autogen/mocs_compilation.cpp.o
       > [ 17%] Building C object src/dict/CMakeFiles/yomidbbuilder.dir/yomidbbuilder.c.o
       > /build/source/src/dict/yomidbbuilder.c: In function 'extract_resources':
       > /build/source/src/dict/yomidbbuilder.c:1878:5: error: 'zip_get_num_files' is deprecated: use 'zip_get_num_entries' instead [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wdeprecated-declarations-Werror=deprecated-declarations8;;]
       >  1878 |     for (zip_int64_t i = 0; i < zip_get_num_files(dict_archive); ++i)
       >       |     ^~~
       > In file included from /build/source/src/dict/yomidbbuilder.c:31:
       > /nix/store/pqyv8i5mp5chbrms3rp0djbmsq7qzw9i-libzip-1.10.0-dev/include/zip.h:379:68: note: declared here
       >   379 | ZIP_DEPRECATED("use 'zip_get_num_entries' instead") ZIP_EXTERN int zip_get_num_files(zip_t *_Nonnull);
       >       |                                                                    ^~~~~~~~~~~~~~~~~

posting this in case you were unaware

ripose-jp commented 11 months ago

Thanks for the report, but this has already fixed on master with 267e4a4

teto commented 11 months ago

is there going to be a release soon ? to know when to update the package

ripose-jp commented 11 months ago

The bug fixes since the last release are very minor and there's only one new feature. I don't see the point at the moment.

ohdearaugustin commented 11 months ago

JFYI: This is also a issue for the AUR package. Looking forward to a new release.

ripose-jp commented 11 months ago

Is it just a warning or is it actually preventing compilation? I will say my opinion on making a new release has changed since I just found out that mpv made a new release in the past few weeks. Since most people use the Windows version, new releases of Memento are really the only way to get out new versions of mpv to those users.

nyxkn commented 11 months ago

With the Archlinux aur package, build does fail, not just a warning. (because of -Werror=deprecated-declarations?)

.../memento/src/Memento-1.1.0/src/dict/yomidbbuilder.c: In function ‘extract_resources’:
.../memento/src/Memento-1.1.0/src/dict/yomidbbuilder.c:1878:5: error: ‘zip_get_num_files’ is deprecated: use 'zip_get_num_entries' instead [-Werror=deprecated-declarations]
 1878 |     for (zip_int64_t i = 0; i < zip_get_num_files(dict_archive); ++i)
      |     ^~~
In file included from .../memento/src/Memento-1.1.0/src/dict/yomidbbuilder.c:31:
/usr/include/zip.h:379:68: note: declared here
  379 | ZIP_DEPRECATED("use 'zip_get_num_entries' instead") ZIP_EXTERN int zip_get_num_files(zip_t *_Nonnull);
      |                                                                    ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [src/dict/CMakeFiles/yomidbbuilder.dir/build.make:90: src/dict/CMakeFiles/yomidbbuilder.dir/yomidbbuilder.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:686: src/dict/CMakeFiles/yomidbbuilder.dir/all] Error 2
ripose-jp commented 11 months ago

I've updated the PKGBUILD in the AUR with a band aid that will fix the build until I get a new release out.

@teto Here's the change if you want to use it as a stopgap. It's apparently important that cmake -E env be followed by a normal configure call to cmake in the same command.

cmake -E env \
    CFLAGS="-Wno-error=deprecated-declarations" \
    CXXFLAGS="-Wno-error=deprecated-declarations" \
cmake ..
nyxkn commented 11 months ago

Works fine, thanks!

ohdearaugustin commented 11 months ago

Thank you (=

teto commented 11 months ago

@ripose-jp thanks. No one complained about the broken package yet so till it happens, I'll wait for a release.

ripose-jp commented 11 months ago

@teto v1.2.0 has just been published and I've removed -Werror from the compiler flags so something like this doesn't happen again.