编译 libptrace
尝试编译 libptrace (http://sourceforge.net/projects/libptrace/)。该项目没有公布任何请求支持的首选方式(不幸的是,该项目没有指出获得帮助的最佳方式)。不管怎样,我遇到的问题如下:
% ./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
%
如果你谷歌 libptrace 和 libgnu.la,你会得到零命中。在源代码中查找它,从 git 中取出新鲜的内容,您会得到:
% 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
我不知道如何生成 libtool 存档文件,并且源代码似乎没有任何 make 目标或脚本来执行此操作。
关于管理员的说明:请在这个问题中添加“libptrace”标签 - 显然是一个非常受欢迎的主题 - 我不能这样做,因为我没有达到 1.5K 点计数:(
回应 Mel 对 build.sh 的修改,以下是 `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
Trying to compile libptrace (http://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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是gnulib: http://www.gnu.org/software/gnulib/
它可以在 Debian 中使用 apt-get install gnulib 进行安装
This is gnulib: http://www.gnu.org/software/gnulib/
It can be install in Debian with
apt-get install gnulib
在 Ubuntu 10.10 上构建,如上所述,需要 gnulib,并且可能需要一大堆构建工具(autoconf、automake),
时发生的链接错误
下面的补丁修复了构建 git cc97c9e3d830bd1d567011ec099846343cef547a diff --git a/src/Makefile.am b/src /Makefile.am
索引 6de8cf2..5f8d9bc 100644
---a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,8 +23,8 @@ endif
如果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
如果TARGET_I386
libptrace_la_SOURCES += libptrace_linux_x86.c libptrace_linux_x86.h
@@ -38,8 +38,8 @@ endif
如果 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
如果TARGET_I386
libptrace_la_SOURCES += libptrace_freebsd_x86.c libptrace_freebsd_x86.h
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
首先,这仅适用于Linux。如果您希望它在其他系统上工作,则需要在configure.ac中编写src/libptrace_config.h标头,如
grep COMPILE_HDR configure.ac
所示。其次,我需要以下补丁来了解我的系统上缺少生成的标头的情况。当然,需要安装 gnulib,并且 gnulib-tool 必须位于 $PATH 中。
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.