rikyoz / bit7z

A C++ static library offering a clean and simple interface to the 7-zip shared libraries.
https://rikyoz.github.io/bit7z
Mozilla Public License 2.0
623 stars 113 forks source link

[Feature Request]: 7zip v21.06 official binaries do not contain dynamic libraries to be linked on Linux and macOS. what now? #57

Open vladimir-kraus opened 2 years ago

vladimir-kraus commented 2 years ago

Feature description

Thank you again for working on this very interesting project. I do not know however if this my question is not out of scope. But if I understand well, the bit7z library links dynamically to 7z.dll, 7z.so or 7z.dylib, depending on the platform. But as I noticed in the official downloads for the latest version of 7Zip (21.06) https://www.7-zip.org/download.html the versions for Linux and macOS contain only single-file console-only executables but no dynamic libraries. So there is nothing to link to. How can this problem be solved? Does this require the user to build 7zip dynamic library on their own? If so, couldn't bit7z somehow simplify the process?

Kudos to you!

Additional context

No response

Code of Conduct

rikyoz commented 2 years ago

Hi!

Thank you again for working on this very interesting project.

Thank you for using it!

if I understand well, the bit7z library links dynamically to 7z.dll, 7z.so or 7z.dylib, depending on the platform.

Yeah, bit7z v4.0 will be able to link to either 7z.dll or 7z.so, according to the platform. I didn't test with 7z.dylib, though: on macOS, I did some tests with the 7z.so from p7zip, which works fine.

But as I noticed in the official downloads for the latest version of 7Zip (21.06) https://www.7-zip.org/download.html the versions for Linux and macOS contain only single-file console-only executables but no dynamic libraries. So there is nothing to link to. How can this problem be solved? Does this require the user to build 7zip dynamic library on their own?

Unfortunately, yes: at least for now, users must build the 7-zip dynamic libraries on their own.

Actually, building the 7z.so shared library is fairly simple on Linux:

cd $7ZIP_SRC/CPP/7zip/Bundles/Format7zF/
make -j -f ../../cmpl_gcc.mak

$7ZIP_SRC is the path to the folder containing the source code of 7-zip.

If so, couldn't bit7z somehow simplify the process?

Yeah, at least I could provide some documentation on how to build the libraries. I'm also considering creating a build script for automating and simplifying the build process. But, for now, it's not my main objective.

vladimir-kraus commented 2 years ago

Excellent! I am glad that this little obstacle does not prevent us from using bit7z. It seems to me that bit7z 4.0 has the potential to become the best archiving library ever. The power of 7Zip as backend and approachable API provided by bit7z, it is the perfect match! :)

rikyoz commented 2 years ago

Excellent! I am glad that this little obstacle does not prevent us from using bit7z. It seems to me that bit7z 4.0 has the potential to become the best archiving library ever. The power of 7Zip as backend and approachable API provided by bit7z, it is the perfect match! :)

I hope so! Thank you for appreciating and supporting the project! :pray:

LynxesExe commented 1 year ago

I'm also considering creating a build script for automating and simplifying the build process. But, for now, it's not my main objective.

I'm sure you already have a better solution in mind, however if someone is interested in automatically building and copying the 7zip.so artifact, I made this "quick n dirty" way of building it and copying to another location.

Unfortunately you still need to copy the final shared object in a user specified directory to then have the software load it, so I'm not sure how this could be implemented in a build script of bit7z... but as an end user I guess this could work somewhat fine?

Needless to say that this is a bad solution, during the CMake run time (not actual build of the software) it checks to see if a specific directory exists (the sources of 7zip itself), if it doesn't it copies it, builds it, and then copies the result 7z.so to another specified directory.

If you can cancel cmake mid build, you'll have to delete the entire dependency directory and let it re-copy and re-build everything, maybe checking if the resulting 7z.so file is a better idea.

Anyway, hope someone finds this useful.