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

Tiny_TDS doesn't include pre-compiled native gems for x64 Ruby on Windows. #323

Closed
edward-ellis opened this issue Dec 2, 2016 · 27 comments

Comments

@edward-ellis
Copy link

I am using Tiny TDS on Windows 10 with Ruby 2.1.7 x64. All my gems work except tiny_tds. If I switch to the x86 version of Ruby all is well. Do you intend to support x64 Ruby versions on Windows?

@edward-ellis
Copy link
Author

If you don't intend to support x64, at least indicate that in the README.

@metaskills
Copy link
Member

metaskills commented Dec 2, 2016

It was my understanding that we always supported 64-bit windows for all Ruby versions we support including 2.1. Till recently we had builds on Appveyor for multiple x64 versions. Even tho only one remains (for 2.3) the others should still work fine.

Could you investigate a bit more and let me know what you find.

@coderjoe
Copy link
Contributor

coderjoe commented Dec 2, 2016

When working on PR #322 I could have sworn I saw it building x64 binaries.

@metaskills
Copy link
Member

You did!

@edward-ellis
Copy link
Author

Ok, I don't really understand the internal workings of installing gems. All I know is that only the .so version gets installed. Can you give me some guidance on how to gather information that would be useful to you?

@metaskills
Copy link
Member

Sure, maybe start with a few things and we can go from there.

  • What version of TinyTDS are you using? Do have the same problem with other versions?
  • For the version you are having issues with, if you bundle open the gem, what do you see in the lib/tiny_tds dir?

@edward-ellis
Copy link
Author

I am using tiny_tds_1.0.5-x64-mingw32. I haven't other versions yet today. In the lib/tiny_tds dir I see:

  • bin.rb
  • client.rb
  • error.rb
  • result.rb
  • version.rb
  • 2.0
    -- tiny_tds.so
  • 2.1
    -- tiny_tds.so
  • 2.2
    -- tiny_tds.so
  • 2.3
    -- tiny_tds.so

@edward-ellis
Copy link
Author

I have installed 1.0.3 and 1.0.0 and get the same results. For bundle open I still only get the tiny_tds.so.

@coderjoe
Copy link
Contributor

coderjoe commented Dec 3, 2016

Each of those are libraries cross compiled for the windows architecture and runtime in their gem package name. As an example here's a file inspection from my recent testing build:

coderjoe@pulsar:public/tiny_tds/pkg[openssl-1.0.2j]% ls
tiny_tds-1.0.6/     tiny_tds-1.0.6-x64-mingw32/     tiny_tds-1.0.6-x86-mingw32/
tiny_tds-1.0.6.gem  tiny_tds-1.0.6-x64-mingw32.gem  tiny_tds-1.0.6-x86-mingw32.gem
coderjoe@pulsar:public/tiny_tds/pkg[openssl-1.0.2j]% file tiny_tds-1.0.6-x64-mingw32/lib/tiny_tds/2.3/tiny_tds.so 
tiny_tds-1.0.6-x64-mingw32/lib/tiny_tds/2.3/tiny_tds.so: PE32+ executable (DLL) (console) x86-64, for MS Windows
coderjoe@pulsar:public/tiny_tds/pkg[openssl-1.0.2j]% file tiny_tds-1.0.6-x86-mingw32/lib/tiny_tds/2.3/tiny_tds.so 
tiny_tds-1.0.6-x86-mingw32/lib/tiny_tds/2.3/tiny_tds.so: PE32 executable (DLL) (console) Intel 80386, for MS Windows
coderjoe@pulsar:public/tiny_tds/pkg[openssl-1.0.2j]%

What problem are you experiencing that led you to investigate these binaries?

@coderjoe
Copy link
Contributor

@edward-ellis can you provide any extra information?

@edward-ellis
Copy link
Author

Yes, I found it confusing that the DLLs were given a Linux suffix, but I suppose that is just a convenience for the developers. I also started asking questions on gitter.im and @coderjoe suggested that this is the same problem as issue #310. It certainly sounds like the "tiny_tds.so not a valid win32 application" part of that issue. They were suggesting that version 1.0.6 might fix that issue, but that has yet to be released.

@metaskills
Copy link
Member

Once #324 is resolved, I plan to release v1.1 using the new versions of all the good things. I really do help this helps.

@metaskills
Copy link
Member

Just wanted to report, I am seeing the same issue on the adapter tests in Appveyor which use the Windows pre-compiled gems. The -x64 Ruby versions shows this error for v1.0.5 of TinyTDS

`require': cannot load such file -- tiny_tds/tiny_tds (LoadError)

I did find that v1.0.4 did seems to work so I think this is an issue with v1.0.5.

@coderjoe
Copy link
Contributor

coderjoe commented Dec 20, 2016

@metaskills that sounds a lot like the invalid win32 executable problem my PR tries to address. You can verify this on appveyor by running the build and enabling RDP via: https://www.appveyor.com/docs/how-to/rdp-to-build-worker/

If you log into the instance you can verify the problem is the same by testing to make sure tiny_tds can be required if it is the only required gem, but it will likely fail if yaml (or psych.so) are loaded first.

If it matches, there's a good chance that my already merged PR will solve your problem. You can also try testing with the tiny_tds_coderjoe gem which I used for testing and plan to yank once 1.0.6 or 1.1.0 are out.

@metaskills
Copy link
Member

I just released v1.1.0 (thanks @coderjoe) and it appears to fix the x64 issues on Appveyor. Please confirm it helps here too.

@arbesulo
Copy link

arbesulo commented Dec 21, 2016

I have just updated to v1.1.0 and I'm getting "the specified module could not be found tiny_tds.so" when requiring tiny_tds/2.3/tiny_tds

The problem does not arise with 1.0.4

@coderjoe
Copy link
Contributor

@arbesulo please use require 'tiny_tds' it will make sure to load the appropriate library for your ruby version for you.

@arbesulo
Copy link

That's what I'm doing. I just pointed where the error happens, because it is shadowed by the rescue LoadError 2 lines below.

@coderjoe
Copy link
Contributor

@arbesulo would you mind providing the full stacktrace as well as a reproduction and your machine's architecture? Thanks. :)

@arbesulo
Copy link

arbesulo commented Jan 6, 2017

Now it works... which is of course good, but I don't know why I was getting the error when I installed v1.0.5 the first time

@stibra
Copy link

stibra commented Jan 10, 2017

I have the same error "LoadError: cannot load such file -- tiny_tds/tiny_tds", with x64 Ruby 2.2.3 and tiny_tds 1.1.0.
Same problem also with 32-bit version:
LoadError: 126: The specified module could not be found. - C:/Ruby200/lib/ruby/gems/2.3.0/gems/tiny_tds-1.1.0-x86-mingw32/lib/tiny_tds/2.3/tiny_tds.so

@Jonny-B
Copy link

Jonny-B commented Jan 31, 2017

Any updates on this? I am seeing this too. Just updated to x32 Ruby 2.2.3 and tiny_tds 1.1.0

cannot load such file -- tiny_tds/tiny_tds (LoadError)
C:/Ruby23/Ruby23/lib/ruby/gems/2.3.0/gems/tiny_tds-1.1.0-x86-mingw32/lib/tiny_tds.rb:22:in require' C:/Ruby23/Ruby23/lib/ruby/gems/2.3.0/gems/tiny_tds-1.1.0-x86-mingw32/lib/tiny_tds.rb:22:in rescue in <top (required)>'
C:/Ruby23/Ruby23/lib/ruby/gems/2.3.0/gems/tiny_tds-1.1.0-x86-mingw32/lib/tiny_tds.rb:25:in `<top (required)>'

EDIT: Alright. I rolled back to version tiny_tds 1.0.4 and that seemed to clear up the issue.
EDIT: Brought it up to v 1.0.5 and that also works. Whatever the problem it seems to be only with 1.1.0

@coderjoe
Copy link
Contributor

coderjoe commented Feb 3, 2017

@stibra and @Jonny-B can you please update with your operating system versions and architectures please?

I am still looking at this when I have time, but that's only a few moments on occasional weekends as is. Outside investigation and PRs are welcome.

@stibra
Copy link

stibra commented Feb 3, 2017 via email

@stibra
Copy link

stibra commented Feb 14, 2017

Any news on this issue?

@coderjoe
Copy link
Contributor

@stibra I appreciate the question. I'm still looking into this in my free time, but it's not currently related to any roadmap items at my company so I only have an hour or two every few weekends of free time to expend. I intend to keep moving along but my time is extremely limited right now.

If anybody needs this fixed faster PRs are, as always, very welcome. :)

metaskills pushed a commit that referenced this issue Mar 12, 2017
* Use OpenSSL v1.1.0e & FreeTDS v1.00.27 for Windows builds.
* Adapt dll names to 1.1.0 scheme
 - libeay -> libcrypto
 - ssleay -> libssl
* Use perl in Git installation for openssl
* OpenSSL Requires Perl >= 5.10, while the Ruby devkit uses MSYS1 with Perl 5.8.8. To overcome this, prepend Git's usr/bin to the PATH. It has MSYS2 with a recent version of perl.
* MinGW: Fix inet_pton also for 32-bit
@metaskills
Copy link
Member

Pull Request #347 pulled in OpenSSL v1.1.0 and we got new versions of TinyTDS at v1.2.0 which should solve this issue. Please reply back and let us know.

aharpervc pushed a commit to aharpervc/tiny_tds that referenced this issue Apr 9, 2020
…qlserver#310 rails-sqlserver#290 rails-sqlserver#349 rails-sqlserver#323 rails-sqlserver#330

* Use OpenSSL v1.1.0e & FreeTDS v1.00.27 for Windows builds.
* Adapt dll names to 1.1.0 scheme
 - libeay -> libcrypto
 - ssleay -> libssl
* Use perl in Git installation for openssl
* OpenSSL Requires Perl >= 5.10, while the Ruby devkit uses MSYS1 with Perl 5.8.8. To overcome this, prepend Git's usr/bin to the PATH. It has MSYS2 with a recent version of perl.
* MinGW: Fix inet_pton also for 32-bit
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

6 participants