sisong / HDiffPatch

a C\C++ library and command-line tools for Diff & Patch between binary files or directories(folder); cross-platform; runs fast; create small delta/differential; support large files and limit memory requires when diff & patch.
Other
1.52k stars 280 forks source link

LZMA dependency library support #347

Closed jackwenshann closed 1 year ago

jackwenshann commented 1 year ago

Hello, we have a project that requires cross compilation of the HDiffPatch library. However, through readme, we learned that Linux compilation has disabled the lzma option by default. May I ask if there is a problem with the code's dependency on lzma or what is the reason? Is there a problem with adding the lzma library to cross compilation? Can I not open it

sisong commented 1 year ago

ref README or CI

try (my auto release make script):

cd <ACodePath>
git clone https://github.com/sisong/HDiffPatch.git HDiffPatch
cd HDiffPatch
git clone --depth=1 https://github.com/sisong/libmd5.git ../libmd5
git clone --depth=1 https://github.com/sisong/lzma.git ../lzma
git clone --depth=1 https://github.com/sisong/zstd.git ../zstd
git clone --depth=1 https://github.com/sisong/zlib.git ../zlib
git clone --depth=1 https://github.com/sisong/bzip2.git ../bzip2
make ZLIB=1 BZIP2=1 MINS=1 STATIC_CPP=1 
jackwenshann commented 1 year ago

Hello, according to the script provided by you, I cannot pass the compilation on the Linux platform. The main reason is that errors are reported in the lzma library. I hope I can solve the problem. Thank you.

sisong commented 1 year ago

What compiler&version do you use?

jackwenshann commented 1 year ago

I'm using linux 20.04 and the compiler is g++ 9.4.0.

sisong commented 1 year ago

I test on Ubuntu20.04.1 + gcc9.4.0, it's make hdiffpatch+lzma ok!
see: https://github.com/sisong/HDiffPatch/actions/runs/5619684841/job/15227216775

you can try used my fixed branch: git clone -b fix-make-build https://github.com/sisong/lzma.git ../lzma

jackwenshann commented 1 year ago

How do we compile the test cases of this project by default? We look forward to your answer. Thank you.

sisong commented 1 year ago

"test cases" I'm not quite sure what this refers to.
ps: 可以用中文说明。

jackwenshann commented 1 year ago

你好,我想表达的是[HDiffPatch]master /test/ 目录下的测试用例有没有对应的Makefile进行编译,目前我们这边关闭Lzma后交叉编译已经ok了,需要跑一下对应的测试用例验证是否ok或者是否有其他的验证手段,谢谢

sisong commented 1 year ago

关于test目录下的正确性测试:

  1. 主要是 unit_test.cpp,它没有支持makefile,可以使用IDE:vc(windows) 或 xcode(macos) 或 code::blocks(linux) 打开builds目录下的相应项目文件进行编译。
    如果想用make来编译,可以尝试替换makefile中的hdiffz.cpp文件来编译。
  2. unit_test.cpp 测试了一些小型数据来测试验证;并且随机生成大量的old和new数据对,来进行diff和patch的正确性测试。
    代码中CompressPlugin??? 开头的那些宏参数打开时,会测试相应的补丁压缩和解压缩是否正确。
    当打开宏 _AttackPacth_ON 时,会随机修改补丁数据来攻击(Fuzzing)测试patch函数(会比较慢),来检查patch函数是否有漏洞。
  3. (可忽略)另外 hpatchz_test.cpp 对补丁合成进行了针对性测试
    先用hdiffz创建大量实例的补丁;然后将这些测试用例信息保存到文本文件;hpatchz_test.cpp 加载这些测试用例进行patch测试。
    变量is_attack控制是否进行攻击(Fuzzing)测试。
jackwenshann commented 1 year ago

好的,谢谢