liblzma库是xz utils的子集,这里先下载xz utils源码

新建xz_lib文件夹。解压xz utils源码,取出extra,lib,src三个文件夹,并放入xz_lib文件夹中。

再将config.h.in重命名为config.h,放入xz_lib文件夹中,并修改成下面这样:


#ifndef CONFIG_H
#define CONFIG_H/* Prefix for symbols exported by tuklib_*.c files */
#define TUKLIB_SYMBOL_PREFIX lzma_/* How many MiB of RAM to assume if the real amount cannot be determined. */
#define ASSUME_RAM 128/* Define to 1 if crc32 integrity check is enabled. */
#define HAVE_CHECK_CRC32 1/* Define to 1 if crc64 integrity check is enabled. */
//#define HAVE_CHECK_CRC64 0
#undef HAVE_CHECK_CRC64/* Define to 1 if sha256 integrity check is enabled. */
#define HAVE_CHECK_SHA256 1/* Define to 1 if any of HAVE_DECODER_foo have been defined. */
#define HAVE_DECODERS 1/* Define to 1 if arm decoder is enabled. */
#undef HAVE_DECODER_ARM/* Define to 1 if armthumb decoder is enabled. */
#undef HAVE_DECODER_ARMTHUMB/* Define to 1 if delta decoder is enabled. */
#define HAVE_DECODER_DELTA 1/* Define to 1 if ia64 decoder is enabled. */
#undef HAVE_DECODER_IA64/* Define to 1 if lzma1 decoder is enabled. */
#define HAVE_DECODER_LZMA1 1/* Define to 1 if lzma2 decoder is enabled. */
#define HAVE_DECODER_LZMA2 1/* Define to 1 if powerpc decoder is enabled. */
#undef HAVE_DECODER_POWERPC/* Define to 1 if sparc decoder is enabled. */
#undef HAVE_DECODER_SPARC/* Define to 1 if x86 decoder is enabled. */
#define HAVE_DECODER_X86 1/* Define to 1 if any of HAVE_ENCODER_foo have been defined. */
#define HAVE_ENCODERS 1/* Define to 1 if arm encoder is enabled. */
#undef HAVE_ENCODER_ARM/* Define to 1 if armthumb encoder is enabled. */
#undef HAVE_ENCODER_ARMTHUMB/* Define to 1 if delta encoder is enabled. */
#define HAVE_ENCODER_DELTA 1/* Define to 1 if ia64 encoder is enabled. */
#undef HAVE_ENCODER_IA64/* Define to 1 if lzma1 encoder is enabled. */
#define HAVE_ENCODER_LZMA1 1/* Define to 1 if lzma2 encoder is enabled. */
#define HAVE_ENCODER_LZMA2 1/* Define to 1 if powerpc encoder is enabled. */
#undef HAVE_ENCODER_POWERPC/* Define to 1 if sparc encoder is enabled. */
#undef HAVE_ENCODER_SPARC/* Define to 1 if x86 encoder is enabled. */
#define HAVE_ENCODER_X86 1/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1/* Define to 1 to enable bt2 match finder. */
#define HAVE_MF_BT2 1/* Define to 1 to enable bt3 match finder. */
#define HAVE_MF_BT3 1/* Define to 1 to enable bt4 match finder. */
#define HAVE_MF_BT4 1/* Define to 1 to enable hc3 match finder. */
#define HAVE_MF_HC3 1/* Define to 1 to enable hc4 match finder. */
#define HAVE_MF_HC4 1/* Define to 1 if stdbool.h conforms to C99. */
#define HAVE_STDBOOL_H 1/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1/* Define to 1 or 0, depending whether the compiler supports simple visibilitydeclarations. */
#define HAVE_VISIBILITY 0/* Define to 1 if the system has the type `_Bool'. */
#define HAVE__BOOL 1#ifdef _M_IX86
/* Define to 1 when using Windows 95 (and thus XP) compatible threads. Thisavoids use of features that were added in Windows Vista.This is used for 32-bit x86 builds for compatibility reasons since itmakes no measurable difference in performance compared to Vista threads. */
#define MYTHREAD_WIN95 1
#else
/* Define to 1 when using Windows Vista compatible threads. This uses featuresthat are not available on Windows XP. */
#define MYTHREAD_VISTA 1
#endif/* Define to 1 to disable debugging code. */
#define NDEBUG 1/* Define to the full name of this package. */
#define PACKAGE_NAME "XZ Utils"/* Define to the home page for this package. */
#define PACKAGE_URL "https://tukaani.org/xz/"#define PACKAGE_BUGREPORT "https://tukaani.org/xz/"/* The size of `size_t', as computed by sizeof. */
#ifdef _WIN64
#define SIZEOF_SIZE_T 8
#else
#define SIZEOF_SIZE_T 4
#endif/* Define to 1 if the number of available CPU cores can be detected withcpuset(2). */
#undef TUKLIB_CPUCORES_CPUSET/* Define to 1 if the number of available CPU cores can be detected withpstat_getdynamic(). */
#undef TUKLIB_CPUCORES_PSTAT_GETDYNAMIC/* Define to 1 if the number of available CPU cores can be detected withsched_getaffinity() */
#undef TUKLIB_CPUCORES_SCHED_GETAFFINITY/* Define to 1 if the number of available CPU cores can be detected withsysconf(_SC_NPROCESSORS_ONLN) or sysconf(_SC_NPROC_ONLN). */
#undef TUKLIB_CPUCORES_SYSCONF/* Define to 1 if the number of available CPU cores can be detected withsysctl(). */
#undef TUKLIB_CPUCORES_SYSCTL/* Define to 1 if the system supports fast unaligned access to 16-bit and32-bit integers. */
#undef TUKLIB_FAST_UNALIGNED_ACCESS/* Define to 1 if the amount of physical memory can be detected with_system_configuration.physmem. */
#undef TUKLIB_PHYSMEM_AIX/* Define to 1 if the amount of physical memory can be detected withgetinvent_r(). */
#undef TUKLIB_PHYSMEM_GETINVENT_R/* Define to 1 if the amount of physical memory can be detected withgetsysinfo(). */
#undef TUKLIB_PHYSMEM_GETSYSINFO/* Define to 1 if the amount of physical memory can be detected withpstat_getstatic(). */
#undef TUKLIB_PHYSMEM_PSTAT_GETSTATIC/* Define to 1 if the amount of physical memory can be detected withsysconf(_SC_PAGESIZE) and sysconf(_SC_PHYS_PAGES). */
#undef TUKLIB_PHYSMEM_SYSCONF/* Define to 1 if the amount of physical memory can be detected with sysctl().*/
#undef TUKLIB_PHYSMEM_SYSCTL/* Define to 1 if the amount of physical memory can be detected with Linuxsysinfo(). */
#undef TUKLIB_PHYSMEM_SYSINFO/* Define to 1 to use unsafe type punning, e.g. char *x = ...; *(int *)x =123; which violates strict aliasing rules and thus is undefined behaviorand might result in broken code. */
#undef TUKLIB_USE_UNSAFE_TYPE_PUNNING#endif

新建QT控制台工程,删除main.cpp,再将xz_lib文件夹放到工程目录中。

修改.pro为下面这样:

QT -= guiCONFIG += c++11 console
CONFIG -= app_bundle# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0SOURCES += \xz_lib/extra/scanlzma/scanlzma.c \xz_lib/lib/getopt.c \xz_lib/lib/getopt1.c \xz_lib/src/common/tuklib_cpucores.c \xz_lib/src/common/tuklib_exit.c \xz_lib/src/common/tuklib_mbstr_fw.c \xz_lib/src/common/tuklib_mbstr_width.c \xz_lib/src/common/tuklib_open_stdxxx.c \xz_lib/src/common/tuklib_physmem.c \xz_lib/src/common/tuklib_progname.c \xz_lib/src/liblzma/check/check.c \xz_lib/src/liblzma/check/crc32_fast.c \xz_lib/src/liblzma/check/crc32_small.c \xz_lib/src/liblzma/check/crc32_table.c \xz_lib/src/liblzma/check/crc64_fast.c \xz_lib/src/liblzma/check/crc64_small.c \xz_lib/src/liblzma/check/crc64_table.c \xz_lib/src/liblzma/check/sha256.c \xz_lib/src/liblzma/common/alone_decoder.c \xz_lib/src/liblzma/common/alone_encoder.c \xz_lib/src/liblzma/common/auto_decoder.c \xz_lib/src/liblzma/common/block_buffer_decoder.c \xz_lib/src/liblzma/common/block_buffer_encoder.c \xz_lib/src/liblzma/common/block_decoder.c \xz_lib/src/liblzma/common/block_encoder.c \xz_lib/src/liblzma/common/block_header_decoder.c \xz_lib/src/liblzma/common/block_header_encoder.c \xz_lib/src/liblzma/common/block_util.c \xz_lib/src/liblzma/common/common.c \xz_lib/src/liblzma/common/easy_buffer_encoder.c \xz_lib/src/liblzma/common/easy_decoder_memusage.c \xz_lib/src/liblzma/common/easy_encoder.c \xz_lib/src/liblzma/common/easy_encoder_memusage.c \xz_lib/src/liblzma/common/easy_preset.c \xz_lib/src/liblzma/common/filter_buffer_decoder.c \xz_lib/src/liblzma/common/filter_buffer_encoder.c \xz_lib/src/liblzma/common/filter_common.c \xz_lib/src/liblzma/common/filter_decoder.c \xz_lib/src/liblzma/common/filter_encoder.c \xz_lib/src/liblzma/common/filter_flags_decoder.c \xz_lib/src/liblzma/common/filter_flags_encoder.c \xz_lib/src/liblzma/common/index.c \xz_lib/src/liblzma/common/index_decoder.c \xz_lib/src/liblzma/common/index_encoder.c \xz_lib/src/liblzma/common/index_hash.c \xz_lib/src/liblzma/common/outqueue.c \xz_lib/src/liblzma/common/stream_buffer_decoder.c \xz_lib/src/liblzma/common/stream_buffer_encoder.c \xz_lib/src/liblzma/common/stream_decoder.c \xz_lib/src/liblzma/common/stream_encoder.c \xz_lib/src/liblzma/common/stream_encoder_mt.c \xz_lib/src/liblzma/common/stream_flags_common.c \xz_lib/src/liblzma/common/stream_flags_decoder.c \xz_lib/src/liblzma/common/stream_flags_encoder.c \xz_lib/src/liblzma/common/vli_decoder.c \xz_lib/src/liblzma/common/vli_encoder.c \xz_lib/src/liblzma/common/vli_size.c \xz_lib/src/liblzma/delta/delta_common.c \xz_lib/src/liblzma/delta/delta_decoder.c \xz_lib/src/liblzma/delta/delta_encoder.c \xz_lib/src/liblzma/lz/lz_decoder.c \xz_lib/src/liblzma/lz/lz_encoder.c \xz_lib/src/liblzma/lz/lz_encoder_mf.c \xz_lib/src/liblzma/lzma/fastpos_table.c \xz_lib/src/liblzma/lzma/lzma2_decoder.c \xz_lib/src/liblzma/lzma/lzma2_encoder.c \xz_lib/src/liblzma/lzma/lzma_decoder.c \xz_lib/src/liblzma/lzma/lzma_encoder.c \xz_lib/src/liblzma/lzma/lzma_encoder_optimum_fast.c \xz_lib/src/liblzma/lzma/lzma_encoder_optimum_normal.c \xz_lib/src/liblzma/lzma/lzma_encoder_presets.c \xz_lib/src/liblzma/rangecoder/price_table.c \xz_lib/src/liblzma/simple/simple_coder.c \xz_lib/src/liblzma/simple/simple_decoder.c \xz_lib/src/liblzma/simple/simple_encoder.c \xz_lib/src/liblzma/simple/x86.c \# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += targetHEADERS += \xz_lib/config.h \xz_lib/lib/getopt.h \xz_lib/lib/getopt_int.h \xz_lib/src/common/mythread.h \xz_lib/src/common/sysdefs.h \xz_lib/src/common/tuklib_common.h \xz_lib/src/common/tuklib_config.h \xz_lib/src/common/tuklib_cpucores.h \xz_lib/src/common/tuklib_exit.h \xz_lib/src/common/tuklib_gettext.h \xz_lib/src/common/tuklib_integer.h \xz_lib/src/common/tuklib_mbstr.h \xz_lib/src/common/tuklib_open_stdxxx.h \xz_lib/src/common/tuklib_physmem.h \xz_lib/src/common/tuklib_progname.h \xz_lib/src/liblzma/api/lzma.h \xz_lib/src/liblzma/check/check.h \xz_lib/src/liblzma/check/crc32_table_be.h \xz_lib/src/liblzma/check/crc32_table_le.h \xz_lib/src/liblzma/check/crc64_table_be.h \xz_lib/src/liblzma/check/crc64_table_le.h \xz_lib/src/liblzma/check/crc_macros.h \xz_lib/src/liblzma/common/alone_decoder.h \xz_lib/src/liblzma/common/block_buffer_encoder.h \xz_lib/src/liblzma/common/block_decoder.h \xz_lib/src/liblzma/common/block_encoder.h \xz_lib/src/liblzma/common/common.h \xz_lib/src/liblzma/common/easy_preset.h \xz_lib/src/liblzma/common/filter_common.h \xz_lib/src/liblzma/common/filter_decoder.h \xz_lib/src/liblzma/common/filter_encoder.h \xz_lib/src/liblzma/common/index.h \xz_lib/src/liblzma/common/index_encoder.h \xz_lib/src/liblzma/common/memcmplen.h \xz_lib/src/liblzma/common/outqueue.h \xz_lib/src/liblzma/common/stream_decoder.h \xz_lib/src/liblzma/common/stream_flags_common.h \xz_lib/src/liblzma/delta/delta_common.h \xz_lib/src/liblzma/delta/delta_decoder.h \xz_lib/src/liblzma/delta/delta_encoder.h \xz_lib/src/liblzma/delta/delta_private.h \xz_lib/src/liblzma/lz/lz_decoder.h \xz_lib/src/liblzma/lz/lz_encoder.h \xz_lib/src/liblzma/lz/lz_encoder_hash.h \xz_lib/src/liblzma/lz/lz_encoder_hash_table.h \xz_lib/src/liblzma/lzma/fastpos.h \xz_lib/src/liblzma/lzma/lzma2_decoder.h \xz_lib/src/liblzma/lzma/lzma2_encoder.h \xz_lib/src/liblzma/lzma/lzma_common.h \xz_lib/src/liblzma/lzma/lzma_decoder.h \xz_lib/src/liblzma/lzma/lzma_encoder.h \xz_lib/src/liblzma/lzma/lzma_encoder_private.h \xz_lib/src/liblzma/rangecoder/price.h \xz_lib/src/liblzma/rangecoder/range_common.h \xz_lib/src/liblzma/rangecoder/range_decoder.h \xz_lib/src/liblzma/rangecoder/range_encoder.h \xz_lib/src/liblzma/simple/simple_coder.h \xz_lib/src/liblzma/simple/simple_decoder.h \xz_lib/src/liblzma/simple/simple_encoder.h \xz_lib/src/liblzma/simple/simple_private.h \INCLUDEPATH += \
xz_lib \
xz_lib/lib \
xz_lib/src \
xz_lib/src/common \
xz_lib/src/liblzma \
xz_lib/src/liblzma/api \
xz_lib/src/liblzma/lzma \
xz_lib/src/liblzma/rangecoder \
xz_lib/src/liblzma/common \
xz_lib/src/liblzma/simple \
xz_lib/src/liblzma/lz \
xz_lib/src/liblzma/delta \
xz_lib/src/liblzma/check \

最终运行结果如下图所示:

其中main函数在extra\scanlzma文件夹中。

QT编译liblzma相关推荐

  1. Qt 编译一直死循环问题

    Qt 编译一直死循环问题 有时候Qt编译项目时, 一直编不过,查看一下编译窗口,发现一直在循环 输出如下: C:\soft\Qt5.11\5.11.1\mingw53_32\bin\qmake.exe ...

  2. LINUX系统环境下的QT编译安装

    一.软件下载 1.1 查询计算机架构及所装Linux发行版本,如下图所示: 1.2 " http://qt-project.org/downloads/ "下载Qt安装套件,如下图 ...

  3. ubuntu上建立mini2440 qt编译环境

    参考mini2440手册,从5.3章开始建立交叉编译环境.跟着流程走,在设置环境变量的时候,发现ubuntu的root文件夹不可进入,修改权限进入修改.bashrc文件发现重启后不起作用.为了不每次开 ...

  4. QT编译发布程序后报错如缺少dll、“应用程序无法正常启动(0xc000007b)”的可能解决方法

    QT编译发布程序后报错如缺少dll."应用程序无法正常启动(0xc000007b)"的可能解决方法 参考文章: (1)QT编译发布程序后报错如缺少dll."应用程序无法正 ...

  5. 解决在使用 Qt 编译项目时出现 “C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode格式以防止数据丢失“ 的警告

    解决在使用 Qt 编译项目时出现 "C4819: 该文件包含不能在当前代码页(936)中表示的字符.请将该文件保存为 Unicode格式以防止数据丢失" 的警告 警告出现的原因:编 ...

  6. 安装qtceator后无法启动help插件 Qt编译错误:cannot find -lGL 解决办法

    1. Qt编译错误:cannot find -lGL 在编译之前常见的一个小工程(在mac下创建的)的时候,出现lGL错误,我以为是不兼容,但又新建了一个项目,编译出错: cannot find -l ...

  7. 'qapplicationapp'在此作用域中尚未声明 linux,qt 编译问题总结

    1)使用make命令编译Qt原码时出现了 /usr/bin/ld: cannot find -lXrender 问题: /usr/bin/ld: cannot find -lXrender colle ...

  8. 解决CentOS遇到Qt编译(error: cannot find -lGL)

    笔者CentOS 6.5 64位,安装完成Qt5.5.1.随意新建一个Qt Widgets Application. 结果遇到Qt编译问题,提示信息如下: error: cannot find -lG ...

  9. Qt编译错误“GL/gl.h:No such file or directory”的解决方法

    Qt编译错误"GL/gl.h:No such file or directory"的解决方法 参考文章: (1)Qt编译错误"GL/gl.h:No such file o ...

最新文章

  1. 通俗易懂的ReentrantLock,不懂你来砍我
  2. python:dist-packages site-packages
  3. 《计算机视觉:模型、学习和推理》一3.6 正态逆伽马分布
  4. 一个女程序员的男友需求说明书(转)
  5. 汇编语言-016(SCASB 、STOSB 、LODSD 、数组中的取值、二维数组操作、冒泡排序和二分查找、CMPSW )
  6. git远程仓库上传及本地仓库创建
  7. svn redis和rabbitmq服务启动
  8. A饭福利,AMD Mantle API获众多游戏开发商青睐!
  9. LeetCode 416. 分割等和子集(动态规划)(0-1背包)
  10. Firebug 教程
  11. Java2048游戏源代码
  12. 3种常用的缓存读写策略
  13. 程序媛秋招心得及面试经验分享
  14. Layim 聊天功能
  15. 计算机与书法专业,临帖要像?计算机“算法”精确你的每一个像素!震惊书法圈!...
  16. 惠普服务器dl388g7光盘引导,hp dl388g7 无光驱怎么安装系统
  17. Linux下qt/C++全局键盘监控,处理键盘事件,输出按键码
  18. 华为20pro计算机在哪,华为mate20pro卡槽在哪
  19. Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook解决方法
  20. TypeScript 初级教程-姜威-专题视频课程

热门文章

  1. python报错之 AttributeError: ‘list‘ object has no attribute ‘replace‘
  2. STM32 FMC原理详解
  3. LOONGSON派二代 PMON编译
  4. semantic.css,CSS框架:Semantic UI的优缺点
  5. 模拟微信公众号回调请求
  6. SVM训练3D活体识别模型
  7. 使用susy内置混合宏异常:Undefined mixin ‘at-breakpoint‘
  8. Python项目实战:开发PetStore宠物商店项目-关东升-专题视频课程
  9. 黑科技!!你想要的它都有!!
  10. XML解析之xsi:nil=true