windows和linux下源码编译7-Zip(7za)


如需转载请标明出处:http://blog.csdn.net/itas109
QQ技术交流群:129518033

文章目录

  • windows和linux下源码编译7-Zip(7za)
    • 前言
    • 1. windows下源码编译7-Zip
      • 1.1 windows编译7za.exe
      • 1.2 windows编译7z.dll
    • 2. linux下源码编译7-Zip
      • 2.1 linux编译7za
      • 2.2 linux编译7z.so
    • 3.常用命令
    • 4.其他

环境:

OS: windows 10
编译器:Visual Studio 2017
OS: Ubuntu 20.04
编译器:g++ 9.4.0

前言

7-Zip 是一款拥有极高压缩比的开源压缩软件。支持windows、linux、macOS。

7-Zip版本: 21.07(2021-12-26)

源码地址:https://www.7-zip.org/a/7z2107-src.tar.xz

1. windows下源码编译7-Zip

1.1 windows编译7za.exe

打开vs2017 64位命令行,进入目录

call "D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat" x64cd 7z2107-src\CPP\7zip\Bundles\Alone
  • 静态编译7za.exe
nmake NEW_COMPILER=1 MY_STATIC_LINK=1
  • 动态编译7za.exe
nmake NEW_COMPILER=1 MY_STATIC_LINK=0

1.2 windows编译7z.dll

打开vs2017 64位命令行行,进入目录

call "D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat" x64cd 7z2107-src\CPP\7zip\Bundles\Format7zF
  • 静态编译(静态链接msvcrt.dll)【推荐】
nmake NEW_COMPILER=1 MY_STATIC_LINK=1
  • 动态编译(动态链接msvcrt.dll)
nmake NEW_COMPILER=1 MY_STATIC_LINK=0

2. linux下源码编译7-Zip

2.1 linux编译7za

进入目录

mkdir 7z2107-src
tar xvJf 7z2107-src.tar.xz -C 7z2107-srccd 7z2107-src\CPP\7zip\Bundles\Alone
  • 静态编译7za(静态链接-static)【推荐】
    修改7z2107-src/CPP/7zip/7zip_gcc.mak文件的第45行的LDFLAGS_STATIC_2,由空赋值为-static
LDFLAGS_STATIC_2 = -static
# -static
# -static-libstdc++ -static-libgcc

静态编译

$ make -f makefile.gcc$ file 7za
7za: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=22269394e402fbccfb35017d21b3ffb9eb4994bf, for GNU/Linux 3.2.0, stripped
  • 动态编译7za
$ make -f makefile.gcc$ file 7za
7za: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=5e07e05837089b8efb2627ff9d67be881dda4c19, for GNU/Linux 3.2.0, stripped$ ldd 7za
linux-vdso.so.1 (0x00007ffd17262000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f5d5404b000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f5d53e69000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f5d53e4e000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5d53c5c000)
/lib64/ld-linux-x86-64.so.2 (0x00007f5d5421c000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f5d53b0d000)

2.2 linux编译7z.so

进入目录

cd 7z2107-src\CPP\7zip\Bundles\Format7zF

动态编译7z.so

$ make -f makefile.gcc$ file 7z.so
7z.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=5c66ae8bb982aae3c8c37f0eba0c91a30fe152ec, stripped
$ ldd 7z.so
linux-vdso.so.1 (0x00007fff24d4c000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9ec200f000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f9ec1e2d000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f9ec1e12000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9ec1c20000)
/lib64/ld-linux-x86-64.so.2 (0x00007f9ec22f2000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9ec1ad1000)

3.常用命令

7za详细命令

$ 7za -h7-Zip (a) 21.07 (x64) : Copyright (c) 1999-2021 Igor Pavlov : 2021-12-26Usage: 7za <command> [<switches>...] <archive_name> [<file_names>...] [@listfile]<Commands>a : Add files to archiveb : Benchmarkd : Delete files from archivee : Extract files from archive (without using directory names)h : Calculate hash values for filesi : Show information about supported formatsl : List contents of archivern : Rename files in archivet : Test integrity of archiveu : Update files to archivex : eXtract files with full paths<Switches>-- : Stop switches and @listfile parsing-ai[r[-|0]]{@listfile|!wildcard} : Include archives-ax[r[-|0]]{@listfile|!wildcard} : eXclude archives-ao{a|s|t|u} : set Overwrite mode-an : disable archive_name field-bb[0-3] : set output log level-bd : disable progress indicator-bs{o|e|p}{0|1|2} : set output stream for output/error/progress line-bt : show execution time statistics-i[r[-|0]]{@listfile|!wildcard} : Include filenames-m{Parameters} : set compression Method-mmt[N] : set number of CPU threads-mx[N] : set compression level: -mx1 (fastest) ... -mx9 (ultra)-o{Directory} : set Output directory-p{Password} : set Password-r[-|0] : Recurse subdirectories for name search-sa{a|e|s} : set Archive name mode-scc{UTF-8|WIN|DOS} : set charset for for console input/output-scs{UTF-8|UTF-16LE|UTF-16BE|WIN|DOS|{id}} : set charset for list files-scrc[CRC32|CRC64|SHA1|SHA256|*] : set hash function for x, e, h commands-sdel : delete files after compression-seml[.] : send archive by email-sfx[{name}] : Create SFX archive-si[{name}] : read data from stdin-slp : set Large Pages mode-slt : show technical information for l (List) command-snh : store hard links as links-snl : store symbolic links as links-sni : store NT security information-sns[-] : store NTFS alternate streams-so : write data to stdout-spd : disable wildcard matching for file names-spe : eliminate duplication of root folder for extract command-spf : use fully qualified file paths-ssc[-] : set sensitive case mode-sse : stop archive creating, if it can't open some input file-ssp : do not change Last Access Time of source files while archiving-ssw : compress shared files-stl : set archive timestamp from the most recently modified file-stm{HexMask} : set CPU thread affinity mask (hexadecimal number)-stx{Type} : exclude archive type-t{Type} : Set type of archive-u[-][p#][q#][r#][x#][y#][z#][!newArchiveName] : Update options-v{Size}[b|k|m|g] : Create volumes-w[{path}] : assign Work directory. Empty path means a temporary directory-x[r[-|0]]{@listfile|!wildcard} : eXclude filenames-y : assume Yes on all queries

4.其他

7z2107-src\DOC\readme.txt

    Alone         7za.exe: Standalone version of 7-Zip console that supports only 7z/xz/cab/zip/gzip/bzip2/tar.Alone2        7zz.exe: Standalone version of 7-Zip console that supports all formats.Alone7z       7zr.exe: Standalone version of 7-Zip console that supports only 7z (reduced version)Fm            Standalone version of 7-Zip File ManagerFormat7z            7za.dll:  .7z supportFormat7zExtract     7zxa.dll: .7z support, extracting onlyFormat7zR           7zr.dll:  .7z support, reduced versionFormat7zExtractR    7zxr.dll: .7z support, reduced version, extracting onlyFormat7zF           7z.dll:   all formatsLzmaCon       lzma.exe: LZMA compression/decompressionSFXCon        7zCon.sfx: Console 7z SFX moduleSFXWin        7z.sfx: Windows 7z SFX moduleSFXSetup      7zS.sfx: Windows 7z SFX module for Installers

License

License under CC BY-NC-ND 4.0: 署名-非商业使用-禁止演绎

如需转载请标明出处:http://blog.csdn.net/itas109
QQ技术交流群:129518033


Reference:
NULL

windows和linux下源码编译7-Zip(7za)相关推荐

  1. vc6可编译的 linux 源码,Linux 下源码编译FFMEG

    1. 安装依赖关系 $ sudo apt-get update $ sudo apt-get -y install autoconf automake build-essential libass-d ...

  2. Python 3.10版本及其依赖项 Linux下源码编译 安装到指定路径/目录

    Python 3.10版本及其依赖项 Linux下源码编译 安装到指定路径/目录 安装需求 准备工作 Python及其依赖项 libffi glibc GDBM mpdecimal bz2 xz re ...

  3. linux下源码编译升级ssh版本,ssh打补丁过程

    linux下源码编译升级ssh版本过程 记录打补丁之ssh源码编译升级过程 安装前软件准备 升级步骤 结尾及一些坑 记录打补丁之ssh源码编译升级过程 应安全报告要求需要修复操作系统中的ssh协议,原 ...

  4. linux下源码编译lrzsz

    linux下源码编译lrzsz 更新时间:2022-04-09(六) lrzsz github地址 lrzsz: free x/y/zmodem implementation 可找到下载链接 wget ...

  5. 【Python 笔记】Linux 下源码编译安装 python

    本文记录在 Linux 上源码编译安装 python 的过程. 文章目录 1. 源码编译安装说明 2. 安装 python2.7 3. 安装 python3.6 1. 源码编译安装说明 安装过程比我想 ...

  6. Linux 下源码编译安装 vim 8.1

    前言 目前 linux 的各个发行版基本上都是带了一个 vi 编辑器的,而本文要说的 vim 编辑器对 vi 做了一些优化升级,更好用.当我们需要远程操作一台 linux 服务器的时候,只能使用命令行 ...

  7. Linux下源码编译安装新版libxcb

    前言 上一篇文章提到,linux 下编译Qt源码如果要用到Quick的话,那么运行时会依赖qxcb库,而编译生成qxcb库就需要先安装libxcb,并且最低要求 版本大于1.9.1 Requires ...

  8. Linux下源码编译安装Python3

    操作系统:Centos 下载源码包 下载地址 https://www.python.org/downloads/release/python-365/ 解压 # tar -zxvf Python-3. ...

  9. Linux下源码编译安装Redis及如何后台启动Redis

    操作系统:Centos 下载源码包 http://download.redis.io/releases/redis-4.0.9.tar.gz 解压 # tar -zxvf redis-4.0.9.ta ...

最新文章

  1. 菜刀php木马_php网站安全防止各类一句话木马的攻击
  2. 通过反射获取类上的注解
  3. PAT甲级1037 Magic Coupon:[C++题解]贪心
  4. 【Python】青少年蓝桥杯_每日一题_12.19_输出三位数
  5. wxWidgets:wxSearchCtrl类用法
  6. java src 文件路径_java获取src下文件路径和获取webRoot下文件路径
  7. 飞畅科技-PoE交换机的常见问题解答
  8. 交换机多少钱一个?影响工业交换机价格的因素?
  9. 设置Android Studio工程布局文件的默认布局
  10. (相当全面)node.js 初体验
  11. 平均年薪30万的深度学习算法工程师,正面临100万的人才缺口
  12. intellij idea 代码错误设置 Error 提示颜色修改
  13. MythXinWCF通用宿主绿色版V1.2发布,及服务启动相关说明
  14. Mysql 对语句的长度有限制,默认是 4M
  15. 武汉工程大学计算机学院吴云韬,周华兵-武汉工程大学计算机科学与工程学院...
  16. JS JQUERY获取两个时间相差几个月
  17. geany配置html5,Geany的教程
  18. 程序设计-求解数独(C)
  19. 计算机图形处理的一些知识
  20. 微信公众平台修改服务器,微信公众平台开发配置及自定义分享

热门文章

  1. AVUE 富文本编辑器 avue-plugin-ueditor 格式刷功能 ver.0.2.7
  2. 《程序设计基础II》实验3——递推
  3. 凤凰新闻自动评论推荐软件--把自己的评论推荐到最前面,然后通过头像、用户名或者评论内容进行展示
  4. 通达信 c java,通达信的c
  5. ERNIE-Search: Bridging Cross-Encoder with Dual-Encoder via Self On-the-fly Distillation
  6. C#中DateTime.Ticks
  7. Makefile -fPIC 选项
  8. 微信聊天机器人搭建方式分享
  9. 2019美团机器学习/数据挖掘算法实习生笔试 编程题修改矩阵
  10. 启航——我的第一篇博客