发布于2015的文章

May 10

其实就是注意 -ldl 放的位置,之前放在 LDFLAGS 最后老是提示 -lcrypto 错误(这样放,在路由器上编译好像没事~~ :evil: ):

make clean

LIBS="-ldl" LDFLAGS="-Wl,-static -static -static-libgcc" ./configure --host=arm-brcm-linux-uclibcgnueabi CC=arm-brcm-linux-uclibcgnueabi-gcc --with-openssl=/home/punk/arm_apps/libs/openssl

make -j`nproc`


Apr 18

出错提示为:

/opt/brcm-arm/bin/../libexec/gcc/arm-brcm-linux-uclibcgnueabi/4.5.3/cc1: error while loading shared libraries: libmpc.so.2: cannot open shared object file: No such file or directory

或者:

configure: error: C compiler cannot create executables

执行:

ldd /opt/brcm-arm/libexec/gcc/arm-brcm-linux-uclibcgnueabi/4.5.3/cc1

发现有库未找到:

linux-gate.so.1 => (0xf77bf000)
libmpc.so.2 => not found
libmpfr.so.4 => not found
libgmp.so.10 => not found
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf77aa000)
libelf.so.1 => /usr/lib/i386-linux-gnu/libelf.so.1 (0xf7792000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf75e3000)
/lib/ld-linux.so.2 (0xf77c0000)

解决方法,编译前执行:

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/brcm-arm/lib:/usr/local/lib:/usr/lib

再用上面的命令检查依赖库,结果没有依赖库未找到了:

linux-gate.so.1 => (0xf76f4000)
libmpc.so.2 => /opt/brcm-arm/lib/libmpc.so.2 (0xf76de000)
libmpfr.so.4 => /opt/brcm-arm/lib/libmpfr.so.4 (0xf768e000)
libgmp.so.10 => /opt/brcm-arm/lib/libgmp.so.10 (0xf7631000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf7620000)
libelf.so.1 => /usr/lib/i386-linux-gnu/libelf.so.1 (0xf7608000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf7459000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7412000)
/lib/ld-linux.so.2 (0xf76f5000)

编译也没问题了 :mrgreen:


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

编译成功。


[2/2]  < 1 2