在小牛队上安装 redcarpet gem
Posted
技术标签:
【中文标题】在小牛队上安装 redcarpet gem【英文标题】:Installing redcarpet gem on mavericks 【发布时间】:2013-10-25 01:32:33 【问题描述】:我目前正在尝试为 Rails 项目安装 Redcarpet gem。
问题是前几天我升级到了Mavericks OS,无法安装,但不确定是不是跟换OS有关系。
这是我遇到的错误:
ERROR: Error installing redcarpet:
ERROR: Failed to build gem native extension.
/Users/lalala/.rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb
creating Makefile
make
compiling autolink.c
In file included from autolink.c:17:
buffer.h:23:20: error: stdint.h: No such file or directory
In file included from autolink.c:17:
buffer.h:41: error: expected specifier-qualifier-list before ‘uint8_t’
In file included from autolink.c:18:
autolink.h:31: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
autolink.h:31: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
autolink.h:35: error: expected declaration specifiers or ‘...’ before ‘uint8_t’
autolink.h:39: error: expected declaration specifiers or ‘...’ before ‘uint8_t’
autolink.h:43: error: expected declaration specifiers or ‘...’ before ‘uint8_t’
autolink.c:20:20: error: string.h: No such file or directory
autolink.c:21:20: error: stdlib.h: No such file or directory
autolink.c:22:19: error: stdio.h: No such file or directory
autolink.c:23:19: error: ctype.h: No such file or directory
autolink.c:30: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
autolink.c:30: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
autolink.c:52: error: expected ‘)’ before ‘*’ token
autolink.c:136: error: expected ‘)’ before ‘*’ token
autolink.c:165: error: expected declaration specifiers or ‘...’ before ‘uint8_t’
autolink.c: In function ‘sd_autolink__www’:
autolink.c:172: warning: implicit declaration of function ‘ispunct’
autolink.c:172: error: ‘data’ undeclared (first use in this function)
autolink.c:172: error: (Each undeclared identifier is reported only once
autolink.c:172: error: for each function it appears in.)
autolink.c:172: warning: implicit declaration of function ‘isspace’
autolink.c:175: warning: implicit declaration of function ‘memcmp’
autolink.c:175: warning: implicit declaration of function ‘strlen’
autolink.c:175: warning: incompatible implicit declaration of built-in function ‘strlen’
autolink.c:178: warning: implicit declaration of function ‘check_domain’
autolink.c:186: warning: implicit declaration of function ‘autolink_delim’
autolink.c: At top level:
autolink.c:201: error: expected declaration specifiers or ‘...’ before ‘uint8_t’
autolink.c: In function ‘sd_autolink__email’:
autolink.c:210: error: ‘uint8_t’ undeclared (first use in this function)
autolink.c:210: error: expected ‘;’ before ‘c’
autolink.c:212: warning: implicit declaration of function ‘isalnum’
autolink.c:212: error: ‘c’ undeclared (first use in this function)
autolink.c:215: warning: implicit declaration of function ‘strchr’
autolink.c:215: warning: incompatible implicit declaration of built-in function ‘strchr’
autolink.c:225: error: expected ‘;’ before ‘c’
autolink.c:241: error: ‘data’ undeclared (first use in this function)
autolink.c: At top level:
autolink.c:256: error: expected declaration specifiers or ‘...’ before ‘uint8_t’
autolink.c: In function ‘sd_autolink__url’:
autolink.c:263: error: ‘data’ undeclared (first use in this function)
autolink.c:266: warning: implicit declaration of function ‘isalpha’
autolink.c:269: warning: implicit declaration of function ‘sd_autolink_issafe’
autolink.c:272: warning: incompatible implicit declaration of built-in function ‘strlen’
make: *** [autolink.o] Error 1
显然某些 c 库有问题,但我不知道如何解决它,我一直在谷歌搜索,但没有发现任何有用的东西。
非常感谢任何帮助,谢谢!
【问题讨论】:
【参考方案1】:您是否尝试过升级到最新的 XCode?p>
您可能需要运行 XCode 5.0.1 版才能在 Mavericks 下编译本机扩展。 Link.
编辑:
正如@Doon 在他的评论中指出的那样,您可能需要运行
xcode-select --install
获取最新的命令行工具。
【讨论】:
xcode-select --install 获取命令行工具,看看是否有帮助。 Doon,这就是我所做的,它正在工作 =),我正在等待 6 个小时来发布答案(不会让我这样做,因为我还没有 10 个代表点: P) 谢谢!【参考方案2】:好吧,我终于发现,当我升级到 10.9 Mavericks 时,我的 gcc 坏了,所以我不得不安装命令行工具。
怎么做:
1) 打开终端
2) 输入“xcode-select --install”(不带引号)
3) 按回车
4) 点击“安装”
就是这样!
【讨论】:
除非这给出了一个错误,说在服务器上不可用。它转到“查找软件”进度条,然后“无法安装该软件,因为它当前无法从软件更新服务器获得。” 发生这种情况时,我没有收到任何错误,它运行良好。【参考方案3】:您是否尝试删除 Gemfile.lock 并再次运行捆绑安装?
看到这个答案:
Active_Model error in rails
希望这会有所帮助!
【讨论】:
以上是关于在小牛队上安装 redcarpet gem的主要内容,如果未能解决你的问题,请参考以下文章
:footnotes 扩展在 Redcarpet Ruby gem 中不起作用
无法使用 Postgres.app 在 Mavericks 中安装 pg gem