kubo / ruby-oci8

Ruby-oci8 - Oracle interface for ruby
Other
169 stars 75 forks source link

Error when building/installing to Ruby 2.5.1 on Windows #200

Closed Petrcha closed 6 years ago

Petrcha commented 6 years ago

Hello, i am trying to build/install oci8 with Ruby 2.5.1 and I am getting an error: mkmf.log: mkmf.log

Could you please advice how to get over this? Thanks, Petr

kubo commented 6 years ago

Use a precompiled ruby-oci8 package if you don't have special need to use customized ruby-oci8.

If you need to build it by yourself, could you edit C:\APPS\Ruby25-x64\lib\ruby\2.5.0\mkmf.rb as follows?

  def try_run(src, opt = "", &b)
    raise "cannot run test program while cross compiling" if CROSS_COMPILING
    if try_link0(src, opt, &b)
      xsystem("./#{CONFTEST}")
    else
      nil
    end
  ensure
    MakeMakefile.rm_f "#{CONFTEST}*"
    # Add the following 7 lines.
    if File.exist? "conftest.exe"
      # conftest.exe wasn't removed by `MakeMekefile.rm_f`.
      # Windows OS preserves a lock to prevent conftest.exe from being removed or modified while it is running.
      # However the lock may remain in short time after it runs due to a slow disk, a virus scanner or so.
      sleep 1 # The lock may be released while sleep.
      File.delete "conftest.exe" # try to remove it again.
    end
    # Add the above 7 lines.
  end

line 24 in mkmf.log:

./conftest

line 40:

C:/APPS/Ruby25-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot open output file conftest.exe: Permission denied

conftest.exe was executed at line 24. Windows OS preserves a lock to prevent conftest.exe from being removed or modified while it is running. The lock is usually released just after it runs. However, I guess, the lock remained at line 40 due to a slow disk, a virus scanner or so.

Petrcha commented 6 years ago

Unfortunately this change is not helpful, but we finally also tested this on real (non-virtual) HW where the problem did not appear and the build succeded. So this issue is only valid on virtual hosts. Regards, Petr