ruby 无法安装tiny_tds和activerecord-sqlserver-adapter gem

58wvjzkj  于 2023-08-04  发布在  Ruby
关注(0)|答案(1)|浏览(105)

我正在使用Debian 11和Ruby 3.0.6,这是一个带有Bitnami的Redmine预安装的MV:https://bitnami.com/stack/redmine/virtual-machine
但是我正在特灵将数据库MariaDB更改为使用外部SQL Server。为此,我需要安装gemstiny_tdsactiverecord-sqlserver-adapter
当我尝试安装它时,它返回这个错误(无论你想安装哪个gem,它都返回相同的错误):

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

字符串

  • gem_make.out的内容是相同的错误
  • mkmf.log的内容如下:
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 */


我被绑定到安装ruby-dev和gcc(sudo apt-get install gcc ruby-dev)。我也尝试安装ubuntu-dev-tools(sudo apt-get install ubuntu-dev-tools)。没有结果。

wqsoz72f

wqsoz72f1#

你的mkmf.log说

/usr/bin/ld: cannot find -lz

字符串
它错过了zlib。试试看

apt install zlib1g-dev

相关问题