缺少linux / types.h,无法安装gem

时间:2013-01-03 18:37:07

标签: header rubygems ubuntu-12.04 eventmachine

我在尝试在我的ubuntu 12.04服务器上安装eventmachine时遇到错误。有什么想法吗?

bundle exec gem install eventmachine
Building native extensions.  This could take a while...
ERROR:  Error installing eventmachine:
    ERROR: Failed to build gem native extension.

        /opt/ruby-enterprise-1.8.7-2012.02/bin/ruby extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... no
checking for inotify_init() in sys/inotify.h... yes
checking for writev() in sys/uio.h... yes
checking for rb_thread_check_ints()... no
checking for rb_time_new()... yes
checking for sys/event.h... no
checking for epoll_create() in sys/epoll.h... yes
creating Makefile

make
g++  -I. -I/opt/local/include -I. -I/opt/ruby-enterprise-1.8.7-2012.02/lib/ruby/1.8/i686-linux -I. -DWITH_SSL -DBUILD_FOR_RUBY -DHAVE_INOTIFY_INIT -DHAVE_INOTIFY -DHAVE_WRITEV -DHAVE_WRITEV -DHAVE_RB_TIME_NEW -DOS_UNIX -DHAVE_EPOLL_CREATE -DHAVE_EPOLL  -D_FILE_OFFSET_BITS=64  -fPIC -g -O2       -c binder.cpp
In file included from /usr/include/i386-linux-gnu/bits/sigcontext.h:28:0,
                 from /usr/include/signal.h:339,
                 from project.h:40,
                 from binder.cpp:20:
/usr/include/i386-linux-gnu/asm/sigcontext.h:5:25: fatal error: linux/types.h: No such file or directory
compilation terminated.
make: *** [binder.o] Error 1

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题。 types.h的路径在您的发行版中是不同的,或者根本不存在。尝试手动包含它。
http://linux.die.net/include/sys/types.h

你的程序会在你试图“包含”types.h时给你一个文件和行号错误。我为解决这个问题所做的是将types.h添加到与请求它的文件相同的文件夹中。然后你进入文件,在包含错误的行上,并用“types.h”替换(例如)“/ linux/types.h”的路径,因为你将它放在同一目录中。现在,make,make install。如果您收到另一个包含问题,您可能需要考虑更改口味,或者如果您愿意,可以继续添加包含。欢迎来到精彩的黑客世界。 :)

相关问题