Failed to install tiny_tds and activerecord-sqlserver-adapter gems.

huangapple go评论90阅读模式
英文:

Failed to install tiny_tds and activerecord-sqlserver-adapter gems

问题

I'm work with Debian 11 and Ruby 3.0.6
我使用Debian 11和Ruby 3.0.6。

It's a VM with the Bitnami's preinstallation of Redmine:
这是一个使用Bitnami预安装的Redmine虚拟机:

https://bitnami.com/stack/redmine/virtual-machine

But I'm trying to change the database from MariaDB to use an external SQL Server.
但我尝试将数据库从MariaDB更改为使用外部SQL Server。

To do this, I need to install the gems tiny_tds and activerecord-sqlserver-adapter.
为了做到这一点,我需要安装tiny_tdsactiverecord-sqlserver-adapter这两个宝石。

When I try to install it, it returns this error (no matter which gem you want to install, it returns the same error):
当我尝试安装它时,它返回以下错误(无论您要安装哪个宝石,都会返回相同的错误):

  1. bitnami@debian:~$ sudo gem install tiny_tds
  2. Building native extensions. This could take a while...
  3. ERROR: Error installing tiny_tds:
  4. ERROR: Failed to build gem native extension.
  5. current directory: /opt/bitnami/ruby/lib/ruby/gems/3.0.0/gems/tiny_tds-2.1.5/ext/tiny_tds
  6. /opt/bitnami/ruby/bin/ruby extconf.rb
  7. looking for freetds headers in the following directories:
  8. - /opt/local/include
  9. - /opt/local/include/freetds
  10. - /usr/local/include
  11. - /usr/local/include/freetds
  12. looking for freetds library in the following directories:
  13. - /opt/local/lib
  14. - /opt/local/lib/freetds
  15. - /usr/local/lib
  16. - /usr/local/lib/freetds
  17. checking for sybfront.h... *** extconf.rb failed ***
  18. Could not create Makefile due to some reason, probably lack of necessary
  19. libraries and/or headers. Check the mkmf.log file for more details. You may
  20. need configuration options.
  21. Provided configuration options:
  22. --with-opt-dir
  23. --without-opt-dir
  24. --with-opt-include
  25. --without-opt-include=${opt-dir}/include
  26. --with-opt-lib
  27. --without-opt-lib=${opt-dir}/lib
  28. --with-make-prog
  29. --without-make-prog
  30. --srcdir=.
  31. --curdir
  32. --ruby=/opt/bitnami/ruby/bin/$(RUBY_BASE_NAME)
  33. --help
  34. --with-freetds-dir
  35. --without-freetds-dir
  36. --with-freetds-include
  37. --without-freetds-include=${freetds-dir}/include
  38. --with-freetds-lib
  39. --without-freetds-lib=${freetds-dir}/lib
  40. /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:471:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
  41. You have to install development tools first.
  42. from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:613:in `try_cpp'
  43. from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:1177:in `block in find_header'
  44. from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:971:in `block in checking_for'
  45. from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:361:in `block (2 levels) in postpone'
  46. from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:331:in `open'
  47. from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:361:in `block in postpone'
  48. from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:331:in `open'
  49. from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:357:in `postpone'
  50. from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:970:in `checking_for'
  51. from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:1176:in `find_header'
  52. from extconf.rb:59:in `<main>'
  53. To see why this extension failed to compile, please check the mkmf.log which can be found here:
  54. /opt/bitnami/ruby/lib/ruby/gems/3.0.0/extensions/x86_64-linux/3.0.0-static/tiny_tds-2.1.5/mkmf.log
  55. extconf failed, exit code 1
  56. Gem files will remain installed in /opt/bitnami/ruby/lib/ruby/gems/3.0.0/gems/tiny_tds-2.1.5 for inspection.
  57. Results logged to /opt/bitnami/ruby/lib/ruby/gems/3.0.0/extensions/x86_64-linux/3.0.0-static/tiny_tds-2.1.5/gem_make.out
  • The content of gem_make.out is the same error

  • The content of mkmf.log, is the following:

  1. gcc -o conftest -I/opt/bitnami/ruby/include/ruby-3.0.0/x86_64-linux -I/opt/bitnami/ruby/include/ruby-3.0.0/ruby/backward -I/opt/bitnami/ruby/include/ruby-3.0.0 -I. -I/opt/local/include -I/opt/local/include/freetds -I/usr/local
  2. /usr/bin/ld: cannot find -lz
  3. collect2: error: ld returned 1 exit status
  4. checked program was:
  5. /* begin */
  6. 1: #include "ruby.h"
  7. 2:
  8. 3: int main(int argc, char **argv)
  9. 4: {
  10. 5: return !!argv[argc];
  11. 6: }
  12. /* end */

I'm trying to install ruby-dev and gcc (sudo apt-get install gcc ruby-dev).
我尝试安装ruby-dev和gcc(sudo apt-get install gcc ruby-dev)。

Also, I've tried to install ubuntu-dev-tools (sudo apt-get install ubuntu-dev-tools).
此外,我尝试安装了ubuntu-dev-tools(sudo apt-get install ubuntu-dev-tools)。

英文:

I'm work with Debian 11 and Ruby 3.0.6
It's a MV with the Bitnami's preintallation of Redmine:
https://bitnami.com/stack/redmine/virtual-machine

But I'm tring to change the database MariaDB to usa an external SQL Server.
To do this, I need install the gems tiny_tds, activerecord-sqlserver-adapter.

When I try to install it, it returns this error (no matter which gem you want to install, it returns the same error):

  1. bitnami@debian:~$ sudo gem install tiny_tds
  2. Building native extensions. This could take a while...
  3. ERROR: Error installing tiny_tds:
  4. ERROR: Failed to build gem native extension.
  5. current directory: /opt/bitnami/ruby/lib/ruby/gems/3.0.0/gems/tiny_tds-2.1.5/ext/tiny_tds
  6. /opt/bitnami/ruby/bin/ruby extconf.rb
  7. looking for freetds headers in the following directories:
  8. - /opt/local/include
  9. - /opt/local/include/freetds
  10. - /usr/local/include
  11. - /usr/local/include/freetds
  12. looking for freetds library in the following directories:
  13. - /opt/local/lib
  14. - /opt/local/lib/freetds
  15. - /usr/local/lib
  16. - /usr/local/lib/freetds
  17. checking for sybfront.h... *** extconf.rb failed ***
  18. Could not create Makefile due to some reason, probably lack of necessary
  19. libraries and/or headers. Check the mkmf.log file for more details. You may
  20. need configuration options.
  21. Provided configuration options:
  22. --with-opt-dir
  23. --without-opt-dir
  24. --with-opt-include
  25. --without-opt-include=${opt-dir}/include
  26. --with-opt-lib
  27. --without-opt-lib=${opt-dir}/lib
  28. --with-make-prog
  29. --without-make-prog
  30. --srcdir=.
  31. --curdir
  32. --ruby=/opt/bitnami/ruby/bin/$(RUBY_BASE_NAME)
  33. --help
  34. --with-freetds-dir
  35. --without-freetds-dir
  36. --with-freetds-include
  37. --without-freetds-include=${freetds-dir}/include
  38. --with-freetds-lib
  39. --without-freetds-lib=${freetds-dir}/lib
  40. /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:471:in `try_do&#39;: The compiler failed to generate an executable file. (RuntimeError)
  41. You have to install development tools first.
  42. from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:613:in `try_cpp&#39;
  43. from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:1177:in `block in find_header&#39;
  44. from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:971:in `block in checking_for&#39;
  45. from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:361:in `block (2 levels) in postpone&#39;
  46. from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:331:in `open&#39;
  47. from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:361:in `block in postpone&#39;
  48. from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:331:in `open&#39;
  49. from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:357:in `postpone&#39;
  50. from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:970:in `checking_for&#39;
  51. from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:1176:in `find_header&#39;
  52. from extconf.rb:59:in `&lt;main&gt;&#39;
  53. To see why this extension failed to compile, please check the mkmf.log which can be found here:
  54. /opt/bitnami/ruby/lib/ruby/gems/3.0.0/extensions/x86_64-linux/3.0.0-static/tiny_tds-2.1.5/mkmf.log
  55. extconf failed, exit code 1
  56. Gem files will remain installed in /opt/bitnami/ruby/lib/ruby/gems/3.0.0/gems/tiny_tds-2.1.5 for inspection.
  57. Results logged to /opt/bitnami/ruby/lib/ruby/gems/3.0.0/extensions/x86_64-linux/3.0.0-static/tiny_tds-2.1.5/gem_make.out
  • The content of gem_make.out is the same error

  • The content of mkmf.log, is the following:

  1. gcc -o conftest -I/opt/bitnami/ruby/include/ruby-3.0.0/x86_64-linux -I/opt/bitnami/ruby/include/ruby-3.0.0/ruby/backward -I/opt/bitnami/ruby/include/ruby-3.0.0 -I. -I/opt/local/include -I/opt/local/include/freetds -I/usr/local&gt;
  2. /usr/bin/ld: cannot find -lz
  3. collect2: error: ld returned 1 exit status
  4. checked program was:
  5. /* begin */
  6. 1: #include &quot;ruby.h&quot;
  7. 2:
  8. 3: int main(int argc, char **argv)
  9. 4: {
  10. 5: return !!argv[argc];
  11. 6: }
  12. /* end */

I'm tied to install ruby-dev and gcc (sudo apt-get install gcc ruby-dev).
Also I'm tried to install ubuntu-dev-tools (sudo apt-get install ubuntu-dev-tools).
With no results.

答案1

得分: 1

mkmf.log文件指出:

  1. /usr/bin/ld: 找不到 -lz

缺少zlib库。请尝试执行:

  1. apt install zlib1g-dev
英文:

Your mkmf.log says

  1. /usr/bin/ld: cannot find -lz

It misses zlib. Try

  1. apt install zlib1g-dev

huangapple
  • 本文由 发表于 2023年6月15日 16:23:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/76480512.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定