trouble install ruby-opencv - ruby

I have tried to install ruby-opencv and I can't get it to work.
I am running fedora 15 with rvm using ruby 1.8.7
I have tried this fork as it seems most up to date:
https://github.com/ser1zw/ruby-opencv
I have installed the packages opencv and opencv-devel both of which are version 2.2
When I try to compile the native extensions by running:
ruby extconf.rb
I get the error:
>> check require headers...
checking for core/core_c.h... no
*** extconf.rb failed ***
The mkmf.log file provides this information:
have_header: checking for core/core_c.h... -------------------- no
"gcc -E -I. -I/home/derek/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/x86_64-linux -I. -I/usr
/include -I/usr/local/include -I/usr/local/include/opencv2 -g -O2 -fPIC conftest.c -o conftest.i"
conftest.c:1:25: fatal error: core/core_c.h: No such file or directory
compilation terminated.
checked program was:
/* begin */
1: #include <core/core_c.h>
/* end */
does anyone know how to fix this error?

Did you check where opencv-devel was installed?
This is from the github page:
ruby extconf.rb \
--with-opencv-lib=/opt/local/lib \
--with-opencv-include=/opt/local/include/opencv2
Notice the -I lines on your compilation message, they did not include those locations. So double-check where opencv-devel went to, and fix the locations with the --with-opencv flags.

Related

Chef-solo install - gecode compile error

Im trying to install chef-solo on CentOS 6.3 x64 and when I run:
sudo chef-solo -c /etc/chef/solo.rb -j ~/chef.json -r http://s3.amazonaws.com/chef-solo/bootstrap-latest.tar.gz
I'm getting this output:
g++ -I. -ffast-math -fno-strict-aliasing -O3 -fvisibility=hidden -ggdb -pipe -Wall -Wextra -fPIC -pthread -DNDEBUG \
-c -o gecode/int/extensional.o gecode/int/extensional.cpp
make[1]: Leaving directory `/tmp/chef-solo/gecode-3.5.0'
STDERR: {standard input}: Assembler messages:
{standard input}:13822: Warning: end of file not at end of a line; newline inserted
{standard input}:14946: Error: unknown pseudo-op: `.'
{standard input}:14946: Error: open CFI at the end of file; missing .cfi_endproc directive
g++: Internal error: Killed (program cc1plus)
Please submit a full bug report.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
make[1]: *** [gecode/int/extensional.o] Error 1
make: *** [compilelib] Error 2
---- End output of "bash" "/tmp/chef-script20120904-19809-1ofhwoq" ----
Ran "bash" "/tmp/chef-script20120904-19809-1ofhwoq" returned 2
I can install gecode from the RBEL6 repo without any problems but the cookbook attempts to install from source. I found this pull request on github which attempts to install from the RBEL repo but I got an error saying that the repository metadata couldn't be found. Anyone know what to do?
Since I have been searching for an answer to this, my findings were rather ... unsurprising.
I simply ran out of memory. I had to compile my files on another system with the same OS (copied over /tmp/chef-solo/gecode-3.5.0 to the box and just ran make) and synced the resulting folder back to run make install
Once the library is found the compile step is skipped and you should be good to continue.

capybara-webkit (0.8.0) failed to build on window 7

I am a newbie. I am trying to build capybara-webkit (0.8.0) with native extensions on window 7. I already installed (path set):RubyMine, Ruby SDK and Gems, Rails, DevKit, Qt, gmake, g++. But I still got the following error msg. Any help is greatly appreciated.
$ gem install capybara-webkit -v '0.8.0'
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing capybara-webkit:
ERROR: Failed to build gem native extension.
c:/Ruby193/bin/ruby.exe extconf.rb
c:\Qt\4.8.2\bin\qmake.EXE
c:\make\gmake.EXE
cd src/ && c:/Qt/4.8.2/bin/qmake.exe c:/Ruby193/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.8.0/src/webkit_server.pro -spec c:/Qt/4.8.2/mkspecs/macx-g++ -o Makef\ile.webkit_server
c:\make\gmake.EXE
cd src/ && gmake -f Makefile.webkit_server
gmake[1]: Entering directory `c:/Ruby193/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.8.0/src'
g++ -c -pipe -g -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -Ic:/Qt/4.8.2/mkspecs/macx-g++ -I. -Ic:/Qt/4.8.2/include/QtCore -Ic:/Qt/4.8.2/include/QtNetwork -Ic:/Qt/4.8.2/include/QtGui -Ic:/Qt/4.8.2/include/QtWebKit -Ic:/Qt/4.8.2/include -I. -o RequestedUrl.o RequestedUrl.cpp
process_begin: CreateProcess((null), g++ -c -pipe -g -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -Ic:/Qt/4.8.2/mkspecs/macx-g++ -I. -Ic:/Qt/4.8.2/include/QtCore -Ic:/Qt/4.8.2/include/QtNetwork -Ic:/Qt/4.8.2/include/QtGui -Ic:/Qt/4.8.2/include/QtWebKit -Ic:/Qt/4.8.2/include -I. -o RequestedUrl.o Req
uestedUrl.cpp, ...) failed.
make (e=2): The system cannot find the file specified.
gmake[1]: * [RequestedUrl.o] Error 2
gmake[1]: Leaving directory c:/Ruby193/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.8.0/src'
c:/Ruby193/lib/ruby/1.9.1/fileutils.rb:1515:instat': No such file or directory
- src/webkit_server (Errno::ENOENT)
from c:/Ruby193/lib/ruby/1.9.1/fileutils.rb:1515:in block in fu_each_src_dest'
from c:/Ruby193/lib/ruby/1.9.1/fileutils.rb:1529:infu_each_src_dest0'
from c:/Ruby193/lib/ruby/1.9.1/fileutils.rb:1513:in fu_each_src_dest'
from c:/Ruby193/lib/ruby/1.9.1/fileutils.rb:395:incp'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.8.0/lib/capybara_webkit_builder.rb:33:in build'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.8.0/lib/capybara_webkit_builder.rb:39:inbuild_all'
from extconf.rb:2:in `'
Gem files will remain installed in c:/Ruby193/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.8.0 for inspection.
Results logged to c:/Ruby193/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.8.0/./gem_make.out
I was getting similar errors to this, as well as errors such as:
g++.exe: unrecognized option '-headerpad_max_install_names'
make[1]: Leaving directory /ruby/gems/shared/gems/capybara-webkit-0.12.1/src'
Errno::ENOENT: No such file or directory - C:/JRuby/lib/ruby/gems/shared/gems/capybara-webkit-0.12.1/src/webkit_server
LoadError: no such file to load
No such file or directory - C:/Ruby/capybara-webkit-0.12.1/src/webkit_server
Basically the answer to all these errors is to do with the version of capybara-webkit that you install on Windows depending on exactly the right versions of QT, and the right version of the g++ compiler included in mingw toolset. The right versions have to be installed and the correct bin directories added to your windows path.
Plus, there are issues with RbConfig::CONFIG['host_os'] which on windows 8 returns "mswin32" and not "mingw32". Therefore you have to fix capybara_webkit_builder.rb and spec_helper.rb to the following: /mingw32|mswin32/. If you don't do this then you will run macx-g++ which won't work on windows. You have to run win32-g++ on windows.
If you're using JRuby, then the RUBY_PLATFORM is set to "java". Therefore you have to change corresponding capybara_webkit_builder.rb and connection.rb to /mingw32|java/. If you don't do this, then the binary will compile (but with a bug in connection) but the compiler will crash out with the can't find the webkit-server error.
You have to follow the install script at https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit
At the final instruction on windows, you have to "cd" to the gem directory and then run
bundle exec gem install capybara-webkit-0.12.1.gem
or whichever version you have built.
So, the answers are get all the right versions of each dependency, fix the bugs, ensure the windows path variable points to the right versions of g++ compilers (don't forget to restart cmd after you've changed the path variable) and then ensure you're in the right directory when you run commands.

RVM: trouble installing libyaml package on Snow Leopard

I'm using RVM 1.13.4 on Mac OS 10.6.8, with XCode 3.2.6. The upgrade to Snow Leopard was fairly recent, and I believe that's when I started having this problem.
When I run rvm pkg install libyaml, I get the following error:
Fetching yaml-0.1.4.tar.gz to /Users/tsherif/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/tsherif/.rvm/src
Prepare yaml in /Users/tsherif/.rvm/src/yaml-0.1.4.
Configuring yaml in /Users/tsherif/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/tsherif/.rvm/src/yaml-0.1.4.
Error running 'make ', please read /Users/tsherif/.rvm/log/yaml/make.log
Database file /Users/tsherif/.rvm/config/packages does not exist.
Not sure what the story is with config/packages. The make.log file contains the following:
[2012-05-06 05:37:14] make
make all-recursive
Making all in include
make[2]: Nothing to be done for `all'.
Making all in src
/bin/sh ../libtool --tag=CC --mode=compile /usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I.. -I../include -g -O2 -MT api.lo -MD -MP -MF .deps/api.Tpo -c -o api.lo api.c
../libtool: line 787: X--tag=CC: command not found
../libtool: line 820: libtool: ignoring unknown tag : command not found
../libtool: line 787: X--mode=compile: command not found
../libtool: line 953: *** Warning: inferring the mode of operation is deprecated.: command not found
../libtool: line 954: *** Future versions of Libtool will require --mode=MODE be specified.: command not found
../libtool: line 984: libtool: warning: cannot infer operation mode from `/usr/bin/gcc-4.2': No such file or directory
../libtool: line 7011: libtool: you must specify a MODE: command not found
../libtool: line 7012: Try `libtool --help' for more information.: command not found
make[2]: *** [api.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
It seems like the shell is trying to execute arguments to libtool as commands before passing them to libtool? The commands aren't found so the string command not found is passed to libtool, which then spews out a bunch of error output that sh tries to execute and, of course, fails to do. Does it maybe have something to do with the Xs that seem to be added to the --tag and --mode options? That's my best guess, anyway, given my limited understanding of libtool and make.
I've tried adding the following options, based on similar questions I've seen on SO, but to no avail:
--with-gcc=clang
--enable-shared
I've also tried installing libyaml separately (without RVM) using both MacPorts and compiling from source, but neither worked. And oddly enough, if I install Psych as a gem after installing Ruby, there's no problem (but I do want it compiled with Ruby).
Have you tried installing with Homebrew? It makes most dependency packages very easy to install, then run brew install libyaml.

NoMethodError: undefined method `name' for "RedCloth":String and can't run make due to ruby/config.h error

I tried the steps in Problems with the rails console, RVM and readline because when I try to run rails or rails console I get a NoMethodError: undefined method `name' for "RedCloth":String
When I try following the steps in the other posts I get a error doing the make because I get
durrantm#michael-laptop:~/.rvm/src/ruby-1.9.2-p180/ext/readline$ make install
gcc -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -DHAVE_READLINE_READLINE_H -DHAVE_READLINE_HISTORY_H -DHAVE_RL_GETC_FUNCTION -DHAVE_RL_FILENAME_COMPLETION_FUNCTION -DHAVE_RL_USERNAME_COMPLETION_FUNCTION -DHAVE_RL_COMPLETION_MATCHES -DHAVE_RL_REFRESH_LINE -DHAVE_RL_DEPREP_TERM_FUNCTION -DHAVE_RL_COMPLETION_APPEND_CHARACTER -DHAVE_RL_BASIC_WORD_BREAK_CHARACTERS -DHAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS -DHAVE_RL_BASIC_QUOTE_CHARACTERS -DHAVE_RL_COMPLETER_QUOTE_CHARACTERS -DHAVE_RL_FILENAME_QUOTE_CHARACTERS -DHAVE_RL_ATTEMPTED_COMPLETION_OVER -DHAVE_RL_LIBRARY_VERSION -DHAVE_RL_EDITING_MODE -DHAVE_RL_LINE_BUFFER -DHAVE_RL_POINT -DHAVE_RL_EVENT_HOOK -DHAVE_RL_CATCH_SIGWINCH -DHAVE_RL_CATCH_SIGNALS -DHAVE_RL_CLEANUP_AFTER_SIGNAL -DHAVE_RL_CLEAR_SIGNALS -DHAVE_RL_SET_SCREEN_SIZE -DHAVE_RL_GET_SCREEN_SIZE -DHAVE_RL_VI_EDITING_MODE -DHAVE_RL_EMACS_EDITING_MODE -DHAVE_REPLACE_HISTORY_ENTRY -DHAVE_REMOVE_HISTORY -DHAVE_CLEAR_HISTORY -I/home/durrantm/.rvm/usr/include -D_FILE_OFFSET_BITS=64 -fPIC -fno-strict-aliasing -g -g -O2 -fPIC -c readline.c
readline.c:22: fatal error: **ruby/config.h**: No such file or directory
compilation terminated.
make: *** [readline.o] Error 1
fyi:
durrantm#michael-laptop:~/.rvm/src/ruby-1.8.7-p334/ext/readline$ ruby extconf.rb && make install
checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... no
checking for editline/readline.h... no
make: Nothing to be done for `install'.
durrantm#michael-laptop:~/.rvm/src/ruby-1.8.7-p334/ext/readline$
I had the same problem.
If you're using Fedora, you might want to install readline-devel. That should let you find readline.h, etc.
When you create your Makefile, use this:
rvm 1.9.2 ruby extconf.rb
instead of just:
ruby extconf.rb

Compile postgres ruby gem against libpq.a on 10.6.7

I'm trying to install the ruby pg gem using a custom compiled postgres 8.4.7. This works as expected:
sudo env ARCHFLAGS='-arch x86_64' gem install pg -- --with-pg-config=/path/to/my/pg_config
The gem compiles and installs correctly, and when required it loads the right dynamic library.
However, I'd like to statically link the gem for portability on multiple machines. My most reasonable attempt:
sudo env ARCHFLAGS='-arch x86_64' gem install pg -- --with-pg-config=/path/to/my/pg_config --with-ldflags='-static'
fails with this error message:
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with-pg-config=/[edited]/pgsql-8.4.7/bin/pg_config --with-ldflags=-static
checking for /[edited]/pgsql-8.4.7/bin/pg_config... yes
MacOS X build: fixing architecture flags:
using the value in ARCHFLAGS environment variable ("-arch x86_64").
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
Any suggestion?
Thanks!
Update:
From the mkmf.log file:
conftest.c: In function ‘t’:
conftest.c:5: error: too few arguments to function ‘PQconnectdb’
checked program was:
/* begin */
1: #include
2:
3: /*top*/
4: int main() { return 0; }
5: int t() { PQconnectdb(); return 0; }
/* end */
Solved:
Copy Postgres static libraries to a separate location from the [prefix]/lib dir and pass the new path explicitly when building the gem:
sudo env ARCHFLAGS='-arch x86_64' gem install pg -- --with-pg-config=/path/to/my/pg_config --with-pg-lib=/path/to/static/libs
Details:
The crucial information was a bit up in the mkmf.log file:
"gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/[edited]/pgsql-9.0.3/include -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -static -L/[edited]/pgsql-9.0.3/lib -lruby -lpq -lpthread -ldl "
ld: library not found for -lcrt0.o
collect2: ld returned 1 exit status
Passing the '-static' flag to the linker was trying to create a completely statically linked binary, which is not supported under Mac OS X:
Static linking of user binaries on Mac OS X

Resources