gem install 找不到头文件

发布于 2024-10-10 21:01:10 字数 975 浏览 5 评论 0原文

遵循 talib_ruby 的 github README:

sudo port install ta-lib

完成。接下来就是麻烦开始的地方。

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

我相信此安装失败,因为显然它找不到

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

.
.
.
many more errors

我包含在 .bash_profile 文件中的 ta_abstract.h 文件,如下所示:

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 变量赋值中所说的位置。

什么给?

更新:

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

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

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

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

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

What gives?

UPDATE:

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

千年*琉璃梦 2024-10-17 21:01:10

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

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,然后输入

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

From There,只需按照 gem 作者的指导以及上面列出的输入即可。

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

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

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

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

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

山有枢 2024-10-17 21:01:10

观察

sudo echo $ABSOLUTE_PATH_TO_TALIB_HEADERS

echo ABSOLUTE_PATH_TO_TALIB_HEADERS

have included in **my** .bash_profile file the following:

sudo

你是 root 吗?

将环境变量放在命令行上就可以了,或者将它们添加到 root 的环境中。

Observe

sudo echo $ABSOLUTE_PATH_TO_TALIB_HEADERS

echo ABSOLUTE_PATH_TO_TALIB_HEADERS

have included in **my** .bash_profile file the following:

sudo

Are you root?

put the env vars on the command line and you should be good, alternatively add them to root's env.

仅此而已 2024-10-17 21:01:10

只需添加brew安装的ta-lib的答案。

env ARCHFLAGS="-arch x86_64" gem install talib_ruby -- --with-talib-include=/usr/local/include/ta-lib --with-talib-lib=/usr/local/lib

Just adding an answer for brew installed ta-lib.

env ARCHFLAGS="-arch x86_64" gem install talib_ruby -- --with-talib-include=/usr/local/include/ta-lib --with-talib-lib=/usr/local/lib

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文