![在 slackware 13.1 上安装 perf 失败](https://linux22.com/image/2126/%E5%9C%A8%20slackware%2013.1%20%E4%B8%8A%E5%AE%89%E8%A3%85%20perf%20%E5%A4%B1%E8%B4%A5.png)
我试图在 slackware 13.1 上安装 perf 当我第一次在 /usr/src/linux/tools/perf 运行 make 时,出现了一些错误。我找到了这个补丁 http://www.valimar.it/repo/linux/perf_fix-2.6.33.patch 当我再次运行 make 时,它发出了一些不同的错误,如下所示。但我已经安装了 perl 软件包 perl-5.10.1-i486-1
libperf.a(trace-event-perl.o): In function `define_flag_value':
/usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:125: undefined reference to `Perl_push_scope'
/usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:126: undefined reference to `Perl_save_int'
/usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:129: undefined reference to `Perl_newSVpv'
/usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:129: undefined reference to `Perl_sv_2mortal'
/usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:130: undefined reference to `Perl_newSVpv'
/usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:130: undefined reference to `Perl_sv_2mortal'
/usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:131: undefined reference to `Perl_newSVuv'
/usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:131: undefined reference to `Perl_sv_2mortal'
/usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:132: undefined reference to `Perl_newSVpv'
/usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:132: undefined reference to `Perl_sv_2mortal'
/usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:135: undefined reference to `Perl_get_cv'
/usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:136: undefined reference to `Perl_call_pv'
/usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:139: undefined reference to `Perl_free_tmps'
/usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:132: undefined reference to `Perl_stack_grow'
/usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:131: undefined reference to `Perl_stack_grow'
/usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:130: undefined reference to `Perl_stack_grow'
/usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:129: undefined reference to `Perl_stack_grow'
/usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:127: undefined reference to `Perl_markstack_grow'
答案1
最后我通过注释掉 Makefile 中的以下行解决了这个问题
#ifndef NO_LIBPERL
#PERL_EMBED_LDOPTS = `perl -MExtUtils::Embed -e ldopts 2>/dev/null`
#PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
#endif
看起来 MExtUtils::Embed 为 libperl 生成错误的 LDFLAGS 我还发现 slackware perl 包仅提供静态库 libperl.a