当我为td-agent安装elasticsearch-transport
时,td-agent-gem install elasticsearch-transport -v2.0.0.pre
命令后出现以下错误:
/opt/td-agent/embedded/bin/ruby extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling system_timer_native.c
In file included from system_timer_native.c:8:0:
/opt/td-agent/embedded/include/ruby-2.1.0/ruby/backward/rubysig.h:14:2: warning: #warning rubysig.h is obsolete [-Wcpp]
#warning rubysig.h is obsolete
^
system_timer_native.c: In function ‘install_first_timer_and_save_original_configuration’:
system_timer_native.c:43:22: error: storage size of ‘timer_interval’ isn’t known
struct itimerval timer_interval;
^
system_timer_native.c:81:24: error: ‘ITIMER_REAL’ undeclared (first use in this function)
if (0 != setitimer(ITIMER_REAL, &timer_interval, &original_timer_interval)) {
^
system_timer_native.c:81:24: note: each undeclared identifier is reported only once for each function it appears in
system_timer_native.c: In function ‘install_next_timer’:
system_timer_native.c:108:22: error: storage size of ‘timer_interval’ isn’t known
struct itimerval timer_interval;
^
system_timer_native.c:129:24: error: ‘ITIMER_REAL’ undeclared (first use in this function)
if (0 != setitimer(ITIMER_REAL, &timer_interval, NULL)) {
^
system_timer_native.c: In function ‘restore_original_timer_interval’:
system_timer_native.c:189:24: error: ‘ITIMER_REAL’ undeclared (first use in this function)
if (0 != setitimer(ITIMER_REAL, &original_timer_interval, NULL)) {
^
system_timer_native.c: In function ‘install_ruby_sigalrm_handler’:
system_timer_native.c:211:5: error: ‘rb_thread_critical’ undeclared (first use in this function)
rb_thread_critical = 1;
^
system_timer_native.c: In function ‘restore_original_ruby_sigalrm_handler’:
system_timer_native.c:217:5: error: ‘rb_thread_critical’ undeclared (first use in this function)
rb_thread_critical = 1;
^
system_timer_native.c: In function ‘set_itimerval’:
system_timer_native.c:292:10: error: dereferencing pointer to incomplete type
value->it_interval.tv_usec = 0;
^
system_timer_native.c:293:10: error: dereferencing pointer to incomplete type
value->it_interval.tv_sec = 0;
^
system_timer_native.c:294:10: error: dereferencing pointer to incomplete type
value->it_value.tv_sec = (long int) (seconds);
^
system_timer_native.c:295:10: error: dereferencing pointer to incomplete type
value->it_value.tv_usec = (long int) ((seconds - value->it_value.tv_sec) \
^
system_timer_native.c:295:59: error: dereferencing pointer to incomplete type
value->it_value.tv_usec = (long int) ((seconds - value->it_value.tv_sec) \
^
system_timer_native.c:298:61: error: dereferencing pointer to incomplete type
log_debug("[set_itimerval] Set to %ds + %dus\n", value->it_value.tv_sec,
^
system_timer_native.c:299:61: error: dereferencing pointer to incomplete type
value->it_value.tv_usec);
^
make: *** [system_timer_native.o] Error 1
make failed, exit code 2
以下是td-agent env
的输出:
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.1
- RUBY VERSION: 2.1.5 (2014-11-13 patchlevel 273) [x86_64-linux]
- INSTALLATION DIRECTORY: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/
- RUBY EXECUTABLE: /opt/td-agent/embedded/bin/ruby
- EXECUTABLE DIRECTORY: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/bin
- SPEC CACHE DIRECTORY: /root/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /opt/td-agent/embedded/lib/ruby/gems/2.1.0/
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
看起来在安装过程中,gem正在尝试安装错误的依赖项(system_timer),只有当Ruby版本低于1.9时才应该使用Gemspec。实际上,当我使用td-agent-gem fetch elasticsearch-transport -v2.0.0.pre
下载gem时,将其解压缩(td-agent-gem unpack elasticsearch-transport-2.0.0.pre.gem
)然后再次构建它(td-agent-gem build elasticsearch-transport.gemspec
)我得到了不同的依赖项集:
$ td-agent-gem install elasticsearch-transport-2.0.0.pre.fetched.gem --explain
Gems to install:
elasticsearch-transport-2.0.0.pre
faraday-0.9.2
multi_json-1.10.1
multipart-post-2.0.0
system_timer-1.2.4
$ td-agent-gem install elasticsearch-transport-2.0.0.pre.built.gem --explain
Gems to install:
elasticsearch-transport-2.0.0.pre
faraday-0.9.2
multi_json-1.10.1
multipart-post-2.0.0
如何在不构建之前安装此gem?
答案 0 :(得分:1)
似乎是弹性搜索 - 运输问题。 我在存储库上提交了一个错误报告:https://github.com/elastic/elasticsearch-ruby/issues/329