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': 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 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.
Your mkmf.log says
/usr/bin/ld: cannot find -lz
It misses zlib. Try
apt install zlib1g-dev