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

How to configure bit7z? And some features that I would prefer to be added. #259

Open
Hu63Dovella opened this issue Nov 12, 2024 · 1 comment
Assignees
Labels

Comments

@Hu63Dovella
Copy link

I am new to external modules in C++, but I have no idea how to configure bit7z. I tried putting this file, bit7z-v4.0.8-gcc9.4.0_x64, to the same folder to the file that I am going to work with, along with 7z.dll and 7za.dll from 7z2408-extra.7z.

I make an attempt to make it run this code:

image

And when I try to compile it, it shows this:

image

For more information if you want:

Application for programming; Dev-C++ 5.11

Along with:

image

Folder that I am working on:

image

Which inside bit7z folder is all hpp.

Please assist me to get out of this problem so I can program it.

Feature Suggestion (Only for reading):

Implement multi-layered compressed files support. For example able to extract the .txt file in this situation: File.txt.xz.xz.xz or File.txt.xz.7z, etc without decompressing layer by layer. Better: A type of archive just like fstream which don't load up too much in memory and can be directly extracted or done for various things.

Able to read byte by byte (recommended an integer number of bytes) inside compressed files without decompressing to buffer or drive, and without memory overloading. (For example: the .dat.xz.xz is 2 MB, dat.xz is 2 GB and the .dat is 2 TB, and the memory must not be 2 GB just to load .dat.xz to to the buffer just to able to read byte by byte inside contents.)

If already implemented, explain how to do.

@rikyoz
Copy link
Owner

rikyoz commented Nov 12, 2024

Hi!

I am new to external modules in C++, but I have no idea how to configure bit7z. I tried putting this file, bit7z-v4.0.8-gcc9.4.0_x64, to the same folder to the file that I am going to work with, along with 7z.dll and 7za.dll from 7z2408-extra.7z.

And when I try to compile it, it shows this:

image

For more information if you want:

Application for programming; Dev-C++ 5.11

Please assist me to get out of this problem so I can program it.

I think there are a couple of problems with your project.

First of all, you're trying to use the precompiled binaries from bit7z-v4.0.8-gcc9.4.0_x64. These files are built for Unix systems, not Windows.

In theory, you could use the precompiled binaries from bit7z-v4.0.8-mingw8.1.0_x64, but you will probably have other problems because you are using the TDM-GCC 4.9.2 toolchain, which is very old and does not support linking to libraries built with newer versions of MinGW.
Also, you can't build bit7z itself with TDM-GCC 4.9.2 as it doesn't support all the C++11 features needed by the library.

In general, I would suggest using a more recent toolchain. As far as I know, you should be able to download a newer version of MinGW and replace the old TDM-GCC in the installation folder of Dev-C++.

Finally, from the error messages I think that your project doesn't actually link the bit7z library into the final executable, otherwise the errors would be different.
In practice, you should specify both the directory where the library file libbit7z64.a is located:

image

and that you want to link it with your executable:

image

Note that in the second screenshot each library is prefixed with a -l and that I didn't specify the lib prefix of the actual library file. I've also included both the oleaut32 and uuid libraries, as they are needed to make bit7z work on MinGW.

Implement multi-layered compressed files support. For example able to extract the .txt file in this situation: File.txt.xz.xz.xz or File.txt.xz.7z, etc without decompressing layer by layer.

Actually, I already implemented the multi-layered compressed files support on the develop branch, and it will be the major new feature in the next v4.1 release.

Better: A type of archive just like fstream which don't load up too much in memory and can be directly extracted or done for various things.

I'm not sure what you mean here, but it sound similar to what BitArchiveReader already does, though its interface is not similar to fstream.

Able to read byte by byte (recommended an integer number of bytes) inside compressed files without decompressing to buffer or drive, and without memory overloading. (For example: the .dat.xz.xz is 2 MB, dat.xz is 2 GB and the .dat is 2 TB, and the memory must not be 2 GB just to load .dat.xz to to the buffer just to able to read byte by byte inside contents.)

As far as I know, 7-Zip itself doesn't provide a way to read byte by byte, but provides a buffer of data which then needs to be handled (e.g. written to a file). But I'll have to check this.

In the next v4.1 there will be a BitArchiveReader::extractTo method that will allow you to "extract" to a callback function, i.e. it will pass the decompressed data and its size to a callback function and you can do whatever you want with that data.
This may be close to what you need.

@rikyoz rikyoz self-assigned this Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants