gem install找不到头文件 [英] gem install cannot find a header file
问题描述
sudo port install ta-lib
完成。
sudo env ARCHFLAGS = - arch PLATFORMgem install talib_ruby - --with-talib -include = ABSOLUTE_PATH_TO_TALIB_HEADERS --with-talib-lib = ABSOLUTE_PATH_TO_TALIB_LIBS
我相信这次安装失败,因为显然它找不到ta_abstract.h文件
talib.c:2:25:error:ta_abstract.h:没有这样的文件或目录
。
。
。
更多错误
我的.bash_profile文件中包含以下内容:
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变量赋值中说的位置。
是什么给出的?
更新:
当所有其他项都失败时,与宝石作者的电子邮件通信可能会有所帮助。而不是导出ABSOLUTE_PATH,他建议在安装时传递实际路径。除了显式传递ARCHELAGS = - arch x86_64,它适用于Snow Leopard。安装仍然失败,但现在因为它有talib.c文件和其中的某些功能问题。
这个问题的答案由宝石作者通过电子邮件回答,但我想分享解决方案。
sudo env ARCHFLAGS = - arch x86_64gem 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不兼容0.2。从错误列表生成的过程中,它遇到了struct RObject的定义(用String,Array等填充对象)的一些问题,我追踪到了ruby.h头文件。如果你想使用这个gem,你可以安装rvm,然后键入
rvm install ruby-1.8.7 - with-readline-dir = / opt / local
从这里开始,只需按照宝石作者的指导与上面列出的输入。
更新:gem作者已将talib_ruby与1.9.x兼容,因此不再需要安装1.8.7
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.
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
这篇关于gem install找不到头文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!