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

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

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):
当我尝试安装它时,它返回以下错误(无论您要安装哪个宝石,都会返回相同的错误):

bitnami@debian:~$ sudo gem install tiny_tds
Building native extensions. This could take a while...
ERROR:  Error installing tiny_tds:
        ERROR: Failed to build gem native extension.

    current directory: /opt/bitnami/ruby/lib/ruby/gems/3.0.0/gems/tiny_tds-2.1.5/ext/tiny_tds
/opt/bitnami/ruby/bin/ruby extconf.rb
looking for freetds headers in the following directories:
 - /opt/local/include
 - /opt/local/include/freetds
 - /usr/local/include
 - /usr/local/include/freetds
looking for freetds library in the following directories:
 - /opt/local/lib
 - /opt/local/lib/freetds
 - /usr/local/lib
 - /usr/local/lib/freetds
checking for sybfront.h... *** extconf.rb failed *** 
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/opt/bitnami/ruby/bin/$(RUBY_BASE_NAME)
        --help
        --with-freetds-dir
        --without-freetds-dir
        --with-freetds-include
        --without-freetds-include=${freetds-dir}/include
        --with-freetds-lib
        --without-freetds-lib=${freetds-dir}/lib
/opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:471:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:613:in `try_cpp'
        from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:1177:in `block in find_header'
        from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:971:in `block in checking_for'
        from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:361:in `block (2 levels) in postpone'
        from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:331:in `open'
        from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:361:in `block in postpone'
        from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:331:in `open'
        from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:357:in `postpone'
        from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:970:in `checking_for'
        from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:1176:in `find_header'
        from extconf.rb:59:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /opt/bitnami/ruby/lib/ruby/gems/3.0.0/extensions/x86_64-linux/3.0.0-static/tiny_tds-2.1.5/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /opt/bitnami/ruby/lib/ruby/gems/3.0.0/gems/tiny_tds-2.1.5 for inspection.
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:

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
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:  return !!argv[argc];
6: }
/* 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):

bitnami@debian:~$ sudo gem install tiny_tds
Building native extensions. This could take a while...
ERROR:  Error installing tiny_tds:
        ERROR: Failed to build gem native extension.

    current directory: /opt/bitnami/ruby/lib/ruby/gems/3.0.0/gems/tiny_tds-2.1.5/ext/tiny_tds
/opt/bitnami/ruby/bin/ruby extconf.rb
looking for freetds headers in the following directories:
 - /opt/local/include
 - /opt/local/include/freetds
 - /usr/local/include
 - /usr/local/include/freetds
looking for freetds library in the following directories:
 - /opt/local/lib
 - /opt/local/lib/freetds
 - /usr/local/lib
 - /usr/local/lib/freetds
checking for sybfront.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/opt/bitnami/ruby/bin/$(RUBY_BASE_NAME)
        --help
        --with-freetds-dir
        --without-freetds-dir
        --with-freetds-include
        --without-freetds-include=${freetds-dir}/include
        --with-freetds-lib
        --without-freetds-lib=${freetds-dir}/lib
/opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:471:in `try_do&#39;: The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:613:in `try_cpp&#39;
        from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:1177:in `block in find_header&#39;
        from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:971:in `block in checking_for&#39;
        from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:361:in `block (2 levels) in postpone&#39;
        from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:331:in `open&#39;
        from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:361:in `block in postpone&#39;
        from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:331:in `open&#39;
        from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:357:in `postpone&#39;
        from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:970:in `checking_for&#39;
        from /opt/bitnami/ruby/lib/ruby/3.0.0/mkmf.rb:1176:in `find_header&#39;
        from extconf.rb:59:in `&lt;main&gt;&#39;

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /opt/bitnami/ruby/lib/ruby/gems/3.0.0/extensions/x86_64-linux/3.0.0-static/tiny_tds-2.1.5/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /opt/bitnami/ruby/lib/ruby/gems/3.0.0/gems/tiny_tds-2.1.5 for inspection.
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:

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;
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
1: #include &quot;ruby.h&quot;
2: 
3: int main(int argc, char **argv)
4: {
5:  return !!argv[argc];
6: }
/* 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文件指出:

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

缺少zlib库。请尝试执行:

apt install zlib1g-dev
英文:

Your mkmf.log says

/usr/bin/ld: cannot find -lz

It misses zlib. Try

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:

确定