Libarchive: how to compress an archive on windows?
Asked Answered
P

1

6

I am trying to create a compressed archive on windows with libarchive and at the moment it is not working. I can create zip or pax_restricted(tar) archives without compression, without any problems.

To add compression I've tried some combinations of the following:

archive_write_set_compression_lzip(lWriteArchive);
archive_write_add_filter_lzip(lWriteArchive);

archive_write_set_compression_gzip(lWriteArchive);
archive_write_add_filter_gzip(lWriteArchive);

archive_write_set_format_zip(lWriteArchive);
archive_write_set_format_pax_restricted(lWriteArchive);

I've mainly tried using lzip compression with the zip format and gzip compression with the pax_restricted format.

First I'm not sure whether I should use archive_write_set_compression_* or archive_write_add_filter_*.

When I try add lzip compression and I step into the function I see it returns ARCHIVE_FATAL with the error message "lzma compression not supported on this platform".

When I try to add gzip compression and I step into the function I see it returns ARCHIVE_WARN with the error message "Using external gzip program". If I let the process go on the resulting archive has a size of zero.

I get the feeling like on unix systems there are system libraries for lzma and gzip that libarchive uses for compression and that these are not available on windows.

I built libarchive using the latest stable release, following the the instructions to use CMake etc. I didn't notice any errors in the CMake configuration like I was missing lzma or gzip.

Thanks for any help.

Pinkston answered 26/8, 2016 at 20:12 Comment(1)
Did you ever fix this problem?Brokerage
D
0

I got ARCHIVE_WARN with error message "Using external gzip program" on an Ubuntu 22.04.3 LTS machine from a C++ program attempting to invoke libarchive-3.7.2. Solved it by manually building and installing libarchive-3.7.2 from sources. (The machine is locked down, so apt is not available). I suppose the program builds but fails because it is unable to load the archive library at run time.

Deuteranope answered 2/11, 2023 at 8:35 Comment(2)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Lovins
This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From ReviewJorgensen

© 2022 - 2024 — McMap. All rights reserved.