Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gem installing on cygwin but then not available #176

Closed
bradoc opened this issue Oct 16, 2017 · 7 comments
Closed

Gem installing on cygwin but then not available #176

bradoc opened this issue Oct 16, 2017 · 7 comments

Comments

@bradoc
Copy link

bradoc commented Oct 16, 2017

Sorry, this is more of a support request, but maybe there is an issue.

I am trying to deploy a Rails 5 app on Cygwin on a Windows Server 2008 machine.

I have been able to install the latest ruby-oci8 gem (2.2.4.1) but when I run

ruby -e 'require "OCI8"'

I get the following output

/usr/share/ruby/2.3.0/fiddle.rb:47:in `initialize': No such file or directory (LoadError)
	from /usr/share/ruby/2.3.0/fiddle.rb:47:in `new'
	from /usr/share/ruby/2.3.0/fiddle.rb:47:in `dlopen'
	from /usr/share/ruby/2.3.0/Win32API.rb:15:in `initialize'
	from /home/pain-p/.gem/ruby/2.3.0/gems/ruby-oci8-2.2.4.1/lib/oci8/check_load_error.rb:11:in `new'
	from /home/pain-p/.gem/ruby/2.3.0/gems/ruby-oci8-2.2.4.1/lib/oci8/check_load_error.rb:11:in `<module:Util>'
	from /home/pain-p/.gem/ruby/2.3.0/gems/ruby-oci8-2.2.4.1/lib/oci8/check_load_error.rb:4:in `<class:OCI8>'
	from /home/pain-p/.gem/ruby/2.3.0/gems/ruby-oci8-2.2.4.1/lib/oci8/check_load_error.rb:3:in `<top (required)>'
	from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /home/pain-p/.gem/ruby/2.3.0/gems/ruby-oci8-2.2.4.1/lib/oci8.rb:109:in `rescue in <top (required)>'
	from /home/pain-p/.gem/ruby/2.3.0/gems/ruby-oci8-2.2.4.1/lib/oci8.rb:114:in `<top (required)>'
	from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:133:in `require'
	from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
	from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:40:in `require'
	from -e:1:in `<main>'

Is this just a PATH issue? My current PATH is

/home/pain-p/perl5/bin:/usr/local/bin:/usr/bin:/bin:/cygdrive/c/Oracle/instantclient_12_2:/cygdrive/c/Program Files/FileMaker/FileMaker Server/Web Publishing/publishing-engine/php:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Program Files/Windows Imaging:/cygdrive/c/Ruby192/bin

@kubo
Copy link
Owner

kubo commented Oct 16, 2017

Sorry, the real error message was hidden by the LoadError in check_load_error.rb.

First of all, could you run sqlplus? If you have not installed it, install it to c:\Oracle\instantclient_12_2 in advance.
If sqlplus works, could you change /home/pain-p/.gem/ruby/2.3.0/gems/ruby-oci8-2.2.4.1/lib/oci8.rb as follows and try again to get the real error message?

begin
  require so_basename
rescue LoadError, OCIError
#  require 'oci8/check_load_error'    <- Comment this line
#  OCI8::Util::check_load_error($!)   <- Comment this line also
  raise
ensure
  dll_dir.remove if dll_dir
end

@bradoc
Copy link
Author

bradoc commented Oct 16, 2017 via email

@kubo
Copy link
Owner

kubo commented Oct 16, 2017

OK.

Could you check whether "Microsoft Visual C++ 2013 Redistributable Package" is installed on your machine on Friday? Oracle client 12.2 depends on it.
http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/install-instant-client.md#Windows

@bradoc
Copy link
Author

bradoc commented Oct 16, 2017 via email

kubo added a commit that referenced this issue Oct 17, 2017
…o'" on cygwin 2.8 or later.

(related to github issue #176)
@bradoc
Copy link
Author

bradoc commented Oct 20, 2017

Microsoft Visual C++ 2013 Redistributable Package was not installed so I have now done this.

I do not seem to be able to get sqlplus to run. When I run it from the command line I get

The procedure entry point K32GetModuleBaseNameA could not be located in the dynamic link library KERNEL32.DLL

If I make the changes to oci8.rb as requested then I get the following error message on calling ruby -e 'require "OCI8"'

/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require': No such process - /home/pain-p/.gem/ruby/2.3.0/gems/ruby-oci8-2.2.4.1/ext/oci8/oci8lib_230.so (LoadError)
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /home/pain-p/.gem/ruby/2.3.0/gems/ruby-oci8-2.2.4.1/lib/OCI8.rb:107:in `<top (required)>'
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:133:in `require'
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:40:in `require'
        from -e:1:in `<main>'

But I'm not sure this is helpful if sqlplus is not running.

If it is of any help, this machine has had a version of Oracle Instant Client (11.2) installed on it previously. Could this be causing conflicts?

@kubo
Copy link
Owner

kubo commented Oct 20, 2017

Oracle instant client 12.2 doesn't work on Windows Server 2008.
OCI.DLL calls GetModuleBaseName internally. When it is compiled
without -DPSAPI_VERSION=1, it uses K32GetModuleBaseNameA in kernel32.dll.
However the function is available since Windows Server 2008 R2.
Oracle client 12.1 uses GetModuleBaseNameA in psapi.dll. The function is available
since Windows 2000. So Oracle client 12.1 may be available on Windows Server 2008.

@bradoc
Copy link
Author

bradoc commented Oct 20, 2017

Thankyou! I had actually realised that after thinking the error through while you were sending the message.
I have tried installing the gem building against instant client 12.1 and both sqlplus and ruby-oci8 are now working fine! Thankyou for pointing me in the right direction.

@kubo kubo closed this as completed Oct 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants