0

我正在开发一个需要 Event::Lib 的 Perl 项目。我在 MacOS 10.7 上,并且正在运行Citrus Perl而不是系统 Perl。我从源代码安装了libevent,它编译得很好。但是,当我去安装 Event::Lib 时,我遇到了一些错误:

cp Lib/Event/Lib.pm blib/lib/Event/Lib.pm
Skip blib/lib/Event/Lib.pm (unchanged)
/Users/username/code/CitrusPerl/bin/perl /Users/username/code/CitrusPerl/lib/ExtUtils/xsubpp  -typemap /Users/username/code/CitrusPerl/lib/ExtUtils/typemap -typemap typemap  Lib.xs > Lib.xsc && mv Lib.xsc Lib.c
gcc -c  -I/usr/local/include -fno-common -DPERL_DARWIN -no-cpp-precomp -arch i386 -B/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/gcc -B/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib/gcc -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks -mmacosx-version-min=10.6 -DUSE_SITECUSTOMIZE -Duselargefiles -DPERL_RELOCATABLE_INCPUSH -fno-merge-constants -fno-strict-aliasing -pipe -fstack-protector  -O3   -DVERSION=\"1.03\" -DXS_VERSION=\"1.03\"  "-I/Users/username/code/CitrusPerl/lib/CORE"  -DHAVE_CONFIG_H  Lib.c
Lib.xs: In function ‘boot_Event__Lib’:
Lib.xs:275: error: ‘LOG_LEVEL’ undeclared (first use in this function)
Lib.xs:275: error: (Each undeclared identifier is reported only once
Lib.xs:275: error: for each function it appears in.)
make: *** [Lib.o] Error 1

有人对接下来要尝试什么有任何想法吗?

编辑:尝试一些“o conf”选项后:

cpan[1]> o conf makepl_arg "INC=-I/usr/local/include LIBS=-L/usr/local/lib -levent"                                                             
    makepl_arg         [INC=-I/usr/local/include LIBS=-L/usr/local/lib -levent]
Your /Users/username/code/CitrusPerl/vendor/lib/CPAN/Config.pm file
is not writable. I will attempt to write your configuration to
/Users/username/.cpan/CPAN/MyConfig.pm instead.

Old configuration file /Users/username/.cpan/CPAN/MyConfig.pm
    moved to /Users/username/.cpan/CPAN/MyConfig.pm.bak
commit: wrote '/Users/username/.cpan/CPAN/MyConfig.pm'

cpan[2]> install Event::Lib                                                                                                                     
Reading '/Users/username/code/CitrusPerl/cpan/Metadata'
  Database was generated on Thu, 07 Feb 2013 21:53:02 GMT
Fetching with LWP:
http://www.perl.org/CPAN/authors/01mailrc.txt.gz
Reading '/Users/username/code/CitrusPerl/cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
Fetching with LWP:
http://www.perl.org/CPAN/modules/02packages.details.txt.gz
Reading '/Users/username/code/CitrusPerl/cpan/sources/modules/02packages.details.txt.gz'
  Database was generated on Thu, 14 Feb 2013 15:41:03 GMT
............................................................................DONE
Fetching with LWP:
http://www.perl.org/CPAN/modules/03modlist.data.gz
Reading '/Users/username/code/CitrusPerl/cpan/sources/modules/03modlist.data.gz'
............................................................................DONE
Writing /Users/username/code/CitrusPerl/cpan/Metadata
Running install for module 'Event::Lib'
Running make for V/VP/VPARSEVAL/Event-Lib-1.03.tar.gz
Fetching with LWP:
http://www.perl.org/CPAN/authors/id/V/VP/VPARSEVAL/Event-Lib-1.03.tar.gz
Checksum for /Users/username/code/CitrusPerl/cpan/sources/authors/id/V/VP/VPARSEVAL/Event-Lib-1.03.tar.gz ok
Scanning cache /Users/username/code/CitrusPerl/cpan/build for sizes
............................................................................DONE

  CPAN.pm: Building V/VP/VPARSEVAL/Event-Lib-1.03.tar.gz

Checking existance of libevent...ld: warning: directory not found for option '-L/sw/lib'
ld: warning: directory not found for option '-L/opt/local/lib'
yes
Checking capabilities...
  event_set_log_callback...no
  event_priority_init...no
Additional defines:  

Checking if your kit is complete...
Looks good
Writing Makefile for Event::Lib
Writing MYMETA.yml and MYMETA.json
cp Lib/Event/Lib.pm blib/lib/Event/Lib.pm
Skip blib/lib/Event/Lib.pm (unchanged)
/Users/username/code/CitrusPerl/bin/perl /Users/username/code/CitrusPerl/lib/ExtUtils/xsubpp  -typemap /Users/username/code/CitrusPerl/lib/ExtUtils/typemap -typemap typemap  Lib.xs > Lib.xsc && mv Lib.xsc Lib.c
gcc -c  -I/usr/local/include -fno-common -DPERL_DARWIN -no-cpp-precomp -arch i386 -B/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/gcc -B/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib/gcc -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks -mmacosx-version-min=10.6 -DUSE_SITECUSTOMIZE -Duselargefiles -DPERL_RELOCATABLE_INCPUSH -fno-merge-constants -fno-strict-aliasing -pipe -fstack-protector  -O3   -DVERSION=\"1.03\" -DXS_VERSION=\"1.03\"  "-I/Users/username/code/CitrusPerl/lib/CORE"  -DHAVE_CONFIG_H  Lib.c
Lib.xs: In function ‘boot_Event__Lib’:
Lib.xs:275: error: ‘LOG_LEVEL’ undeclared (first use in this function)
Lib.xs:275: error: (Each undeclared identifier is reported only once
Lib.xs:275: error: for each function it appears in.)
make: *** [Lib.o] Error 1
  VPARSEVAL/Event-Lib-1.03.tar.gz
  /usr/bin/make -- NOT OK
Running make test
  Can't test without successful make
Running make install
  Make had returned bad status, install seems impossible
Failed during this command:
 VPARSEVAL/Event-Lib-1.03.tar.gz              : make NO
4

1 回答 1

0

我能够在大约 10 分钟的时间内完成这项工作。

然后:

  • 酿造安装 libevent
  • perlbrew 安装 perl-5.16.0
  • perlbrew 切换 perl-5.16.0
  • perl -MCPAN -e '安装事件::Lib'

我认为以上是提供可以切换的适当开发环境的最佳实用程序;IE 你可以切换 Perl 版本的飞。此外,它们不会影响您的本机系统。无论如何,如果您决定不使用上述内容,那么您的特定错误看起来与缺少头文件有关。我会断言 libevent 标头确实在 /usr/local/include 中。

祝你好运。

于 2013-02-13T07:17:59.647 回答