在上一篇转载的文件中说明了要安装pwntcha库的需要以下依赖:
1.1、安装imlib2-version.tar.gz
1.2、安装SDL-version.tar.gz
1.3、安装SDL_image-version.tar.gz
1.4、安装opencv-version.tar.gz
2、编译pwntcha
2.1、产生configure脚本和Makefile (cd trunk/ && ./bootstrap)
2.2、编译,安装 (./configure && make && make install)
在安装过程中出现了一些问题:
1.1安装出现:
gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../lib -I../../src/lib -I/usr/include/freetype2 -g -O2 -c imlib2_conv.c
/bin/bash ../../libtool --mode=link gcc -g -O2 -o imlib2_conv imlib2_conv.o ../../src/lib/libImlib2.la
mkdir .libs
gcc -g -O2 -o .libs/imlib2_conv imlib2_conv.o ../../src/lib/.libs/libImlib2.so
creating imlib2_conv
gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../lib -I../../src/lib -I/usr/include/freetype2 -g -O2 -c imlib2_show.c
/bin/bash ../../libtool --mode=link gcc -g -O2 -o imlib2_show imlib2_show.o ../../src/lib/libImlib2.la
gcc -g -O2 -o .libs/imlib2_show imlib2_show.o ../../src/lib/.libs/libImlib2.so
/usr/bin/ld: imlib2_show.o: undefined reference to symbol 'XNextEvent'
//usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [imlib2_show] Error 1
更改办法:
在/home/ubuntu/Downloads/captcha/imlib2-1.2.1.009/src/bin的makefile里查找CC:
把:
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in
改为:
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) $(my_libs) -o $@
DIST_COMMON = Makefile.am Makefile.in
然后再执行make,就没问题了
-------------------------------------------------------------------------------------------------------------------------------------------
1.2安装:
make出现如下错误:
root@ubuntu:/home/ubuntu/Downloads/captcha/SDL-1.2.15# make
/bin/bash ./libtool --mode=compile gcc -g -O2 -I./include -D_GNU_SOURCE=1 -fvisibility=hidden -D_REENTRANT -DXTHREADS -D_REENTRANT -DHAVE_LINUX_VERSION_H -Wall -c ./src/video/x11/SDL_x11dyn.c -o build/SDL_x11dyn.lo
libtool: compile: gcc -g -O2 -I./include -D_GNU_SOURCE=1 -fvisibility=hidden -D_REENTRANT -DXTHREADS -D_REENTRANT -DHAVE_LINUX_VERSION_H -Wall -c ./src/video/x11/SDL_x11dyn.c -fPIC -DPIC -o build/.libs/SDL_x11dyn.o
./src/video/x11/SDL_x11sym.h:168:17: error: conflicting types for ‘_XData32’
SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
^
./src/video/x11/SDL_x11dyn.c:95:5: note: in definition of macro ‘SDL_X11_SYM’
rc fn params { ret p##fn args ; }
^
In file included from ./src/video/x11/SDL_x11dyn.h:34:0,
from ./src/video/x11/SDL_x11dyn.c:26:
/usr/include/X11/Xlibint.h:568:12: note: previous declaration of ‘_XData32’ was here
extern int _XData32(
^
make: *** [build/SDL_x11dyn.lo] Error 1
更改办法:
这应该是SDL_X11_SYM宏里的第二个参数_XData32与/usr/include/X11/Xlibint.h里的函数声明(extern int _XData32)冲突了,把SDL_x11sym.h里的SDL_X11_SYM(int,_XData32.....)的第二个参数改一下:
SDL_X11_SYM(int,__XData32....)
可以编译通过了。
-----------------------------------------------------------------------------------------------------------------------
2、编译pwntcha
在编译pwntcha时出现如下错误:
#./bootstrap
./bootstrap: you need automake version 1.5 or later
更改办法:
修改bootstrap文件,把
for v in 11 10 9 8 7 6 5; do
改成
for v in 14 11 10 9 8 7 6 5; do
添加14的版本(这个要根据自己的版本信息来进行设置)
-------------------
#./configure
#make
出现如下错误:
gcc `imlib2-config --cflags` -DX_DISPLAY_MISSING=1 -Wall -O6 -g -O2 `imlib2-config --libs` -o pwntcha.exe pwntcha-main.o pwntcha-filter.o pwntcha-font.o pwntcha-image.o pwntcha-easter-eggs.o pwntcha-test.o authimage/libdecoder.a clubic/libdecoder.a java/libdecoder.a linuxfr/libdecoder.a livejournal/libdecoder.a lmt/libdecoder.a paypal/libdecoder.a phpbb/libdecoder.a scode/libdecoder.a slashdot/libdecoder.a ticketmaster/libdecoder.a tickets/libdecoder.a vbulletin/libdecoder.a xanga/libdecoder.a
pwntcha-image.o: In function `image_load':
/home/username/pwntcha/src/image.c:37: undefined reference to "imlib_load_image"
/home/username/pwntcha/src/image.c:63: undefined reference to "imlib_context_set_image"
/home/username/pwntcha/src/image.c:64: undefined reference to "imlib_image_get_width"
/home/username/pwntcha/src/image.c:65: undefined reference to "imlib_image_get_height"
/home/username/pwntcha/src/image.c:66: undefined reference to "imlib_image_get_width"
参考http://stackoverflow.com/questions/17433922/pwntcha-build-error-in-cygwin-undefined-reference-to-imlib-load-image
里面说:
gcc
resolves symbols in the order listed. You need to patch the build system to move `imlib2-config --libs`
to the very end of the link command.
根据以下的解决方法,修改./src目录下的makefile文件,更改如下:
查找imlib2-config --libs:
imaging_ldflags = `imlib2-config --libs`
查找imaging_ldflags :
pwntcha_LDFLAGS = $(imaging_ldflags)
查找pwntcha_LDFLAGS :
1.把
pwntcha_LINK = $(CCLD) $(pwntcha_CFLAGS) $(CFLAGS) $(pwntcha_LDFLAGS) \
$(LDFLAGS) -o $@
改成:
pwntcha_LINK = $(CCLD) $(pwntcha_CFLAGS) $(CFLAGS) \
$(LDFLAGS) -o $@
2.在
$(AM_V_CCLD)$(pwntcha_LINK) $(pwntcha_OBJECTS) $(pwntcha_LDADD) $(LIBS)
后添加
$(pwntcha_LDFLAGS)
这样就把`imlib2-config --libs`放到了gcc的最后面,然后编译通过。