我如何在Heroku上使用rdiscount? [英] How can I use rdiscount on Heroku?

查看:108
本文介绍了我如何在Heroku上使用rdiscount?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将一个小测试应用推送到Heroku。这是应用程序和Gem文件:

应用程序:

 要求'sinatra'
要求'haml'
要求'rdiscount'

设置:markdown,:layout_engine => :haml,:layout => :layout


get'/'do
haml:index
end

'/ blog'do
markdown :test
end

Gemfile:

  source:rubygems 
gem'sinatra'
gem'thin'
gem'haml'
gem'rdiscount'

在推向Heroku之前,我运行 bundle install 。但试图安装rdiscount gem时推送到Heroku失败:

  -----> Ruby / Rack应用程序检测到
----->使用Bundler版本1.3.0.pre.5安装依赖项
运行:bundle install --without开发:test --path vendor / bundle --binstubs vendor / bundle / bin --deployment
获取gem元数据从http://rubygems.org/ ..........
从http://rubygems.org/获取gem元数据。
使用守护进程(1.1.9)
使用eventmachine(1.0.0)
使用haml(3.1.7)
使用rack(1.4.3)
使用rack-protection(1.3.2)
安装rdiscount (2.0.7)
Gem :: Installer :: ExtensionBuildError:错误:无法构建gem本机扩展。
/ usr / local / bin / ruby​​ extconf.rb
检查random()... yes
检查srandom()... yes
检查rand() ...是
检查srand()...是
检查unsigned long的长度... long
检查unsigned int的大小... int
no int with大小4
*** extconf.rb失败***
由于某种原因无法创建Makefile,可能缺少
必需的库和/或头文件。查看mkmf.log文件以获取更多
的详细信息。您可能需要配置选项。
提供的配置选项:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt -include = $ {opt-dir} / include
--with-opt-lib
--without-opt-lib = $ {opt-dir} / lib
--with- make-prog
--without-make-prog
--srcdir =。
--curdir
--ruby = / usr / local / bin / ruby​​
--with-rdiscount-dir
--without-rdiscount-dir
- -with-rdiscount-包括
--without-rdiscount-包括= $ {rdiscount-DIR} /包括
--with-rdiscount-lib的
--without-rdiscount-LIB = $ {rdiscount-DIR} / lib目录
宝石文件仍将安装在/tmp/build_3aijv3ga0dy1y/vendor/bundle/ruby/1.9.1/gems/rdiscount-2.0.7进行检查。
。结果记录到/tmp/build_3aijv3ga0dy1y/vendor/bundle/ruby/1.9.1/gems/rdiscount-2.0.7/ext/gem_make.out
在安装rdiscount发生错误(2.0.7) ,Bundler无法继续。
确保`gem install rdiscount -v'2.0.7'`捆绑成功。

!无法通过Bundler安装宝石。

! Heroku推送被拒绝,未能编译Ruby / rack应用程序

我明白rdiscount可能依赖于其他宝石或图书馆和这种依赖似乎没有得到解决。但是,我不明白如何解决这个问题。你能给我一些关于如何使这个工作的建议吗?

解决方案

Heroku似乎存在一个Ruby 1.9.2的问题,以及它认为int是多少个字节。



尝试为您的Gemfile添加 ruby​​1.9.3

 来源:rubygems 
ruby​​1.9.3

gem'sinatra'
gem'thin'
gem'haml'
gem'rdiscount'

我自己的测试转载了您的1.9.2错误,并成功1.9.3


I am trying to push a small test app to Heroku. Here is the App and the Gem file:

App:

require 'sinatra'
require 'haml'
require 'rdiscount'

set :markdown, :layout_engine => :haml, :layout => :layout


get '/' do 
  haml :index
end

get '/blog' do 
  markdown :test
end

Gemfile:

source :rubygems
gem 'sinatra'
gem 'thin'
gem 'haml'
gem 'rdiscount'

Before pushing to Heroku I run bundle install. But pushing to Heroku fails when trying to install the rdiscount gem:

-----> Ruby/Rack app detected
-----> Installing dependencies using Bundler version 1.3.0.pre.5
   Running: bundle install --without development:test --path vendor/bundle --binstubs   vendor/bundle/bin --deployment
   Fetching gem metadata from http://rubygems.org/..........
   Fetching gem metadata from http://rubygems.org/..
   Using daemons (1.1.9)
   Using eventmachine (1.0.0)
   Using haml (3.1.7)
   Using rack (1.4.3)
   Using rack-protection (1.3.2)
   installing rdiscount (2.0.7)
   Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
   /usr/local/bin/ruby extconf.rb
   checking for random()... yes
   checking for srandom()... yes
   checking for rand()... yes
   checking for srand()... yes
   checking size of unsigned long... long
   checking size of unsigned int... int
   no int with size 4
   *** extconf.rb failed ***
   Could not create Makefile due to some reason, probably lack of
   necessary libraries and/or headers.  Check the mkmf.log file for more
   details.  You may need configuration options.
   Provided configuration options:
   --with-opt-dir
   --without-opt-dir
   --with-opt-include
   --without-opt-include=${opt-dir}/include
   --with-opt-lib
   --without-opt-lib=${opt-dir}/lib
   --with-make-prog
   --without-make-prog
   --srcdir=.
   --curdir
   --ruby=/usr/local/bin/ruby
   --with-rdiscount-dir
   --without-rdiscount-dir
   --with-rdiscount-include
   --without-rdiscount-include=${rdiscount-dir}/include
   --with-rdiscount-lib
   --without-rdiscount-lib=${rdiscount-dir}/lib
   Gem files will remain installed in /tmp/build_3aijv3ga0dy1y/vendor/bundle/ruby/1.9.1/gems/rdiscount-2.0.7 for inspection.
   Results logged to /tmp/build_3aijv3ga0dy1y/vendor/bundle/ruby/1.9.1/gems/rdiscount-2.0.7/ext/gem_make.out
   An error occurred while installing rdiscount (2.0.7), and Bundler cannot continue.
   Make sure that `gem install rdiscount -v '2.0.7'` succeeds before bundling.
 !
 !     Failed to install gems via Bundler.
 !
 !     Heroku push rejected, failed to compile Ruby/rack app

I do understand that rdiscount might depend on some other Gems or libraries and this dependency does not seem to be resolved. However, I do not understand how to solve this problem. Could you give me some advice on how to get this to work?

解决方案

There seems to be an issue with Ruby 1.9.2 on Heroku and how may bytes it thinks int is.

Try to add ruby "1.9.3" to you Gemfile like this:

source :rubygems
ruby "1.9.3"

gem 'sinatra'
gem 'thin'
gem 'haml'
gem 'rdiscount'

My own testing reproduced your error on 1.9.2 and succeeded on 1.9.3

这篇关于我如何在Heroku上使用rdiscount?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆