Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot gem install fluent-plugin-systemd version 1.1.0 #114

Open
Bachib opened this issue Nov 12, 2024 · 2 comments
Open

Cannot gem install fluent-plugin-systemd version 1.1.0 #114

Bachib opened this issue Nov 12, 2024 · 2 comments

Comments

@Bachib
Copy link

Bachib commented Nov 12, 2024

Steps to reproduce

Running fluentd in a docker container

docker run -it --user=root docker.io/fluent/fluentd:v1.17-debian-1 /bin/bash

From the container

gem install fluent-plugin-systemd -v 1.1.0

Error message :

Fetching fluent-plugin-systemd-1.1.0.gem
Fetching ffi-1.17.0-x86_64-linux-gnu.gem
Fetching systemd-journal-2.0.0.gem
Successfully installed ffi-1.17.0-x86_64-linux-gnu
Building native extensions. This could take a while...
ERROR:  Error installing fluent-plugin-systemd:
        ERROR: Failed to build gem native extension.

    current directory: /usr/local/bundle/gems/systemd-journal-2.0.0/ext/shim
/usr/local/bin/ruby extconf.rb
checking for whether -fvisibility=hidden is accepted as CFLAGS... *** 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=/usr/local/bin/$(RUBY_BASE_NAME)
/usr/local/lib/ruby/3.2.0/mkmf.rb:490:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.

        from /usr/local/lib/ruby/3.2.0/mkmf.rb:616:in `block in try_compile'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:563:in `with_werror'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:616:in `try_compile'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:680:in `try_cflags'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:1025:in `block (2 levels) in append_cflags'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:989:in `block in checking_for'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:354:in `block (2 levels) in postpone'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:324:in `open'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:354:in `block in postpone'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:324:in `open'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:350:in `postpone'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:988:in `checking_for'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:1024:in `block in append_cflags'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:1023:in `each'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:1023:in `append_cflags'
        from extconf.rb:8:in `<main>'

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

  /usr/local/bundle/extensions/x86_64-linux/3.2.0/systemd-journal-2.0.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/bundle/gems/systemd-journal-2.0.0 for inspection.
Results logged to /usr/local/bundle/extensions/x86_64-linux/3.2.0/systemd-journal-2.0.0/gem_make.out

A new release of RubyGems is available: 3.4.19 → 3.5.23!
Run `gem update --system 3.5.23` to update your installation.

If i look into mkmf.log
cat /usr/local/bundle/extensions/x86_64-linux/3.2.0/systemd-journal-2.0.0/mkmf.log

LD_LIBRARY_PATH=.:/usr/local/lib "gcc -o conftest -I/usr/local/include/ruby-3.2.0/x86_64-linux -I/usr/local/include/ruby-3.2.0/ruby/backward -I/usr/local/include/ruby-3.2.0 -I.    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wundef  -fPIC conftest.c  -L. -L/usr/local/lib -Wl,-rpath,/usr/local/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed     -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lruby  -lm -lpthread  -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

I am unsure what is the issue here as it only appears in this new version. Previous version 1.0.5 installs fine.

@Watson1978
Copy link

Watson1978 commented Nov 15, 2024

fluent-plugin-systemd depends on the systemd-journal and ffi gem.
To install ffi gem, a development tool such as gcc and libffi library are required.

You use docker.io/fluent/fluentd:v1.17-debian-1 as a base image and install the development tool and libffi library beforehand.

# apt update
# apt install make gcc g++ libffi-dev
# gem install fluent-plugin-systemd -v 1.1.0

@daipom
Copy link
Contributor

daipom commented Nov 15, 2024

I am unsure what is the issue here as it only appears in this new version. Previous version 1.0.5 installs fine.

Looks like we should check if this is intended change of fluent-plugin-systemd 1.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants