Closed zetetic closed 8 years ago
@zetetic
Could you send strace.log
created by the following command to kubo@jiubao.org?
$ strace -o strace.log ruby -e 'require "oci8"'
In strace.log:
--- Process 3624 loaded C:\Ruby200\bin\msvcrt-ruby200.dll at 0000000066780000
...
--- Process 3624 loaded C:\Ruby200\lib\ruby\2.0.0\i386-mingw32\enc\encdb.so at 0000000071280000
--- Process 3624 loaded C:\Ruby200\lib\ruby\2.0.0\i386-mingw32\enc\iso_8859_1.so at 0000000070600000
--- Process 3624 loaded C:\Ruby200\lib\ruby\2.0.0\i386-mingw32\enc\trans\transdb.so at 000000006DD40000
--- Process 3624 loaded C:\Ruby200\lib\ruby\2.0.0\i386-mingw32\enc\utf_16le.so at 0000000065480000
--- Process 3624 loaded C:\Ruby200\lib\ruby\2.0.0\i386-mingw32\enc\trans\utf_16_32.so at 000000006D400000
What types of rubies did you install?
Did you use mingw32 ruby on cygwin?
IMO, you compiled oci8lib_200.so
for cygwin ruby. However you used it with mingw32 ruby.
Could you run the following command?
ldd <path_to_gems>/gems/ruby-oci8-2.2.1/lib/oci8lib_200.so
If the command output includes cygwin1.dll => /usr/bin/cygwin1.dll
, it was compiled for cygwin ruby.
Oops, you're right, that was run with an older Ruby inadvertently. I've sent another log run from the Cygwin ruby.
Could you get strace.log
by strace -o strace.log ruby -e "require 'oci8'"
instead of strace -o strace.log ruby -e 'require "oci8"'
and send me again?
68 30894 [main] ruby 3756 build_argv: argv[0] = 'C:\cygwin\home\ZBacker\.rbenv\versions\2.0.0-p247\bin\ruby'
22 30916 [main] ruby 3756 build_argv: argv[1] = '-e'
22 30938 [main] ruby 3756 build_argv: argv[2] = 'require oci8'
21 30959 [main] ruby 3756 build_argv: argc 3
The second argument is require oci8
. The double quotation marks enclosing oci8
disappeared.
IMO, strace dropped double quotation marks inside arguments and you got the following error.
-e:1:in `<main>': undefined local variable or method `oci8' for main:Object (NameError)
So after several rounds of email I think we finally figured out that this was due to a couple of configuration issues with the Cygwin installation:
We added the Instant Client folder to the path, and installed the Microsoft Visual C++ 2010 Redistributable Package (x64), and now it works.
I confess I'd never seen an error where Ruby failed to load a compiled object file (in this case, oci8lib_200.so). The LoadError message "no such file or directory" is somewhat misleading in this case, since the error is due to a dependency of oci8lib_200.so, not the file itself.
Thanks again to @kubo for some great work digging into this and coming up with an answer.
The title may be somewhat misleading. To elaborate, I was unable to install version 2.2.1 from Rubygems on Cygwin. I noticed that there were some fixes in master related to Cygwin, so to experiment I did the following:
Step 4 appears to properly build the native extensions and install correctly. However requiring the gem fails:
$ ruby -e 'require "oci8"'
with the message
No such file or directory - <path_to_gems>/gems/ruby-oci8-2.2.1/lib/oci8lib_200.so (LoadError)
but the file 'oci8lib_200.so' is in fact present at the specified location.
I'm at a loss here. Any suggestions?