Android 如何编译静态gdbserver

Android 如何编译静态gdbserver,android,gdb,ld,gdbserver,Android,Gdb,Ld,Gdbserver,我对GDB的源代码做了一些修改,所以我想编译一个新的可执行文件。我已经成功地编译了一个新的GDB,但是当编译GDB服务器时,它失败了,我需要在Makefile中生成LDFLAGS=-static,因为Android没有一些库。失败消息如下所示: gcc -shared -fPIC -Wl,--no-undefined -g -O2 -I. -I. -I./../common -I./../regformats -I./.. -I./../../include -I./../gnulib/

我对GDB的源代码做了一些修改,所以我想编译一个新的可执行文件。我已经成功地编译了一个新的GDB,但是当编译GDB服务器时,它失败了,我需要在Makefile中生成
LDFLAGS=-static
,因为Android没有一些库。失败消息如下所示:

gcc -shared -fPIC -Wl,--no-undefined -g -O2     -I. -I. -I./../common -I./../regformats -I./.. -I./../../include -I./../gnulib/import -Ibuild-gnulib-gdbserver/import -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-char-subscripts -Wempty-body  -DGDBSERVER \
-static  -Wl,--dynamic-list=./proc-service.list -o libinproctrace.so ax-ipa.o tracepoint-ipa.o format-ipa.o utils-ipa.o regcache-ipa.o remote-utils-ipa.o common-utils-ipa.o tdesc-ipa.o print-utils-ipa.o rsp-low-ipa.o amd64-linux-ipa.o linux-amd64-ipa.o -ldl -pthread
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.6/crtbeginT.o: relocation R_X86_64_32 against `__DTOR_END__' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.6/crtbeginT.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [libinproctrace.so] Error 1
使用ld时失败,所以我想知道如何编译静态gdbserver

非常感谢

gcc-shared-fPIC-静态-o libinproctrace.so…

在这个命令中,您要求GCC将共享库
libinproctrace.so
-static
标志链接起来。GCC的答案:


所以不要那样做。相反,编辑
Makefile
并将您的
-static
专门添加到
gdbserver
的链接行中,而不是添加到命令行上的所有内容。

您是否尝试过按照错误消息的指示执行操作?也就是说,使用-fPIC标志重新编译。