无法在 Windows 10 中安装tiny_tds

Mat*_*dro 3 ruby rubygems ruby-on-rails freetds tiny-tds

当我跑步时:

\n
gem install tiny_tds\n
Run Code Online (Sandbox Code Playgroud)\n

输出告诉我我需要安装 FreeTDS。接下来,它向我展示了一些配置选项,我可能需要一个选项。选项如下:

\n
    --with-opt-dir\n    --without-opt-dir\n    --with-opt-include\n    --without-opt-include=${opt-dir}/include\n    --with-opt-lib\n    --without-opt-lib=${opt-dir}/lib\n    --with-make-prog\n    --without-make-prog\n    --srcdir=.\n    --curdir\n    --ruby=C:/Ruby31-x64/bin/$(RUBY_BASE_NAME)\n    --help\n    --with-freetds-dir\n    --without-freetds-dir\n    --with-freetds-include\n    --without-freetds-include=${freetds-dir}/include\n    --with-freetds-lib\n    --without-freetds-lib=${freetds-dir}/lib\n    --with-sybdb-dir\n    --without-sybdb-dir\n    --with-sybdb-include\n    --without-sybdb-include=${sybdb-dir}/include\n    --with-sybdb-lib\n    --without-sybdb-lib=${sybdb-dir}/lib\n    --with-sybdblib\n    --without-sybdblib\n    --with-sybdblib\n    --without-sybdblib\n
Run Code Online (Sandbox Code Playgroud)\n

问题是所有选项都不起作用。Here\xc2\xb4s 是所发生情况的示例:

\n
C:\\RailsApps>gem install tiny_tds -- --with-freetds-dir\nTemporarily enhancing PATH for MSYS/MINGW...\nUsing msys2 packages: mingw-w64-ucrt-x86_64-freetds\nBuilding native extensions with: '--with-freetds-dir'\nThis could take a while...\nERROR:  Error installing tiny_tds:\n        ERROR: Failed to build gem native extension.\n\n    current directory: C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/tiny_tds-2.1.5/ext/tiny_tds\n    C:/Ruby31-x64/bin/ruby.exe -I C:/Ruby31-x64/lib/ruby/3.1.0 -r ./siteconf20220308-11104- \n    42q9r4.rb extconf.rb --with-freetds-dir\n*** extconf.rb failed ***\nCould not create Makefile due to some reason, probably lack of necessary\nlibraries and/or headers.  Check the mkmf.log file for more details.  You may\nneed configuration options.\n\nProvided configuration options:\n        --with-opt-dir\n        --without-opt-dir\n        --with-opt-include\n        --without-opt-include=${opt-dir}/include\n        --with-opt-lib\n        --without-opt-lib=${opt-dir}/lib\n        --with-make-prog\n        --without-make-prog\n        --srcdir=.\n        --curdir\n        --ruby=C:/Ruby31-x64/bin/$(RUBY_BASE_NAME)\n        --help\n        --with-freetds-dir\nC:/Ruby31-x64/lib/ruby/3.1.0/mkmf.rb:1807:in `dir_config': undefined method `split' for true:TrueClass (NoMethodError)\n\n      defaults = Array === dir ? dir : dir.split(File::PATH_SEPARATOR)\n                                          ^^^^^^\n        from extconf.rb:56:in `<main>'\nlooking for freetds headers in the following directories:\n - /opt/local/include\n - /opt/local/include/freetds\n - /usr/local/include\n - /usr/local/include/freetds\nlooking for freetds library in the following directories:\n - /opt/local/lib\n - /opt/local/lib/freetds\n - /usr/local/lib\n - /usr/local/lib/freetds\n\nextconf failed, exit code 1\n\nGem files will remain installed in C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/tiny_tds-2.1.5 for inspection.\nResults logged to C:/Ruby31-x64/lib/ruby/gems/3.1.0/extensions/x64-mingw-ucrt/3.1.0/tiny_tds-2.1.5/gem_make.out\n
Run Code Online (Sandbox Code Playgroud)\n

我找到了下载的 FreeTDS 二进制文件来尝试 Windows 手动安装,但我不知道将它们放在哪里或如何使用它们。

\n

Lar*_*rgo 5

通过查看 freetds windows zipfile 和安装的 pacman 软件包,我通过之前的帖子找到了答案。

它可能在 C:\Ruby31-x64\msys64\ucrt64\include 中寻找包含文件夹标头,但它位于 C:\Ruby31-x64\msys64\ucrt64\include\freetds 有趣的是 .exe 文件位于 C:\Ruby31 -x64\msys64\ucrt64\bin 并找到。

 gem install tiny_tds -- --with-freetds-include=C:\Ruby31-x64\msys64\ucrt64\include\freetds
Run Code Online (Sandbox Code Playgroud)

另请参阅:Tiny TDS GitHub 问题 503