p7zip-project / p7zip

A new p7zip fork with additional codecs and improvements (forked from https://sourceforge.net/projects/sevenzip/ AND https://sourceforge.net/projects/p7zip/).
806 stars 111 forks source link

Build errors with p7zip 21.02 #158

Closed kramer04 closed 3 years ago

kramer04 commented 3 years ago

Build errors with p7zip 21.02

$ cd p7zip/CPP/7zip/Bundles/Alone2 && make -f makefile.gcc
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/7zBuf2.o ../../../../C/7zBuf2.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/7zStream.o ../../../../C/7zStream.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/Alloc.o ../../../../C/Alloc.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/Bcj2.o ../../../../C/Bcj2.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/Bcj2Enc.o ../../../../C/Bcj2Enc.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/Blake2s.o ../../../../C/Blake2s.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/Bra.o ../../../../C/Bra.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/Bra86.o ../../../../C/Bra86.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/BraIA64.o ../../../../C/BraIA64.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/BwtSort.o ../../../../C/BwtSort.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/CpuArch.o ../../../../C/CpuArch.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/Delta.o ../../../../C/Delta.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/HuffEnc.o ../../../../C/HuffEnc.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/LzFind.o ../../../../C/LzFind.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/Lzma2Dec.o ../../../../C/Lzma2Dec.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/Lzma2DecMt.o ../../../../C/Lzma2DecMt.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/Lzma2Enc.o ../../../../C/Lzma2Enc.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/LzmaDec.o ../../../../C/LzmaDec.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/LzmaEnc.o ../../../../C/LzmaEnc.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/MtCoder.o ../../../../C/MtCoder.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/MtDec.o ../../../../C/MtDec.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/Ppmd7.o ../../../../C/Ppmd7.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/Ppmd7Dec.o ../../../../C/Ppmd7Dec.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/Ppmd7aDec.o ../../../../C/Ppmd7aDec.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/Ppmd7Enc.o ../../../../C/Ppmd7Enc.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/Ppmd8.o ../../../../C/Ppmd8.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/Ppmd8Dec.o ../../../../C/Ppmd8Dec.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/Ppmd8Enc.o ../../../../C/Ppmd8Enc.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/Sort.o ../../../../C/Sort.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/Xz.o ../../../../C/Xz.c
cc      -O2 -c -Wno-maybe-uninitialized -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -o _o/XzDec.o ../../../../C/XzDec.c
../../../../C/XzDec.c: In function ‘XzBlock_Parse’:
../../../../C/XzDec.c:776:3: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
  776 |   if (s == 0) return SZ_ERROR_ARCHIVE; pos += s; }
      |   ^~
../../../../C/XzDec.c:823:5: note: in expansion of macro ‘READ_VARINT_AND_CHECK’
  823 |     READ_VARINT_AND_CHECK(header, pos, headerSize, &p->packSize);
      |     ^~~~~~~~~~~~~~~~~~~~~
../../../../C/XzDec.c:823:35: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  823 |     READ_VARINT_AND_CHECK(header, pos, headerSize, &p->packSize);
      |                                   ^~~
../../../../C/XzDec.c:776:40: note: in definition of macro ‘READ_VARINT_AND_CHECK’
  776 |   if (s == 0) return SZ_ERROR_ARCHIVE; pos += s; }
      |                                        ^~~
../../../../C/XzDec.c:776:3: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
  776 |   if (s == 0) return SZ_ERROR_ARCHIVE; pos += s; }
      |   ^~
../../../../C/XzDec.c:830:5: note: in expansion of macro ‘READ_VARINT_AND_CHECK’
  830 |     READ_VARINT_AND_CHECK(header, pos, headerSize, &p->unpackSize);
      |     ^~~~~~~~~~~~~~~~~~~~~
../../../../C/XzDec.c:830:35: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  830 |     READ_VARINT_AND_CHECK(header, pos, headerSize, &p->unpackSize);
      |                                   ^~~
../../../../C/XzDec.c:776:40: note: in definition of macro ‘READ_VARINT_AND_CHECK’
  776 |   if (s == 0) return SZ_ERROR_ARCHIVE; pos += s; }
      |                                        ^~~
../../../../C/XzDec.c:776:3: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
  776 |   if (s == 0) return SZ_ERROR_ARCHIVE; pos += s; }
      |   ^~
../../../../C/XzDec.c:837:5: note: in expansion of macro ‘READ_VARINT_AND_CHECK’
  837 |     READ_VARINT_AND_CHECK(header, pos, headerSize, &filter->id);
      |     ^~~~~~~~~~~~~~~~~~~~~
../../../../C/XzDec.c:837:35: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  837 |     READ_VARINT_AND_CHECK(header, pos, headerSize, &filter->id);
      |                                   ^~~
../../../../C/XzDec.c:776:40: note: in definition of macro ‘READ_VARINT_AND_CHECK’
  776 |   if (s == 0) return SZ_ERROR_ARCHIVE; pos += s; }
      |                                        ^~~
../../../../C/XzDec.c:776:3: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
  776 |   if (s == 0) return SZ_ERROR_ARCHIVE; pos += s; }
      |   ^~
../../../../C/XzDec.c:838:5: note: in expansion of macro ‘READ_VARINT_AND_CHECK’
  838 |     READ_VARINT_AND_CHECK(header, pos, headerSize, &size);
      |     ^~~~~~~~~~~~~~~~~~~~~
../../../../C/XzDec.c:838:35: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  838 |     READ_VARINT_AND_CHECK(header, pos, headerSize, &size);
      |                                   ^~~
../../../../C/XzDec.c:776:40: note: in definition of macro ‘READ_VARINT_AND_CHECK’
  776 |   if (s == 0) return SZ_ERROR_ARCHIVE; pos += s; }
      |                                        ^~~
cc1: all warnings being treated as errors
make: *** [../../7zip_gcc.mak:1155 : _o/XzDec.o] Erreur 1
teoberi commented 3 years ago

Resolved in the link below: https://sourceforge.net/p/sevenzip/discussion/45797/thread/9f5b067368/?page=2&limit=25#73a2

kramer04 commented 3 years ago

Thanks for your help So fixed issues but now have errors with cmake

$ cmake --version
cmake version 3.18.4

CMake suite maintained and supported by Kitware (kitware.com/cmake).
make -f makefile.gcc
CMake Error at /usr/share/cmake-3.18/Modules/CheckIncludeFile.cmake:55 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  /usr/share/cmake-3.18/Modules/FindThreads.cmake:142 (CHECK_INCLUDE_FILE)
  CMakeLists.txt:123 (find_package)

-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
CMake Error at lib/CMakeLists.txt:154 (configure_file):
  configure_file Problem configuring file

CMake Error at lib/CMakeLists.txt:175 (configure_file):
  configure_file Problem configuring file

CMake Error at /usr/share/cmake-3.18/Modules/WriteBasicConfigVersionFile.cmake:49 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  /usr/share/cmake-3.18/Modules/CMakePackageConfigHelpers.cmake:225 (write_basic_config_version_file)
  CMakeLists.txt:176 (write_basic_package_version_file)

CMake Error at CMakeLists.txt:187 (configure_file):
  configure_file Problem configuring file

-- Configuring incomplete, errors occurred!
teoberi commented 3 years ago

Maybe your cmake version is a little old. I have cmake-3.21.2 version installed. After solve the problem with cmake you can try this (with asmc binary copied in the path: /usr/local/bin): cd p7zip/CPP/7zip/Bundles/Alone2 && make -f ../../cmpl_gcc.mak Asmc binary link: https://github.com/nidud/asmc/raw/master/source/asmc/linux/bin/asmc Please note that the 7zip-21.02 Linux version is out of date. Igor Pavlov launched the 7-Zip 21.03 beta on 2021-07-20. jinfeihan57 hasn't updated their code yet.

kramer04 commented 3 years ago

After install cmake v3.21.2 and put asmc in /usr/local/bin launch

make -f ../../cmpl_gcc.mak

I've lot of -Werror=sign-conversion and these errors at the end.

cc1: all warnings being treated as errors
make: *** [../../7zip_gcc.mak:1177 : b/g/brotli-mt_compress.o] Erreur 1
../../../../C/zstdmt/lz4-mt_compress.c: At top level:
../../../../C/zstdmt/lz4-mt_compress.c:17: error: macro "LZ4F_DISABLE_OBSOLETE_ENUMS" is not used [-Werror=unused-macros]
   17 | #define LZ4F_DISABLE_OBSOLETE_ENUMS
      | 
cc1: all warnings being treated as errors
make: *** [../../7zip_gcc.mak:1171 : b/g/lz4-mt_compress.o] Erreur 1
../../../../C/zstdmt/lizard-mt_compress.c: At top level:
../../../../C/zstdmt/lizard-mt_compress.c:17: error: macro "LizardF_DISABLE_OBSOLETE_ENUMS" is not used [-Werror=unused-macros]
   17 | #define LizardF_DISABLE_OBSOLETE_ENUMS
      | 
cc1: all warnings being treated as errors
make: *** [../../7zip_gcc.mak:1183 : b/g/lizard-mt_compress.o] Erreur 1
cc1: all warnings being treated as errors
make: *** [../../7zip_gcc.mak:1179 : b/g/brotli-mt_decompress.o] Erreur 1
cc1: all warnings being treated as errors
make: *** [../../7zip_gcc.mak:1189 : b/g/lz5-mt_compress.o] Erreur 1
../../../../C/zstdmt/lizard-mt_decompress.c: At top level:
../../../../C/zstdmt/lizard-mt_decompress.c:17: error: macro "LizardF_DISABLE_OBSOLETE_ENUMS" is not used [-Werror=unused-macros]
   17 | #define LizardF_DISABLE_OBSOLETE_ENUMS
      | 
cc1: all warnings being treated as errors
make: *** [../../7zip_gcc.mak:1185 : b/g/lizard-mt_decompress.o] Erreur 1
cc1: all warnings being treated as errors
make: *** [../../7zip_gcc.mak:1191 : b/g/lz5-mt_decompress.o] Erreur 1
teoberi commented 3 years ago

Resolved in the link below: https://github.com/jinfeihan57/p7zip/issues/150#issuecomment-850384245 These errors are not related to Igor Pavlov's source code but to the code of the major modern codecs added by jinfeihan57.

kramer04 commented 3 years ago

Try with CFLAGS_BASE = -O2 $(CFLAGS_BASE_LIST) $(CFLAGS_WARN_WALL) $(CFLAGS_WARN) \ -Wno-sign-conversion -Wno-unused-macros -Wno-conversion -Wno-maybe-uninitialized -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \ -fPIC

and have these errors 2 times

The C compiler

    "/usr/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /media/duncan/Pgm/7-zip/p7zip-7zip_21.02/CPP/7zip/Bundles/Alone2/brotli_build/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_a3af1/fast && gmake[1] : on entre dans le répertoire « /media/duncan/Pgm/7-zip/p7zip-7zip_21.02/CPP/7zip/Bundles/Alone2/brotli_build/CMakeFiles/CMakeTmp »
    gmake[1]: Makefile : Aucun fichier ou dossier de ce type
    gmake[1]: *** Aucune règle pour fabriquer la cible « Makefile ». Arrêt.
    gmake[1] : on quitte le répertoire « /media/duncan/Pgm/7-zip/p7zip-7zip_21.02/CPP/7zip/Bundles/Alone2/brotli_build/CMakeFiles/CMakeTmp »
    
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:7 (project)

So i changed

CFLAGS_WARN_WALL = -Wno-maybe-uninitialized -Wall -Werror -Wextra

to

CFLAGS_WARN_WALL = -Wno-maybe-uninitialized -Wall -Wextra

and

make -f makefile.gcc

and

./_o/7zz i

is ok

But great question : how to install it to use 7zip 21.02 ?

teoberi commented 3 years ago

cp Alone2/_o/7zz /usr/bin 7zz i 7zz

kramer04 commented 3 years ago

Thanks a lot for your time Will test it I close this thread