gem install 找不到头文件 [英] gem install cannot find a header file

查看:31
本文介绍了gem install 找不到头文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照 github README for talib_ruby:

Following along the github README for talib_ruby:

sudo port install ta-lib

完成.接下来就是麻烦的开始了.

Complete. Next is where the trouble begins.

sudo env ARCHFLAGS="-arch PLATFORM" gem install talib_ruby -- --with-talib-include=ABSOLUTE_PATH_TO_TALIB_HEADERS  --with-talib-lib=ABSOLUTE_PATH_TO_TALIB_LIBS

我相信这个安装失败是因为它显然找不到 ta_abstract.h 文件

This install fails I believe because apparently it cannot find the ta_abstract.h file

talib.c:2:25: error: ta_abstract.h: No such file or directory

.
.
.
many more errors

我的 .bash_profile 文件中包含以下内容:

I have included in my .bash_profile file the following:

export ABSOLUTE_PATH_TO_TALIB_HEADERS=/opt/local/var/macports/software/ta-lib/0.4.0_0/opt/local/include/ta-lib
export ABSOLUTE_PATH_TO_TALIB_LIBS=/opt/local/var/macports/software/ta-lib/0.4.0_0/opt/local/lib

事实上,ta_abstract.h 文件位于我所说的 ABSOLUTE_PATH 变量赋值中.

And indeed the ta_abstract.h file is located where I'm saying in the ABSOLUTE_PATH variable assignment.

什么给了?

更新:

当所有其他方法都失败时,与 gem 作者的电子邮件通信可能会有所帮助.他建议在安装时传递实际路径,而不是导出 ABSOLUTE_PATH.除了显式传入 ARCHFLAGS="-arch x86_64",它适用于 Snow Leopard.安装仍然失败,但现在因为 talib.c 文件和其中的某些功能存在问题.

When all else fails, email correspondence with the gem author may help. Instead of export ABSOLUTE_PATH, he suggests passing the actual path in with the install. Along with explicitly passing in ARCHFLAGS="-arch x86_64", which works for Snow Leopard. The install still fails but now because it has issues with the talib.c file and certain functions therein.

推荐答案

这个问题的答案是 gem 作者通过电子邮件回答的,但我想分享一下解决方案.

The answer to this question was answered by the gem author via email, but I'd like to share the solution.

sudo env ARCHFLAGS="-arch x86_64" gem install talib_ruby -- --with-talib-include=/opt/local/var/macports/software/ta-lib/0.4.0_0/opt/local/include/ta-lib  --with-talib-lib=/opt/local/var/macports/software/ta-lib/0.4.0_0/opt/local/lib

需要注意的是,这个 gem 也与 Ruby 1.9.2 不兼容.从生成的错误列表来看,struct RObject 的定义存在一些问题(用字符串、数组等填充对象),我追踪到 ruby​​.h 头文件.如果你想使用这个 gem,你可以安装 rvm 然后输入

It is important to note that this gem is also not compatible with Ruby 1.9.2. From what the error list generated, it had some issues with the definition of struct RObject (fill in Object with String, Array, etc), which I traced to the ruby.h header file. If you'd like to use this gem, you can install rvm and then type

rvm install ruby-1.8.7 --with-readline-dir=/opt/local

从那里,只需按照 gem 作者的指导和上面列出的输入.

From there, simply follow the guidance from the gem author with the input listed above.

更新:gem 作者已使 talib_ruby 与 1.9.x 兼容,因此不再需要安装 1.8.7

UPDATE: the gem author has made talib_ruby compatible with 1.9.x so there is no longer a need to install 1.8.7

这篇关于gem install 找不到头文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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