Open aharpervc opened 7 years ago
@metaskills I'm at the point where I have officially been swayed. I feel like we do need to do version sniffing and automatically require 'devkit'
in the gem. If @aharpervc (who knows the project very well) can't make it work without guidance, I don't think we can expect the average random windows ruby developer to figure it out either.
I'm very welling to review PRs to fix this as well as give the PR a try if it sticks around until next weekend.
I can hack it for myself with require devkit
, as mentioned in the last thread, but since that isn't good/safe, I'm out of ideas.
It may also simply be an environment configuration requirement. Perhaps the solution isn't changes to the code, but something in the readme? (Although I myself do not know exactly what that configuration would be...)
Until a solution is created, you need to require 'devkit'
in your rails app before the rails app is bootstrapped and therefore before tiny_tds is required.
Edit: Either that or edit your path/environment variables so devkit is always loaded.
I can deal with that. However, it's still unclear to me what devkit is changing to make library loading work. It's changing the ENV PATH
right? So some feature of devkit resides in it's own folder, added to the PATH, and now library loading is working. Is there a way to discover whatever that is, and load it selectively, without changing the PATH?
@aharpervc unfortunately no. Because of how devkit works its dependent on the user's choice of installation directory. That's why the devkit shim exists, to modify a ton of environment variables all at once if your project needs to use devkit.
If you'd like to learn more I'm happy to discuss it, but I'd rather do that via gitter than in this issue.
@aharpervc and @coderjoe thanks for the tip on using require 'devkit'
in the application. I put it between require 'rails/all'
and Bundler.require(*Rails.groups)
in my config/application.rb
and it seems to work around this issue.
I had been hacking tiny_tds.rb, before it tries to load the native library, but hypothetically any time before require 'tiny_tds'
should work.
Is there a fix for this, we are using OCRA to create a binary and this doesn't seem to work with the require 'devkit'
fix.
Adding a comment. You may want to look at my findings for Ruby 2.4 + on https://github.com/rails-sqlserver/tiny_tds/issues/416. Try reinstalling the gem with:
gem install --platform ruby tiny_tds
Is there a fix for this, we are using OCRA to create a binary and this doesn't seem to work with the
require 'devkit'
fix.
Did you ever solve this?
@meric426
See my comment directly above yours. #416 documents how using --platform ruby
corrects the issue.
@meric426
See my comment directly above yours. #416 documents how using
--platform ruby
corrects the issue.
@JohnAtFenestra I can get the script running. But trying to package it into a .exe
with OCRA doesn't work
If tiny_tds runs from a script but not after packaging, then I'd say you have an issue with Ocra packaging rules. Without seeing your error, my guess is that Ocra isn't dealing with the issues that --platform ruby
resolves. If you look at my notes on #416, you'll see that the .so files existed in the correct locations, however, for whatever reason, tiny_tds still didn't work. Building the extensions with --platform ruby
resolved them, but I didn't dig deeper into why.
Good luck!
EDIT: I looked at Ocra's documentation. What happens if you build your executable with the --gem-full
option?
Hi Team,
I am facing same error message when I require 'tiny_tds' in my code. LoadError: cannot load such file -- tiny_tds/tiny_tds
My ruby version is Ruby30-x64. Also I have installed tiny_tds using below command: gem install tiny_tds -v '2.0.0'
Please help me to resolve my issue.Thanks
@meric426 Have you managed to solve your issue with tiny_tds and ocra?
If someone would like to take a look at the issue, I've made minimal reproduction example here:
@meric426 Have you managed to solve your issue with tiny_tds and ocra?
Nah, abandoned that project a long time ago
Thank you for your response.
Would one of the maintainers be willing to provide paid support for that issue? (I'd have to ask about the details, but it would be possible) If the setup part sound too intimidating (Windows, I know...), we could also pair-program the issue on my machine. Feel free to contact me through the e-mail on my github profile.
I've figured this out. The problem was missing dlls
, in the previous tiny_tds version I've used (1.3.0) they were included, in 2.1.5 they were not and ocra didn't include them. That should be I guess expected (not ocra's fault), it's just that the error message is cryptic and doesn't provide good entrypoint for debugging.
I've figured out which libraries were missing by using procmon tool as described here: https://github.com/larsch/ocra/issues/174#issuecomment-1112104881
It turned out I was missing following dlls:
The first one (libiconv) is included in ruby 2.6 installation. The rest of them I took from tiny_tds
1.3.0 gem (ports
directory). The ones from tiny_tds 1.3.0 I've put in my ruby 2.6 bindir (C:/Ruby26/bin
), and I've added following options to ocra command:
--dll ruby_builtin_dlls/libiconv-2.dll --dll libsybdb-5.dll --dll libcrypto32-1.1.0e-i686-w64-mingw32.dll --dll libssl32-1.1.0e-i686-w64-mingw32.dll
Before submitting an issue please check these first!
$ tsql -C
to find out.tsql -C
does not produce any output, but the folder path thattsql
in implies freetds 1.00.27If none of these help. Please fill out the following:
Environment
Operating System
Please describe your operating system and version here.
TinyTDS Version and Information
FreeTDS Version
Please provide your system's FreeTDS version. If you are using the pre-compiled windows gem you may omit this section.
Description
Please describe the bug or feature request here.
I am not able to use TinyTds 2.1.0 on Ruby 2.3.3. The gem appears to install fine, but when I try to require it, I get the error
LoadError: cannot load such file -- tiny_tds/tiny_tds
.It looks like this, followed by more stack trace:
Since we have apparently not dropped support for ruby 2.3.3, I would like to figure out what is going on.