Apr 17

直接编译会出错:

/opt/lib//libcrypto.a(c_zlib.o): In function zlib_stateful_expand_block': c_zlib.c:(.text+0x54): undefined reference toinflate'
/opt/lib//libcrypto.a(c_zlib.o): In function zlib_stateful_compress_block': c_zlib.c:(.text+0xd8): undefined reference todeflate'
/opt/lib//libcrypto.a(c_zlib.o): In function bio_zlib_free': c_zlib.c:(.text+0x128): undefined reference toinflateEnd'
c_zlib.c:(.text+0x144): undefined reference to deflateEnd' /opt/lib//libcrypto.a(c_zlib.o): In functionzlib_stateful_finish':
c_zlib.c:(.text+0x194): undefined reference to inflateEnd' c_zlib.c:(.text+0x19c): undefined reference todeflateEnd'
/opt/lib//libcrypto.a(c_zlib.o): In function zlib_stateful_init': c_zlib.c:(.text+0x224): undefined reference toinflateInit_'
c_zlib.c:(.text+0x26c): undefined reference to deflateInit_' /opt/lib//libcrypto.a(c_zlib.o): In functionbio_zlib_ctrl':
c_zlib.c:(.text+0x4a0): undefined reference to deflate' c_zlib.c:(.text+0x56c): undefined reference tozError'
/opt/lib//libcrypto.a(c_zlib.o): In function bio_zlib_write': c_zlib.c:(.text+0x708): undefined reference todeflate'
c_zlib.c:(.text+0x794): undefined reference to zError' c_zlib.c:(.text+0x824): undefined reference todeflateInit_'
/opt/lib//libcrypto.a(c_zlib.o): In function bio_zlib_read': c_zlib.c:(.text+0x900): undefined reference toinflate'
c_zlib.c:(.text+0x954): undefined reference to zError' c_zlib.c:(.text+0x9e0): undefined reference toinflateInit_'
collect2: error: ld returned 1 exit status
Makefile:94: recipe for target 'redsocks2' failed
make: *** [redsocks2] Error 1

解决方法,修改 Makefile:
override LIBS += -lssl -lcrypto -ldl

改成:
override LIBS += -lssl -lcrypto -ldl -lz

然后:
CCFLAGS=-static make

或者(tomatoware)
LDFLAGS="-Wl,-static -static -static-libgcc" make

编译成功。


Nov 07

一、下载源程序

git clone https://github.com/semigodking/redsocks.git

二、编译

cd redsocks-master
make

会出错:

parser.c: In function 'vp_in_addr':
parser.c:306: error: 'AI_ADDRCONFIG' undeclared (first use in this function)
parser.c:306: error: (Each undeclared identifier is reported only once
parser.c:306: error: for each function it appears in.)
make: *** [parser.o] Error 1

三、解决,在parser.c文件的第32行插入如下代码:

#ifndef AI_ADDRCONFIG
#define AI_ADDRCONFIG 0x0020
#endif