Missing libraries while building plugin

I need to use sqlite in my ruby filter (so not the sqlite logstash plugin, but the ruby gem). I am following the directions for building and installing a ruby gem from the logstash plugin documentation, but I seem to be missing libraries to build the plugin.

The normal fix for this outside of logstash is to run sudo apt-get install ruby-dev libsqlite3-dev to install the proper headers, but those go in /usr/libs and not into the logstash environment. How do I get the proper headers installed into my logstash environment?

Installing...
Error Bundler::InstallError, retrying 1/10
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /opt/bitnami/logstash/vendor/bundle/jruby/2.5.0/gems/sqlite3-1.4.2/ext/sqlite3
/opt/bitnami/logstash/vendor/jruby/bin/jruby -r ./siteconf20200102-4712-uoimyc.rb extconf.rb
checking for sqlite3.h... RuntimeError: The compiler failed to generate an executable file.
You have to install development tools first.

        try_do at /opt/bitnami/logstash/vendor/jruby/lib/ruby/stdlib/mkmf.rb:456
       try_cpp at /opt/bitnami/logstash/vendor/jruby/lib/ruby/stdlib/mkmf.rb:587
   find_header at /opt/bitnami/logstash/vendor/jruby/lib/ruby/stdlib/mkmf.rb:1144
  checking_for at /opt/bitnami/logstash/vendor/jruby/lib/ruby/stdlib/mkmf.rb:942
      postpone at /opt/bitnami/logstash/vendor/jruby/lib/ruby/stdlib/mkmf.rb:350
          open at /opt/bitnami/logstash/vendor/jruby/lib/ruby/stdlib/mkmf.rb:320
      postpone at /opt/bitnami/logstash/vendor/jruby/lib/ruby/stdlib/mkmf.rb:350
          open at /opt/bitnami/logstash/vendor/jruby/lib/ruby/stdlib/mkmf.rb:320
      postpone at /opt/bitnami/logstash/vendor/jruby/lib/ruby/stdlib/mkmf.rb:346
  checking_for at /opt/bitnami/logstash/vendor/jruby/lib/ruby/stdlib/mkmf.rb:941
   find_header at /opt/bitnami/logstash/vendor/jruby/lib/ruby/stdlib/mkmf.rb:1143
        <main> at extconf.rb:68
*** 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/logstash/vendor/jruby/bin/jruby
        --with-sqlcipher
        --without-sqlcipher
        --with-sqlite3-config
        --without-sqlite3-config
        --with-pkg-config
        --without-pkg-config
        --with-sqlcipher
        --without-sqlcipher
        --with-sqlite3-dir
        --without-sqlite3-dir
        --with-sqlite3-include
        --without-sqlite3-include=${sqlite3-dir}/include
        --with-sqlite3-lib
        --without-sqlite3-lib=${sqlite3-dir}/lib

To see why this extension failed to compile, please check the mkmf.log which can be found here:
  /opt/bitnami/logstash/vendor/bundle/jruby/2.5.0/extensions/universal-java-1.8/2.5.0/sqlite3-1.4.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /opt/bitnami/logstash/vendor/bundle/jruby/2.5.0/gems/sqlite3-1.4.2 for inspection.
Results logged to /opt/bitnami/logstash/vendor/bundle/jruby/2.5.0/extensions/universal-java-1.8/2.5.0/sqlite3-1.4.2/gem_make.out

An error occurred while installing sqlite3 (1.4.2), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.4.2' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  sqlite3
Error Bundler::InstallError, retrying 2/10
... repeats...

And the file /opt/bitnami/logstash/vendor/bundle/jruby/2.5.0/extensions/universal-java-1.8/2.5.0/sqlite3-1.4.2/gem_make.out

"pkg-config --exists sqlite3"
package configuration for sqlite3 is not found
" -o conftest -I/include/universal-java1.8 -I/opt/bitnami/logstash/vendor/jruby/lib/ruby/include/ruby/backward -I/opt/bitnami/logstash/vendor/jruby/lib/ruby/include -I.     -fPIC  -fno-omit-frame-pointer -fno-strict-aliasing  -fexceptions  -DTAINTING_SUPPORT conftest.c  -L. -L/opt/bitnami/logstash/vendor/jruby/lib    -m64      "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <ruby.h>
4: int main(int argc, char **argv)
5: {
6:   return 0;
7: }
/* end */

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.