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

failed to install Sensu plugin gem 'sensu-plugins-http' because of missing dependencies #51

Open
SiKing opened this issue Aug 18, 2016 · 13 comments

Comments

@SiKing
Copy link

SiKing commented Aug 18, 2016

The latest sensu-plugins-http fails to install.

Actual behaviour:

# sensu-install -p http
[SENSU-INSTALL] installing Sensu plugins ...
[SENSU-INSTALL] determining if Sensu plugin gem 'sensu-plugins-http' is already installed ...
/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-0.25.7/exe/sensu-install:45: warning: Insecure world writable dir /opt in PATH, mode 040777
false
[SENSU-INSTALL] Sensu plugin gems to be installed: ["sensu-plugins-http"]
[SENSU-INSTALL] installing Sensu plugin gem 'sensu-plugins-http'
Building native extensions.  This could take a while...
/opt/sensu/embedded/lib/ruby/site_ruby/2.3.0/rubygems/ext/builder.rb:76: warning: Insecure world writable dir /opt in PATH, mode 040777
ERROR:  Error installing sensu-plugins-http:
    ERROR: Failed to build gem native extension.

    current directory: /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/unf_ext-0.0.7.2/ext/unf_ext
/opt/sensu/embedded/bin/ruby -r ./siteconf20160818-28877-1f8qvvw.rb extconf.rb
checking for main() in -lstdc++... *** 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
    --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/sensu/embedded/bin/$(RUBY_BASE_NAME)
    --with-static-libstdc++
    --without-static-libstdc++
    --with-stdc++lib
    --without-stdc++lib
/opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:541:in `try_link0'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:556:in `try_link'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:765:in `try_func'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:997:in `block in have_library'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:320:in `open'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:320:in `open'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:992:in `have_library'
    from extconf.rb:6:in `<main>'

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

  /opt/sensu/embedded/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0/unf_ext-0.0.7.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/unf_ext-0.0.7.2 for inspection.
Results logged to /opt/sensu/embedded/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0/unf_ext-0.0.7.2/gem_make.out
[SENSU-INSTALL] failed to install Sensu plugin gem 'sensu-plugins-http'
[SENSU-INSTALL] you can run the sensu-install command again with --verbose for more info
[SENSU-INSTALL] please take note of any failure messages above
[SENSU-INSTALL] make sure you have build tools installed (e.g. gcc)
[SENSU-INSTALL] trying to determine the Sensu plugin homepage for sensu-plugins-http ...
homepage: https://github.com/sensu-plugins/sensu-plugins-http
# cat   /opt/sensu/embedded/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0/unf_ext-0.0.7.2/mkmf.log
"gcc -o conftest -I/opt/sensu/embedded/include/ruby-2.3.0/x86_64-linux -I/opt/sensu/embedded/include/ruby-2.3.0/ruby/backward -I/opt/sensu/embedded/include/ruby-2.3.0 -I.  -I/opt/sensu/embedded/include   -L/opt/sensu/embedded/lib -I/opt/sensu/embedded/include -fPIC conftest.c  -L. -L/opt/sensu/embedded/lib -Wl,-R/opt/sensu/embedded/lib -L/opt/sensu/embedded/lib -Wl,-R/opt/sensu/embedded/lib -L. -Wl,-rpath /opt/sensu/embedded/lib -I/opt/sensu/embedded/include -fstack-protector -L/opt/sensu/embedded/lib -rdynamic -Wl,-export-dynamic -L/opt/sensu/embedded/lib  -Wl,-R/opt/sensu/embedded/lib     -Wl,-R/opt/sensu/embedded/lib -L/opt/sensu/embedded/lib -lruby  -lpthread -lrt -ldl -lcrypt -lm   -lc"
/opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:395: warning: Insecure world writable dir /opt in PATH, mode 040777
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

Expected behaviour:

# sensu-install -p http:0.3.0
[SENSU-INSTALL] installing Sensu plugins ...
[SENSU-INSTALL] determining if Sensu plugin gem 'sensu-plugins-http:0.3.0' is already installed ...
/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-0.25.7/exe/sensu-install:45: warning: Insecure world writable dir /opt in PATH, mode 040777
false
[SENSU-INSTALL] Sensu plugin gems to be installed: ["sensu-plugins-http:0.3.0"]
[SENSU-INSTALL] installing Sensu plugin gem 'sensu-plugins-http:0.3.0'
Fetching: sensu-plugins-http-0.3.0.gem (100%)
You can use the embedded Ruby by setting EMBEDDED_RUBY=true in /etc/default/sensu
Successfully installed sensu-plugins-http-0.3.0
1 gem installed
[SENSU-INSTALL] successfully installed Sensu plugins: ["http:0.3.0"]
@luisdalves
Copy link

@SiKing check if you have installed gcc-c++ and libstbc packages. They are needed to compile this plugin.

@SiKing
Copy link
Author

SiKing commented Aug 19, 2016

I thought this was all Ruby?
Also: Is this a new requirement? They were not needed for version 0.3.0, as you can see above.

@basickarl
Copy link

basickarl commented Feb 3, 2017

Would be nice to list those things as dependencies in the documentation.

@donnex
Copy link

donnex commented Mar 10, 2017

I think I'm having a similar issue. This is FreeBSD 11 with sensu-0.26.3-1. I'm not sure if I need additional packages installed, any idea?

gcc-ecj-4.5                    Eclipse Java Compiler used to build GCC Java
gcc48-4.8.5_1                  GNU Compiler Collection 4.8
$ sudo sensu-install -p sensu-plugins-http
[SENSU-INSTALL] installing Sensu plugins ...
[SENSU-INSTALL] determining if Sensu gem 'sensu-plugins-http' is already installed ...
false
[SENSU-INSTALL] Sensu plugin gems to be installed: ["sensu-plugins-http"]
[SENSU-INSTALL] installing Sensu gem 'sensu-plugins-http'
Building native extensions.  This could take a while...
ERROR:  Error installing sensu-plugins-http:
    ERROR: Failed to build gem native extension.

    current directory: /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/unf_ext-0.0.7.2/ext/unf_ext
/opt/sensu/embedded/bin/ruby -r ./siteconf20170310-2423-1pu1ln2.rb extconf.rb
checking for main() in -lstdc++... *** 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
    --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/sensu/embedded/bin/$(RUBY_BASE_NAME)
    --with-static-libstdc++
    --without-static-libstdc++
    --with-stdc++lib
    --without-stdc++lib
/opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:541:in `try_link0'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:556:in `try_link'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:765:in `try_func'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:997:in `block in have_library'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:320:in `open'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:320:in `open'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
    from /opt/sensu/embedded/lib/ruby/2.3.0/mkmf.rb:992:in `have_library'
    from extconf.rb:6:in `<main>'

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

  /opt/sensu/embedded/lib/ruby/gems/2.3.0/extensions/x86_64-freebsd-10/2.3.0/unf_ext-0.0.7.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/unf_ext-0.0.7.2 for inspection.
Results logged to /opt/sensu/embedded/lib/ruby/gems/2.3.0/extensions/x86_64-freebsd-10/2.3.0/unf_ext-0.0.7.2/gem_make.out
[SENSU-INSTALL] failed to install Sensu gem 'sensu-plugins-http'
[SENSU-INSTALL] you can run the sensu-install command again with --verbose for more info
[SENSU-INSTALL] please take note of any failure messages above
[SENSU-INSTALL] make sure you have build tools installed (e.g. gcc)
[SENSU-INSTALL] trying to determine the Sensu plugin homepage for sensu-plugins-http ...
homepage: https://github.com/sensu-plugins/sensu-plugins-http

@GhostLyrics
Copy link

Do you happen to have the BSD equivalent of ruby-dev?

@donnex
Copy link

donnex commented Mar 10, 2017

I was able to install devel/ruby-gems https://www.freshports.org/devel/ruby-gems/ but that didn't solve the problem. I can't find any other port that seem to match ruby-dev.

Anyways I still wasn't able to install the plugin with sensu-install. Using the system wide gem installed by the port above I was able to install and compile a working copy by running gem install sensu-plugins-http. The downside to this is that the checks are installed to the system bin folder and not the Sensu /opt folder. Not a very big deal since I can always copy them over, symlink or set a path in my checks.

@marcinhlybin
Copy link

marcinhlybin commented Apr 21, 2017

apt-get install g++ libstdc++6 libstdc++-4.9-dev

You can close the issue.

@majormoses
Copy link
Member

If we have a dependency of gcc then we need to document it to help users. Would someone be willing to put together a PR to document this?

@GhostLyrics
Copy link

@majormoses I can start converting and improving the Readme, but I will probably need some input there. Have you been added to contributors, so that you can commit to an open PR if allowed?

@majormoses
Copy link
Member

Yes I am now a maintainer and can ensure that any sane contribution goes through.

@majormoses
Copy link
Member

@GhostLyrics were you still looking to put together something?

@GhostLyrics
Copy link

I will try to have something within the next 7 days. If I don't, it is unlikely that I'll find time soon.

@GhostLyrics
Copy link

Working on it right now, will post link to branch or PR as soon as I can.

@majormoses majormoses changed the title failed to install Sensu plugin gem 'sensu-plugins-http' failed to install Sensu plugin gem 'sensu-plugins-http' because of missing dependencies Oct 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants