linux64下安装swftools
在文档转换器中,需要在linux上安装swftools,经历了一番曲折过程终于安装成功。swftools安装包从http://www.swftools.org/download.html上面下载。
在./configure过程中会提示需要依赖包freetype和jpegsrc,这两个依赖包可以从官网上下载,也可以从swftools上下载http://download.savannah.gnu.org/releases/freetype/和http://www.ijg.org/files/上下载。
- 安装freetype-2.5.3.tar.gz
tar -xzvf freetype-2.5.3.tar.gz
cd freetype-2.5.3
./configure
make
make install
- 安装jpegsrc.v9a.tar.gz
tar -xzvf jpegsrc.v9a.tar.gz
cd jpeg-9a
./configure
make
make install
- 安装swftools
解压并执行
tar -xzvf swftools-2013-04-09-1007.tar.gz
cd swftools-2013-04-09-1007
ldconfig /usr/local/lib提示错误ldconfig: /lib64/libz.so.1 is not a symbolic link, 解决方法是
cd /lib64/
ls -al看到libz.so.1不是一个连接而是一个文件
rm -rf libz.so.1
ln -s /lib64/libz.so.1.2.8 /lib64/libz.so.1继续执行
./configure --prefix=/usr/local/swftools
make在编译jpeg.c时出错,见图
源代码错误,提示swftools-2013-04-09-1007/lib/jpeg.c没有定义常量TRUE,检查并修改jpeg.c文件,添加以下内容
#include "types.h"屏蔽365行的typedef unsigned char U8后,重新编译swftools
另外几种错误
gif2swf.c: In function ‘MovieAddFrame’: gif2swf.c:233: error: too few arguments to function ‘DGifOpenFileName’ gif2swf.c:239: warning: implicit declaration of function ‘PrintGifError’ gif2swf.c:458: error: too few arguments to function ‘DGifCloseFile’ gif2swf.c: In function ‘CheckInputFile’: gif2swf.c:491: error: too few arguments to function ‘DGifOpenFileName’ gif2swf.c:521: error: too few arguments to function ‘DGifCloseFile’ make[1]: *** [gif2swf.o] Error 1 make[1]: Leaving directory `/home/pjroot/swftools-2013-04-09-1007/src' make: *** [all] Error 2错误原因:
由于giflib 5.1的DGifOpenFileName函数和DGifCloseFile函数参数签名发生变化,而gif2swf.c中调用仍然使用旧有版本导致参数不匹配
DGifOpenFileName变化
GifFileType *DGifOpenFileName(char *GifFileName)//old GifFileType *DGifOpenFileName(char *GifFileName, int *ErrorCode) //new
DGifCloseFile变化
int DGifCloseFile(GifFileType *GifFile) // old int DGifCloseFile(GifFileType *GifFile, int *ErrorCode) //new解决方法:
gif2swf.c 中几处做修改
233和491行
if ((gft = DGifOpenFileName(sname)) == NULL) {
改为
if ((gft = DGifOpenFileName(sname, 0)) == NULL) {
458和512行
DGifCloseFile(gft);改为 DGifCloseFile(gft, NULL);
making all in m4... cd m4;make all make[1]: Entering directory `/home/pjroot/swftools-2013-04-09-1007/m4' make[1]: Leaving directory `/home/pjroot/swftools-2013-04-09-1007/m4' making all in lib... cd lib;make all make[1]: Entering directory `/home/pjroot/swftools-2013-04-09-1007/lib' gcc -c -DHAVE_CONFIG_H -I/usr/local/swftools/include -I/usr/local/include/freetype2 -I/usr/local/include -fPIC -Wimplicit -Wreturn-type -Wno-write-strings -Wformat -O -fomit-frame-pointer rfxswf.c -o rfxswf.o In file included from ./bitio.h:23, from rfxswf.h:37, from rfxswf.c:28: ./types.h:39:2: error: #error "no way to define 64 bit integer" ./types.h:42:2: error: #error "don't know how to define 32 bit integer" ./types.h:45:2: error: #error "don't know how to define 16 bit integer" ./types.h:48:2: error: #error "don't know how to define 8 bit integer" make[1]: *** [rfxswf.o] Error 1 make[1]: Leaving directory `/home/pjroot/swftools-2013-04-09-1007/lib' make: *** [all] Error 2错误原因:
没有连接到库,执行以下命令
ldconfig /usr/local/lib再次重新configure并make安装
./configure --prefix=/usr/local/swftools
make
make install
make clean
make distclean
</pre></div></div><p></p><ul><li>测试是否安装正确</li></ul><p><pre name="code" class="plain">pdf2swf -s languagedir=/usr/local/share/xpdf/chinese-simplified -T 9 -s poly2bitmap -s zoom=150 -s flashversion=9 2.pdf -o 2.swf
wala-wo