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

libarchive can't build without lzma.h as of 3.5.0 #1461

Closed
vmchale opened this issue Dec 1, 2020 · 2 comments
Closed

libarchive can't build without lzma.h as of 3.5.0 #1461

vmchale opened this issue Dec 1, 2020 · 2 comments

Comments

@vmchale
Copy link

vmchale commented Dec 1, 2020

Here is the error:

libarchive/archive_read_support_format_zip.c: In function ‘zipx_lzma_uncompress_buffer’:
libarchive/archive_read_support_format_zip.c:956:2: error: unknown type name ‘lzma_stream’; did you mean ‘bz_stream’?
  lzma_stream stream = LZMA_STREAM_INIT;
  ^~~~~~~~~~~
  bz_stream
libarchive/archive_read_support_format_zip.c:956:23: error: ‘LZMA_STREAM_INIT’ undeclared (first use in this function); did you mean ‘BZ_STREAM_END’?
  lzma_stream stream = LZMA_STREAM_INIT;
                       ^~~~~~~~~~~~~~~~
                       BZ_STREAM_END
libarchive/archive_read_support_format_zip.c:956:23: note: each undeclared identifier is reported only once for each function it appears in
libarchive/archive_read_support_format_zip.c:957:2: error: unknown type name ‘lzma_ret’
  lzma_ret ret = lzma_alone_decoder(&stream, UINT64_MAX);
  ^~~~~~~~
libarchive/archive_read_support_format_zip.c:957:17: warning: implicit declaration of function ‘lzma_alone_decoder’ [-Wimplicit-function-declaration]
  lzma_ret ret = lzma_alone_decoder(&stream, UINT64_MAX);
                 ^~~~~~~~~~~~~~~~~~
libarchive/archive_read_support_format_zip.c:958:13: error: ‘LZMA_OK’ undeclared (first use in this function); did you mean ‘Z_OK’?
  if (ret == LZMA_OK)
             ^~~~~~~
             Z_OK
libarchive/archive_read_support_format_zip.c:960:9: error: request for member ‘next_in’ in something not a structure or union
   stream.next_in = lzma_alone_compressed_buffer;
         ^
libarchive/archive_read_support_format_zip.c:961:9: error: request for member ‘avail_in’ in something not a structure or union
   stream.avail_in = lzma_alone_buffer_size;
         ^
libarchive/archive_read_support_format_zip.c:962:9: error: request for member ‘total_in’ in something not a structure or union
   stream.total_in = 0;
         ^
libarchive/archive_read_support_format_zip.c:963:9: error: request for member ‘next_out’ in something not a structure or union
   stream.next_out = (unsigned char*)uncompressed_buffer;
         ^
libarchive/archive_read_support_format_zip.c:964:9: error: request for member ‘avail_out’ in something not a structure or union
   stream.avail_out = uncompressed_buffer_size;
         ^
libarchive/archive_read_support_format_zip.c:965:9: error: request for member ‘total_out’ in something not a structure or union
   stream.total_out = 0;
         ^
libarchive/archive_read_support_format_zip.c:966:9: warning: implicit declaration of function ‘lzma_code’ [-Wimplicit-function-declaration]
   ret = lzma_code(&stream, LZMA_RUN);
         ^~~~~~~~~
libarchive/archive_read_support_format_zip.c:966:28: error: ‘LZMA_RUN’ undeclared (first use in this function); did you mean ‘LZMA_OK’?
   ret = lzma_code(&stream, LZMA_RUN);
                            ^~~~~~~~
                            LZMA_OK
libarchive/archive_read_support_format_zip.c:967:32: error: ‘LZMA_STREAM_END’ undeclared (first use in this function); did you mean ‘LZMA_STREAM_INIT’?
   if (ret == LZMA_OK || ret == LZMA_STREAM_END)
                                ^~~~~~~~~~~~~~~
                                LZMA_STREAM_INIT
libarchive/archive_read_support_format_zip.c:970:2: warning: implicit declaration of function ‘lzma_end’; did you mean ‘va_end’? [-Wimplicit-function-declaration]
  lzma_end(&stream);
  ^~~~~~~~
  va_end
At top level:
libarchive/archive_read_support_format_zip.c:907:1: warning: ‘zipx_lzma_uncompress_buffer’ defined but not used [-Wunused-function]
 zipx_lzma_uncompress_buffer(const char *compressed_buffer,
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Makefile:6634: recipe for target 'libarchive/archive_read_support_format_zip.lo' failed
make[1]: *** [libarchive/archive_read_support_format_zip.lo] Error 1
make[1]: Leaving directory '/tmp/libarchive-3.5.0'
Makefile:3819: recipe for target 'all' failed
make: *** [all] Error 2

In my config.h:

/* Define to 1 if you have the <lzma.h> header file. */
/* #undef HAVE_LZMA_H */
@NiLuJe
Copy link
Contributor

NiLuJe commented Dec 1, 2020

This fixes it:

diff --git a/libarchive/archive_read_support_format_zip.c b/libarchive/archive_read_support_format_zip.c
index 81b8f863..a64332c2 100644
--- a/libarchive/archive_read_support_format_zip.c
+++ b/libarchive/archive_read_support_format_zip.c
@@ -899,6 +899,7 @@ process_extra(struct archive_read *a, struct archive_entry *entry,
        return ARCHIVE_OK;
 }
 
+#if HAVE_LZMA_H && HAVE_LIBLZMA
 /*
  * Auxiliary function to uncompress data chunk from zipx archive
  * (zip with lzma compression).
@@ -971,6 +972,7 @@ zipx_lzma_uncompress_buffer(const char *compressed_buffer,
        free(lzma_alone_compressed_buffer);
        return status;
 }
+#endif
 
 /*
  * Assumes file pointer is at beginning of local file header.

(Sidebar: title ought to say without ;)).

@vmchale
Copy link
Author

vmchale commented Dec 1, 2020

Thanks! May have to patch.

@vmchale vmchale changed the title libarchive can't build with lzma.h as of 3.5.0 libarchive can't build without lzma.h as of 3.5.0 Dec 1, 2020
erikolofsson pushed a commit to Malterlib/libarchive that referenced this issue Dec 19, 2020
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

2 participants