How do I get ruby-svm to search libraries in macports' / opt / local?

I want to install Ruby SVM. I already have macports with normal settings, and I installed libsvm through the port. But when I am going to compile rubysvm, it is mesmerizing. :(

Ruby SVM: http://rubysvm.cilibrar.com/download/ (most links are 404) libsvm: http://www.csie.ntu.edu.tw/~cjlin/libsvm/

Try the following:

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 an error message:

 ... 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 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 to fix it?

+4
source share
1 answer

libsvm-ruby assumes libsvm sets the header to PREFIX/include/libsvm/svm.h , but the macports package puts it in /opt/local/include .

This is kludge, but the easiest solution is to manually create the /opt/local/include/libsvm and move / copy the svm.h header there. You still have to run configure with the LDFLAGS and CPPFLAGS settings, since it seems that installing macports does not update pkg-config (which uses libsvm-ruby to search for compiler flags).

I would report this as a package error for a supporting macports. If you understand macport Portfiles, you may even be able to provide a patch.

Update : I have not actually tried this, so there may be other problems after you pass the header file check.

Update 2 . I was able to complete the setup with:

 sudo mkdir /opt/local/include/libsvm sudo cp /opt/local/include/svm /opt/local/include/libsvm/ CPPFLAGS=-I/opt/local/include LIBS=-L/opt/local/lib ./configure 

But libsvm-ruby seems to depend on obstack.h, which does not exist on OS X. Based on this , there may be a way to copy the files you need, but you will need to fix libsvm-ruby main.cpp and Makefile so that tie it up.

Good luck

+1
source

Source: https://habr.com/ru/post/1300131/


All Articles