开发者

Compiling libptrace

Trying to compile libptrace (http:开发者_Go百科//sourceforge.net/projects/libptrace/). The project has not advertised any preferred means of requesting support (Unfortunately, this project hasn't indicated the best way to get help). Anywho, the problem I'm running into is as follows:

% ./build.sh
% ...[SUCCESS]
% ./configure
% ...[SUCCESS]
% make
Making all in src
make[2]: Entering directory `/home/xxx/build/libptrace-git.git/src'
make[2]: *** No rule to make target `../lib/libgnu.la', needed by `libptrace.la'.  Stop.
make[2]: Leaving directory `/home/xxx/build/libptrace-git.git/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/xxx/build/libptrace-git.git'
make: *** [all] Error 2
%

If you google libptrace and libgnu.la, you get zero hits. Grepping for it in the source take fresh out of git, you get:

% grep -sre libgnu.la *
src/Makefile.in:libptrace_la_DEPENDENCIES = ../lib/libgnu.la
src/Makefile.in:libptrace_la_LIBADD = ../lib/libgnu.la
src/Makefile.am:libptrace_la_LIBADD = ../lib/libgnu.la
src/Makefile:libptrace_la_DEPENDENCIES = ../lib/libgnu.la
src/Makefile:libptrace_la_LIBADD = ../lib/libgnu.la

I have no idea how to generate a libtool archive file, and source doesn't seem to have any make targets or scripts otherwise to do so.

An note on admin: please add the tag `libptrace' to this question - obviously a very popular topic - I can't do so as I don't meet the 1.5K point count :(


In response to Mel's amendment to build.sh, Here are the new errors generated on `make':

gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src    -g -O2 -Wall -MT test-linux-dlsym.o -MD -MP -MF                     .deps/test-linux-dlsym.Tpo -c -o test-linux-dlsym.o test-linux-dlsym.c
mv -f .deps/test-linux-dlsym.Tpo .deps/test-linux-dlsym.Po
/bin/sh ../../libtool --tag=CC   --mode=link gcc  -g -O2 -Wall   -o test-linux-dlsym test-linux-dlsym.o            ../../src/libptrace.la 
libtool: link: gcc -g -O2 -Wall -o .libs/test-linux-dlsym test-linux-dlsym.o  ../../src/.libs/libptrace.so         -Wl,-rpath -Wl,/usr/local/lib
test-linux-dlsym.o: In function `main':
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:24: undefined reference to             `ptrace_elf_get_link_map_head'
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:40: undefined reference to             `ptrace_elf_get_link_map_next'
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:31: undefined reference to             `ptrace_elf_get_symtab'
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:32: undefined reference to             `ptrace_elf_get_strtab'
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:33: undefined reference to             `ptrace_elf_get_hash'
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:34: undefined reference to             `ptrace_elf_get_hash_chains'
collect2: ld returned 1 exit status
make[2]: *** [test-linux-dlsym] Error 1
make[2]: Leaving directory `/home/XXX/dev/insecurity/build/libptrace-git.git/tests/linux'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/XXX/dev/insecurity/build/libptrace-git.git'
make: *** [all] Error 2


This is gnulib: http://www.gnu.org/software/gnulib/

It can be install in Debian with apt-get install gnulib


builds on Ubuntu 10.10, gnulib is required as noted above and probably a whole bunch of build tools (autoconf, automake)

below patch fixes a link error which occurs when building git cc97c9e3d830bd1d567011ec099846343cef547a

diff --git a/src/Makefile.am b/src/Makefile.am index 6de8cf2..5f8d9bc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -23,8 +23,8 @@ endif if TARGET_LINUX libptrace_la_SOURCES += libptrace_linux.c libptrace_linux.h \ libptrace_wrapper.c libptrace_wrapper.h \ - libptrace_linux_procfs.c libptrace_linux_procfs.h -# libptrace_elf.c libptrace_elf.h
+ libptrace_linux_procfs.c libptrace_linux_procfs.h \ + libptrace_elf.c libptrace_elf.h
libptrace_la_HEADERS += libptrace_linux.h libptrace_wrapper.h if TARGET_I386 libptrace_la_SOURCES += libptrace_linux_x86.c libptrace_linux_x86.h @@ -38,8 +38,8 @@ endif

if TARGET_FREEBSD libptrace_la_SOURCES += libptrace_freebsd.c libptrace_freebsd.h \ - libptrace_wrapper.c libptrace_wrapper.h
-# libptrace_elf.c libptrace_elf.h
+ libptrace_wrapper.c libptrace_wrapper.h \ + libptrace_elf.c libptrace_elf.h
libptrace_la_HEADERS += libptrace_freebsd.h libptrace_wrapper.h if TARGET_I386 libptrace_la_SOURCES += libptrace_freebsd_x86.c libptrace_freebsd_x86.h


First of all, this only works on linux. If you want this to work on other systems, you will need to write a src/libptrace_config.h header in configure.ac as can be seen by grep COMPILE_HDR configure.ac.

Secondly, the following patch is all I need to get the point where the generated header is missing on my system. Of course gnulib needs to be installed and gnulib-tool must be in $PATH.

diff --git a/build.sh b/build.sh
index 81caf8a..cc195c4 100755
--- a/build.sh
+++ b/build.sh
@@ -1,7 +1,7 @@
 #!/bin/sh

 # Import gnulib modules which we use
-gnulib-tool --import stdint
+gnulib-tool --libtool --import stdint

 # Update timestamp to make sure autoconf rebuilds everything.
 touch configure.ac
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜