Qt5.5.0环境下的mingw编译dcmtk 3.6.1_20150924_浩瀚之水_csdn的博客-程序员信息网

技术标签: # Qt学习之路  

网上关于mingw编译dcmtk的文章太少,不方便查阅,期间遇到各种问题。特意将整个编译过程记录下来。为了保证所有编译出来的文件方便我在Qt5.5.0中使用,将所有的dcmtk依赖的外部库下载下来并进行编译。整个编译过程如下。注,除msys外,其余所有依赖库,均在此处下载:http://www.dcmtk.org/dcmtk.php.en,所有安装包,依赖库,均解压到d盘下;


Msys

ZLIB

版本:1.2.5 
新建文件夹libzlib,并将zlib解压后放置在libzlib文件夹中,同时,再在内部新建文件夹out,方便讲编译出来的文件提取安装到out中。(即源码路径为:d:/libzlib/zlib-1.2.5。输入文件路径为d:/libzlib/out) 
在zlib文件夹中打开命令行,输入:

copy win32\makefile.gcc makefile.gcc
mingw32-make -f makefile.gcc 

目前为止,暂未编译通过,每次生成dll都会失败,但因为不需要dll,只需要动态库,故暂时未管。将zonf.h提取到out中的include文件夹中,将libz.a放到out中的lib文件夹中。 
编译后的下载链接:http://download.csdn.net/detail/syz9011/9261495

LIBPNG

版本:1.4.3 
新建文件夹libpng,并将libpng-1.4.3解压后放置在libpng文件夹中,同时,再在内部新建文件夹out,方便讲编译出来的文件提取安装到out中.(即源码路径为:d:/libpng/libpng-1.4.3。输入文件路径为d:/libpng/out) 
打开scripts/makefile.gcc设置zlib路径:

ZLIBINC = d:/libzlib/out
ZLIBLIB = d:/libzlib/out

运行msys.bat,并cd到libpng-1.4.3路径中,输入如下:

./configure --prefix=d:/libpng/out
make
make install

编译后的下载链接:http://download.csdn.net/detail/syz9011/9261475

LIBJPEG

因编译LIBTIFF需要依赖于LIBJPG,故需要编译此库 
下载地址:http://www.ijg.org/files/jpegsr9a.zip 
路径放置同上: 
即源码路径为:d:/libjpeg/jpeg-9a。输入文件路径为d:/libjpeg/out

运行msys.bat,并cd到jpeg-9a路径中,输入如下:

./configure --prefix=d:/libpng/out

打开jconfig.h,增加以下定义:

#define HAVE_PROTOTYPES 1

保存,然后继续在msys.bat中输入如下:

make
make install

编译后的下载链接:http://download.csdn.net/detail/syz9011/9247035

LIBTIFF

路径放置同上: 
即源码路径为:d:/libtiff/tiff-3.9.4。输入文件路径为d:/libtiff/out 
运行msys.bat,并cd到tiff-3.9.4路径中,输入如下:

./configure --with-zlib-include-dir=d:/libzlib/out --with-zlib-lib-dir=d:/libzlib/out --with-jpeg-include-dir=d:/libjpeg/out/include --with-jpeg-lib-dir=d:/libjpeg/out/lib --prefix=d:/libtiff/out
make
make install

注意,编译完成后,需要将libjpeg中的libjpeg.dll.a拷贝到libtiff的out的lib文件夹下,否则dcmtk编译会出错。 
编译后的下载链接:http://download.csdn.net/detail/syz9011/9261485

LIBICONV

路径放置同上: 
即源码路径为:d:/libiconv/libiconv-1.13.1。输入文件路径为d:/libiconv/out 
运行msys.bat,并cd到libiconv-1.13.1路径中,输入如下:

./configure --prefix=d:/libiconv/out
make 
make install

编译后的下载链接:http://download.csdn.net/detail/syz9011/9247017

openssl

路径放置同上: 
即源码路径为:d:/libopenssl/openssl-1.0.0c。输入文件路径为d:/libopenssl/out

此时,进入到d:/libopenssl/openssl-1.0.0c/test文件夹下,打开md2test.c,将内容从 dummytest.c 改为 #include “dummytest.c”,同样的还有rc5test.c以及jpaketest.c 
运行msys.bat,并cd到openssl-1.0.0c路径中,输入如下:

./config shared --prefix=d:/libopenssl/out
make depend
make
make test
make install

编译后的下载链接:http://download.csdn.net/detail/syz9011/9261499

LIBXML

路径放置同上: 
即源码路径为:d:/libxml/libxml2-2.7.7。输入文件路径为d:/libxml/out 
运行msys.bat,并cd到libxml2-2.7.7路径中,输入如下:

./configure --prefix=d:/libxml/out 
make
make install
  • 1
  • 2
  • 3

注意,编译完成之后,需要到out路径下,打开include文件夹,并将libxml2文件夹内的libxml文件夹拷贝到include文件夹下面,否则之后编译DCMTK时,会出现找不到libxml头文件的情况。另外,将libiconv中编译出来的.dll.a文件拷贝到libxml中的out中的lib文件夹下

ps:mingw4.8版本make过程中会报错,undefined reference _imp__xmlfree。mingw4.9.2不会

编译后的下载链接:http://download.csdn.net/detail/syz9011/9261491

DCMTK

路径放置同上: 
即源码路径为:d:/dcmtk/dcmtk-3.6.1_20150924。输入文件路径为d:/dcmtk/out。编译输出路径为d:/dcmtk/gcc. 
打开源码路径下CMake文件夹下的3rdparty.cmake,并做如下更改:

# libxml support: configure compiler
  IF(DCMTK_WITH_XML)
    IF(WITH_LIBXMLINC)
      SET(LIBXML_INCDIR ${WITH_LIBXMLINC}/include)
      SET(LIBXML_LIBDIR ${WITH_LIBXMLINC}/lib)
      IF(MINGW)
            SET(LIBXML_LIBS debug ${LIBXML_LIBDIR}/libxml2.a optimized ${LIBXML_LIBDIR}/libxml2.a debug ${LIBXML_LIBDIR}/libiconv.dll.a optimized ${LIBXML_LIBDIR}/libiconv.dll.a debug ${LIBXML_LIBDIR}/libxml2.dll.a optimized ${LIBXML_LIBDIR}/libxml2.dll.a debug ${LIBXML_LIBDIR}/libcharset.a optimized ${LIBXML_LIBDIR}/libcharset.a)
            ELSE(MINGW)
      SET(LIBXML_LIBS debug ${LIBXML_LIBDIR}/libxml2_d.lib optimized ${LIBXML_LIBDIR}/libxml2_o.lib debug ${LIBXML_LIBDIR}/iconv_d.lib optimized ${LIBXML_LIBDIR}/iconv_o.lib)
      MESSAGE(STATUS "Info: DCMTK XML support will be enabled")
      ENDIF(MINGW)
      SET(WITH_LIBXML 1)
    ELSE(WITH_LIBXMLINC) # turn off library if library path not set
      MESSAGE(STATUS "Warning: XML support will be disabled because libxml2 directory is not specified. Correct path and re-enable DCMTK_WITH_XML.")
      SET(DCMTK_WITH_XML OFF CACHE BOOL "" FORCE)
      SET(WITH_LIBXML "")
    ENDIF(WITH_LIBXMLINC)
  ENDIF(DCMTK_WITH_XML)

  # libpng support: configure compiler
  IF(DCMTK_WITH_PNG)
    IF(WITH_LIBPNGINC)
      SET(LIBPNG_INCDIR ${WITH_LIBPNGINC}/include)
      SET(LIBPNG_LIBDIR ${WITH_LIBPNGINC}/lib)
      IF(MINGW)
      SET(LIBPNG_LIBS debug ${LIBPNG_LIBDIR}/libpng.a optimized ${LIBPNG_LIBDIR}/libpng.a)
      ELSE(MINGW)
      SET(LIBPNG_LIBS debug ${LIBPNG_LIBDIR}/libpng_d.lib optimized ${LIBPNG_LIBDIR}/libpng_o.lib)
      ENDIF(MINGW)
      MESSAGE(STATUS "Info: DCMTK PNG support will be enabled")
      SET(WITH_LIBPNG 1)
    ELSE(WITH_LIBPNGINC) # turn off library if library path not set
      MESSAGE(STATUS "Warning: PNG support will be disabled because libpng directory was not specified. Correct path and re-enable DCMTK_WITH_PNG.")
      SET(DCMTK_WITH_PNG OFF CACHE BOOL "" FORCE)
      SET(WITH_LIBPNG "")
    ENDIF(WITH_LIBPNGINC)
  ENDIF(DCMTK_WITH_PNG)

  # libtiff support: configure compiler
  IF(DCMTK_WITH_TIFF)
    IF(WITH_LIBTIFFINC)
      SET(LIBTIFF_INCDIR ${WITH_LIBTIFFINC}/include)
      SET(LIBTIFF_LIBDIR ${WITH_LIBTIFFINC}/lib)
      IF(MINGW)
      SET(LIBTIFF_LIBS debug ${LIBTIFF_LIBDIR}/libtiff.a optimized ${LIBTIFF_LIBDIR}/libtiff.a debug ${LIBTIFF_LIBDIR}/libjpeg.a optimized ${LIBTIFF_LIBDIR}/libjpeg.a debug ${LIBTIFF_LIBDIR}/libjpeg.dll.a optimized ${LIBTIFF_LIBDIR}/libjpeg.dll.a)
      ELSE(MINGW)
      SET(LIBTIFF_LIBS debug ${LIBTIFF_LIBDIR}/libtiff_d.lib optimized ${LIBTIFF_LIBDIR}/libtiff_o.lib)
      ENDIF(MINGW)
      MESSAGE(STATUS "Info: DCMTK TIFF support will be enabled")
      SET(WITH_LIBTIFF 1)
    ELSE(WITH_LIBTIFFINC) # turn off library if library path not set
      MESSAGE(STATUS "Warning: TIFF support will be disabled because libtiff directory was not specified. Correct path and re-enable DCMTK_WITH_TIFF.")
      SET(DCMTK_WITH_TIFF OFF CACHE BOOL "" FORCE)
      SET(WITH_LIBTIFF "")
    ENDIF(WITH_LIBTIFFINC)
  ENDIF(DCMTK_WITH_TIFF)

  # OpenSSL support: configure compiler
  IF(DCMTK_WITH_OPENSSL)
    IF(WITH_OPENSSLINC)
      SET(OPENSSL_BINDIR ${WITH_OPENSSLINC}/bin)
      SET(OPENSSL_INCDIR ${WITH_OPENSSLINC}/include)
      SET(OPENSSL_LIBDIR ${WITH_OPENSSLINC}/lib)
      IF(MINGW)
      SET(OPENSSL_LIBS debug ${OPENSSL_LIBDIR}/libcrypto.dll.a optimized ${OPENSSL_LIBDIR}/libcrypto.dll.a debug ${OPENSSL_LIBDIR}/libssl.dll.a optimized ${OPENSSL_LIBDIR}/libssl.dll.a)
      ELSE(MINGW)
      SET(OPENSSL_LIBS debug ${OPENSSL_LIBDIR}/dcmtkssl_d.lib optimized ${OPENSSL_LIBDIR}/dcmtkssl_o.lib debug ${OPENSSL_LIBDIR}/dcmtkeay_d.lib optimized ${OPENSSL_LIBDIR}/dcmtkeay_o.lib)
      ENDIF(MINGW)
      MESSAGE(STATUS "Info: DCMTK OPENSSL support will be enabled")
      SET(WITH_OPENSSL 1)
    ELSE(WITH_OPENSSLINC) # turn off library if library path not set
      MESSAGE(STATUS "Warning: OPENSSL support will be disabled because openssl directory was not specified. Correct path and re-enable DCMTK_WITH_OPENSSL.")
      SET(DCMTK_WITH_OPENSSL OFF CACHE BOOL "" FORCE)
      SET(WITH_OPENSSL "")
    ENDIF(WITH_OPENSSLINC)
  ENDIF(DCMTK_WITH_OPENSSL)

  # zlib support: configure compiler
  IF(DCMTK_WITH_ZLIB)
    IF(WITH_ZLIBINC)
      SET(ZLIB_INCDIR ${WITH_ZLIBINC}/include)
      SET(ZLIB_LIBDIR ${WITH_ZLIBINC}/lib)
      IF(MINGW)
      SET(ZLIB_LIBS debug ${ZLIB_LIBDIR}/zlib.a optimized ${ZLIB_LIBDIR}/zlib.a)
      ELSE(MINGW)
      SET(ZLIB_LIBS debug ${ZLIB_LIBDIR}/zlib_d.lib optimized ${ZLIB_LIBDIR}/zlib_o.lib)
      ENDIF(MINGW)
      MESSAGE(STATUS "Info: DCMTK ZLIB support will be enabled")
      SET(WITH_ZLIB 1)
    ELSE(WITH_ZLIBINC) # turn off library if library path not set
      MESSAGE(STATUS "Warning: ZLIB support will be disabled because zlib directory was not specified. Correct path and re-enable DCMTK_WITH_ZLIB.")
      SET(DCMTK_WITH_ZLIB OFF CACHE BOOL "" FORCE)
      SET(WITH_ZLIB "")
    ENDIF(WITH_ZLIBINC)
  ENDIF(DCMTK_WITH_ZLIB)

  # sndfile support: configure compiler
  IF(DCMTK_WITH_SNDFILE)
    IF(WITH_SNDFILEINC)
      SET(SNDFILE_INCDIR ${WITH_SNDFILEINC}/include)
      SET(SNDFILE_LIBDIR ${WITH_SNDFILEINC}/lib)
      IF(MINGW)
      SET(SNDFILE_LIBS debug ${SNDFILE_LIBDIR}/libsndfile.a optimized ${SNDFILE_LIBDIR}/libsndfile.a)
      ELSE(MINGW)
      SET(SNDFILE_LIBS debug ${SNDFILE_LIBDIR}/libsndfile_d.lib optimized ${SNDFILE_LIBDIR}/libsndfile_o.lib)
      ENDIF(MINGW)
      MESSAGE(STATUS "Info: DCMTK SNDFILE support will be enabled")
      SET(WITH_SNDFILE 1)
    ELSE(WITH_SNDFILEINC) # turn off library if library path not set
      MESSAGE(STATUS "Warning: SNDFILE support will be disabled because libsndfile directory was not specified. Correct path and re-enable DCMTK_WITH_SNDFILE.")
      SET(DCMTK_WITH_SNDFILE OFF CACHE BOOL "" FORCE)
      SET(WITH_SNDFILE "")
    ENDIF(WITH_SNDFILEINC)
  ENDIF(DCMTK_WITH_SNDFILE)

  # libiconv support: configure compiler
  IF(DCMTK_WITH_ICONV)
    IF(WITH_LIBICONVINC)
      SET(LIBICONV_INCDIR ${WITH_LIBICONVINC}/include)
      SET(LIBICONV_LIBDIR ${WITH_LIBICONVINC}/lib)
      IF(MINGW)
      SET(LIBICONV_LIBS debug ${LIBICONV_LIBDIR}/libiconv.dll.a optimized ${LIBICONV_LIBDIR}/libiconv.dll.a debug ${LIBICONV_LIBDIR}/libcharset.a optimized ${LIBICONV_LIBDIR}/libcharset.dll.a)
      ELSE(MINGW)
      SET(LIBICONV_LIBS debug ${LIBICONV_LIBDIR}/libiconv.dll.a optimized ${LIBICONV_LIBDIR}/libiconv_o.lib)
      ENDIF(MINGW)
      MESSAGE(STATUS "Info: DCMTK ICONV support will be enabled")
      SET(WITH_LIBICONV 1)
    ELSE(WITH_LIBICONVINC) # turn off library if library path not set
      MESSAGE(STATUS "Warning: ICONV support will be disabled because libiconv directory was not specified. Correct path and re-enable DCMTK_WITH_ICONV.")
      SET(DCMTK_WITH_ICONV OFF CACHE BOOL "" FORCE)
      SET(WITH_LIBICONV "")
    ENDIF(WITH_LIBICONVINC)
  ENDIF(DCMTK_WITH_ICONV)

ELSE(WIN32)

打开CMake工具,并设置好源代码路径以及编译临时路径。点击Configure,出现红色界面,将所有路径配置好之后,点击Generate。界面截图如下:(注意,因我的电脑只有C盘,所有,我所有的路径都在c:/vs下) 
cmake截图
运行msys.bat,并cd到gcc路径中,输入如下:

make
make install

csdn下载资源: 
编译之后的包:http://download.csdn.net/detail/syz9011/9246233

参考资料: 
http://www.gaia-gis.it/gaia-sins/mingw_how_to.html

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/a8039974/article/details/108320507

智能推荐

迈信ep100交流伺服 含原理图、PCB图、C源代码等生产资 料。_「已注销」的博客-程序员信息网

迈信ep100交流伺服 含原理图、PCB图、C源代码等生产资 料。1、这款产品的方案采用的是stm32系列单片机。2、原理图和Pcb采用AD绘制。

随机过程及其在金融领域中的应用 第二章 习题 及 答案_SpikeKing的博客-程序员信息网

随机过程及其在金融领域中的应用 第二章 习题 第一题第二题第三题

java 定时调用存储过程_用Kettle实现自动定时调用存储过程部署到Windows服务_航知道的博客-程序员信息网

1、首先需要用到的一些开发工具:JDK(我用的1.7)MyEclipse 2014JavaServiceJavaService可在官网下载,下载地址:http://javaservice.objectweb.org,下载之前官方需要确认你的一些个人信息,提交后可以进入资源下载页面,我这里下载的是2.0.10版本。解压后有很多文件,我们只需要用到其中的JavaService.exe。2、接着编写一个...

2018年东北农业大学春季校赛 L-wyh的天鹅_gdut_yy的博客-程序员信息网

2018年东北农业大学春季校赛 L-wyh的天鹅链接:https://www.nowcoder.com/acm/contest/93/L来源:牛客网题目描述你们wyh学长小时候住在河边,因为周围的生态环境非常好,所以经常会有天鹅浮在湖面上,每只天鹅都长得不一样,它们偶尔排成一排,偶尔分散开,偶尔也会去其他河畔,wyh学长为了统计它们的个数,编了一个程序赋予它们一个“萌”值,但是这些...

语音识别会议级别_yang_daxia的博客-程序员信息网_ispa 是什么等级的会议

人工智能的会议没有专注于语音领域的,语音算是ai的一个实际应用方向吧,所以也能投ai的会议和期刊  列一下自然语言处理(NLP)这个小方向的: 会议(C): EMNLP (Empirical Methods in Natural Language Processing)              AEACL (Annual Conference of the European...

随便推点

blat命令行发邮件小工具_weixin_33885253的博客-程序员信息网

获取程序:http://www.blat.net/https://sourceforge.net/projects/blat/files/配置Blat的SMTP服务器:blat -install sever usr try port [profile]163邮箱举例:blat -install smtp.163.com [email protected]

数字IC设计学习笔记_静态时序分析STA_ PrimeTime 基本概述_GloriaHuo的博客-程序员信息网_primetime介绍

数字IC设计学习笔记PrimeTime 基本概述1. PrimeTime 基本概述2. 运行模式1. PrimeTime 基本概述PrimeTime,Synopsys公司提出的,针对于复杂的,全芯片的,门级静态时序分析的工具。可集成在逻辑综合和物理综合的整个流程,让设计者去分析,解决复杂的时序问题。PT在各个阶段对应的时序延迟文件都不相同。越向后阶段,对应的静态时序分析的模型越准确PT主要是在库文件和时序模型的基础上,搭配指定命令约束的脚本文件(Tcl),对设计进行静态时序分析。库文件

什么是4G_uuiso的博客-程序员信息网

     什么是4G网络,到底有多快?          

肆拾陆- Tableau Dashboard Extension 的绝望之旅 (一)_BerryBC的博客-程序员信息网

大数据时代你要如何选择?自己从头造个轮子还是用 Tableau?

android adb push 与 adb install的比较(两种安装APK的方法)_xuxinshao的博客-程序员信息网_push到手机里的apk怎么安装

一般的,Androd 应用程序有两种安装方法:1. 将应用程序的apk文件push到手机中,用如下命令:adb push xxxx.apk /system/app.2. 用adb install xxxx.apk进行安装3. 二者的比较以及注意事项:1) 用第一种方式的弊端:a.   会将原来系统中的对应的apk覆盖掉,所以,最好先备份出来一份,用如下命令:adb pu

HDU1016-经典DFS_刘荣浩的博客-程序员信息网

Prime Ring ProblemTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 39891 Accepted Submission(s): 17589Problem Description A ring is compose

推荐文章

热门文章

相关标签