Rails安装eventmachine提示出错的解决方法
2017-02-28 10:52
441 查看
github中的项目其中需要eventmachine包:
但是直接bundle出错,提示找不到openssl/ssl.h头文件:
首先确定系统中安装了openssl库,然后指定include路径编译:
但是再次bundle还是出错,rails安装的是1.0.3版本,但刚才装的是1.2.3版本,我们指定1.0.3版本再次试一下:
可惜还是出错:
貌似1.0.3源码不兼容啊,一种办法就是修改源代码,顺利的话也很好,但不顺利的话…. ;( ,所以我们还是下面直接用新版本试一下,在Gemfile中手动指定版本:
运行bundle,出错!!!提示如下:
我们还得update一下:
最后安装成功,但是这样有一个问题:当rails项目指定gem版本时最好不要修改其版本,即使是更新!因为可能涉及到代码兼容性问题.这里是不得已而为之的办法,最终项目是否可以成功运行还得再观察 ;)
gem 'eventmachine'
但是直接bundle出错,提示找不到openssl/ssl.h头文件:
make "DESTDIR=" compiling binder.cpp In file included from binder.cpp:20: ./project.h:107:10: fatal error: 'openssl/ssl.h' file not found #include <openssl/ssl.h> ^ 1 error generated. make: *** [binder.o] Error 1
首先确定系统中安装了openssl库,然后指定include路径编译:
gem install eventmachine -- --with-cppflags=-I/usr/local/opt/openssl/include Fetching: eventmachine-1.2.3.gem (100%) Building native extensions with: '--with-cppflags=-I/usr/local/opt/openssl/include' This could take a while... Successfully installed eventmachine-1.2.3 1 gem installed
但是再次bundle还是出错,rails安装的是1.0.3版本,但刚才装的是1.2.3版本,我们指定1.0.3版本再次试一下:
gem install eventmachine -v '1.0.3' -- --with-cppflags=-I/usr/local/opt/openssl/include
可惜还是出错:
ERROR: Error installing eventmachine: ERROR: Failed to build gem native extension. /Users/apple/.rvm/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20170228-3267-j31ccl.rb extconf.rb --with-cppflags=-I/usr/local/opt/openssl/include 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... no checking for __NR_inotify_init in sys/syscall.h... no checking for writev() in sys/uio.h... yes checking for rb_wait_for_single_fd()... yes checking for rb_enable_interrupt()... no checking for rb_time_new()... yes checking for sys/event.h... yes checking for sys/queue.h... yes creating Makefile make "DESTDIR=" clean make "DESTDIR=" compiling binder.cpp compiling cmain.cpp compiling ed.cpp compiling em.cpp em.cpp:827:9: error: use of undeclared identifier 'rb_thread_select'; did you mean 'rb_thread_fd_select'? return EmSelect (maxsocket+1, &fdreads, &fdwrites, &fderrors, &tv); ^~~~~~~~ rb_thread_fd_select ./em.h:25:20: note: expanded from macro 'EmSelect' #define EmSelect rb_thread_select ^ /Users/apple/.rvm/rubies/ruby-2.2.5/include/ruby-2.2.0/ruby/intern.h:454:5: note: 'rb_thread_fd_select' declared here int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *); ^ em.cpp:827:32: error: cannot initialize a parameter of type 'rb_fdset_t *' with an rvalue of type 'fd_set *' return EmSelect (maxsocket+1, &fdreads, &fdwrites, &fderrors, &tv); ^~~~~~~~ /Users/apple/.rvm/rubies/ruby-2.2.5/include/ruby-2.2.0/ruby/intern.h:454:42: note: passing argument to parameter here int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *); ^ em.cpp:946:6: error: use of undeclared identifier 'rb_thread_select'; did you mean 'rb_thread_fd_select'? EmSelect (0, NULL, NULL, NULL, &tv); ^~~~~~~~ rb_thread_fd_select ./em.h:25:20: note: expanded from macro 'EmSelect' #define EmSelect rb_thread_select ^ /Users/apple/.rvm/rubies/ruby-2.2.5/include/ruby-2.2.0/ruby/intern.h:454:5: note: 'rb_thread_fd_select' declared here int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *); ^ 3 errors generated.
貌似1.0.3源码不兼容啊,一种办法就是修改源代码,顺利的话也很好,但不顺利的话…. ;( ,所以我们还是下面直接用新版本试一下,在Gemfile中手动指定版本:
gem 'eventmachine','1.2.3'
运行bundle,出错!!!提示如下:
You have requested: eventmachine = 1.2.3 The bundle currently has eventmachine locked at 1.0.3. Try running `bundle update eventmachine` If you are updating multiple gems in your Gemfile at once, try passing them all to `bundle update`
我们还得update一下:
bundle update eventmachine
最后安装成功,但是这样有一个问题:当rails项目指定gem版本时最好不要修改其版本,即使是更新!因为可能涉及到代码兼容性问题.这里是不得已而为之的办法,最终项目是否可以成功运行还得再观察 ;)
相关文章推荐
- 安装SQL Server 2016出错提示:需要安装oracle JRE7 更新 51(64位)或更高版本问题的解决方法
- 安装office2010提示在安装过程中出错 解决方法!
- 安装Oracle9i时提示“加载数据库时出错:areaQueries ”的原因及解决方法
- windows10下安装Microsoft Visual Studio 2013.4 Community enu中文语言包出错,提示“”程序兼容模式已打开.请将其关闭”的解决方法
- rails 安装linecache19出错的解决方法
- SQL安装时出错,提示:安装程序配置服务器失败 参考服务器错误日志。针对其中一种情况的解决方法!
- win7下安装 office 2007提示"在安装过程中出错" 解决方法
- Rails bundle命令安装mysql gem包出错的解决方法
- 安装OFFICE 2010出错提示ERROR 1046的解决方法
- win7/win8下安装Oracle1出错10g,提示“程序异常终止,发生未知错误”解决方法
- 【操作系统】chrome插件无法安装解决方法或者提示“将该项添加到 Chrome 浏览器时出错。请刷新此页面,然后重试。”的解决办法
- 安装Delphi7成功运行后又提示注册的解决方法
- 安装office时总得到“安装程序包的语言不受系统支持”的提示解决方法
- SQLServer2000安装程序提示“有一个挂起的安装实例,请重起机器”的解决方法
- 安装sqlserver2000提示挂起的解决方法
- sql2000备份的数据库还原到sql2005后,选择“数据库关系图”提示:此数据库没有有效所有者,因此无法安装数据库关系图支持对象"的解决方法
- 安装sqlserver2000提示挂起的解决方法
- Visual Studio 2005安装在Windows 2003上用IIS6调试出错解决方法
- XP系统下安装SQL2000提示"程序被挂起"的解决方法
- 重新安装系统后 Sql Server 2005 升级注意!以及执行attach 错误,提示05错误的解决方法!