如何让 ruby-svm 在 macports 中查找库? /选择/本地?
我想安装 Ruby SVM。我已经有了正常设置的 macports,并通过端口安装了 libsvm 就好了。但是当我去编译 rubysvm 时,它就崩溃了。 :(
Ruby SVM:http://rubysvm.cilibrar.com/download/(大多数链接是404虽然) libsvm: http://www.csie.ntu.edu.tw/~cjlin /libsvm/
试试这个:
sudo port install libsvm
wget http://debian.cilibrar.com/debian/pool/main/libs/libsvm-ruby/libsvm-ruby_2.8.4.orig.tar.gz
tar -xzf libsvm-ruby_2.8.4.orig.tar.gz
cd libsvm-ruby-2.8.4
./configure
... 然后你会得到错误:
...
checking libsvm/svm.h usability... no
checking libsvm/svm.h presence... no
checking for libsvm/svm.h... no
Error, cannot find LIBSVM svm.h header.
我已经尝试过这个,但没有成功:
export DYLD_LIBRARY_PATH=/opt/local/include/:/opt/local/lib/
(... ditto for C_INCLUDE_PATH, LD_LIBRARY_PATH, CPATH, & LIBRARY_PATH)
LDFLAGS="-I/opt/local/include -L/opt/local/lib" CPPFLAGS="-I/opt/local/include -L/opt/local/lib" ./configure
如何解决这个问题?
I want to install Ruby SVM. I already have macports with normal settings, and installed libsvm via port just fine. But when I go to compile rubysvm, it barfs. :(
Ruby SVM: http://rubysvm.cilibrar.com/download/ (most links are 404 though)
libsvm: http://www.csie.ntu.edu.tw/~cjlin/libsvm/
Try this:
sudo port install libsvm
wget http://debian.cilibrar.com/debian/pool/main/libs/libsvm-ruby/libsvm-ruby_2.8.4.orig.tar.gz
tar -xzf libsvm-ruby_2.8.4.orig.tar.gz
cd libsvm-ruby-2.8.4
./configure
... and you get the error:
...
checking libsvm/svm.h usability... no
checking libsvm/svm.h presence... no
checking for libsvm/svm.h... no
Error, cannot find LIBSVM svm.h header.
I've tried this, without success:
export DYLD_LIBRARY_PATH=/opt/local/include/:/opt/local/lib/
(... ditto for C_INCLUDE_PATH, LD_LIBRARY_PATH, CPATH, & LIBRARY_PATH)
LDFLAGS="-I/opt/local/include -L/opt/local/lib" CPPFLAGS="-I/opt/local/include -L/opt/local/lib" ./configure
How do I fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
libsvm-ruby 假定 libsvm 将其标头安装在
PREFIX/include/libsvm/svm.h
中,但 macports 包将其放在/opt/local/include
中。这是一个拼凑,但最简单的解决方法是手动创建目录
/opt/local/include/libsvm
并将svm.h
标头移动/复制到那里。您可能仍然需要使用 LDFLAGS 和 CPPFLAGS 设置运行配置命令,因为 macports 安装看起来不会更新 pkg-config(libsvm-ruby 使用它来尝试查找编译器标志)。我会将其作为包错误报告给 macports 维护者。如果您了解 macport 的端口文件,您甚至可以提供补丁。
更新:我还没有真正尝试过这个,所以一旦你通过了头文件检测,可能还会出现其他问题。
更新 2:我能够通过配置:
但 libsvm-ruby 似乎依赖于 obstack.h,它在 OS X 上本机不存在。基于 这个,可能有一种方法可以复制您需要的文件,但您需要修补 libsvm-ruby main.cpp和 Makefile 来链接它。
祝你好运!
libsvm-ruby assumes libsvm installs its header in
PREFIX/include/libsvm/svm.h
, but the macports package puts it in/opt/local/include
.It's a kludge, but the easiest fix is to manually make the directory
/opt/local/include/libsvm
and move/copy thesvm.h
header there. You may still need to run your configure command with the LDFLAGS and CPPFLAGS settings since it looks like the macports install doesn't update pkg-config (which libsvm-ruby uses to try to find the compiler flags).I'd report this as a package bug to the macports maintainer. If you understand macport's Portfiles, you can probably even provide a patch.
Update: I haven't actually tried this, so there may be other issues once you get past the header file detection.
Update 2: I was able to get past configure with:
But libsvm-ruby appears to depend on obstack.h, which doesn't exist natively on OS X. Based on this, there might be a way to copy in the files that you need, but you'll need to patch the libsvm-ruby main.cpp and Makefile to link that in.
Good luck!