Собрать статический бинарник для MIPS
Надо собрать transocks_ev статически для BL2348.
Поправил Makefile так
CC = mips-linux-gnu-gcc
LIBEVENT_DIR=/usr/mips-linux-gnu
LIBEVENT_STATIC_DIR=$(LIBEVENT_DIR)/lib
LIBEVENT_LIB_FILE=$(LIBEVENT_STATIC_DIR)/libevent.a
LIBC_FILE=$(LIBEVENT_STATIC_DIR)/libc.a
LIBRESOLV_FILE=$(LIBEVENT_STATIC_DIR)/libresolv.a
LIBPTHREAD_FILE=$(LIBEVENT_STATIC_DIR)/libpthread.a
LIBEVENT_INC_DIR=$(LIBEVENT_DIR)/include
CFLAGS = -g -O2 -DSOCKS -I$(LIBEVENT_INC_DIR)
OBJ = transocks_ev.o
all: transocks_ev
clean:
rm -f *.o transocks_ev
transocks_ev: $(OBJ)
$(CC) -o transocks_ev $(OBJ) \
-L$(LIBEVENT_STATIC_DIR) \
-static \
-Wl,-Bstatic \
-Wl,--rpath -Wl,$(LIBEVENT_STATIC_DIR) \
$(LIBEVENT_LIB_FILE) $(LIBC_FILE) $(LIBRESOLV_FILE) $(LIBPTHREAD_FILE)
.c.o:
$(CC) -c $(CFLAGS) $<
Собираю
$ make -j5
mips-linux-gnu-gcc -c -g -O2 -DSOCKS -I/usr/mips-linux-gnu/include transocks_ev.c
transocks_ev.c: In function ‘main’:
transocks_ev.c:927:51: warning: format ‘%s’ expects a matching ‘char *’ argument [-Wformat=]
fprintf (stderr, "can't open /dev/urandom: %s (%d). continuing, but will not randomize dns replies.\n");
~^
transocks_ev.c:927:55: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat=]
fprintf (stderr, "can't open /dev/urandom: %s (%d). continuing, but will not randomize dns replies.\n");
~^
mips-linux-gnu-gcc -o transocks_ev transocks_ev.o \
-L/usr/mips-linux-gnu/lib \
-static \
-Wl,-Bstatic \
-Wl,--rpath -Wl,/usr/mips-linux-gnu/lib \
/usr/mips-linux-gnu/lib/libevent.a /usr/mips-linux-gnu/lib/libc.a /usr/mips-linux-gnu/lib/libresolv.a /usr/mips-linux-gnu/lib/libpthread.a
/usr/mips-linux-gnu/lib/libevent.a(evutil.o): In function `test_for_getaddrinfo_hacks':
/home/homa/Документы/code/tranSOCKS_ev/libevent-2.1.12-stable/evutil.c:1300: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/mips-linux-gnu/lib/libevent.a(evutil.o): In function `evutil_unparse_protoname':
/home/homa/Документы/code/tranSOCKS_ev/libevent-2.1.12-stable/evutil.c:928: warning: Using 'getprotobynumber' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/mips-linux-gnu/lib/libevent.a(evutil.o): In function `evutil_parse_servname':
/home/homa/Документы/code/tranSOCKS_ev/libevent-2.1.12-stable/evutil.c:913: warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
$ readelf -Wd transocks_ev
В этом файле нет динамического раздела.
>./transocks_ev
Segmentation fault