urbanadventurer / WhatWeb

Next generation web scanner
https://www.morningstarsecurity.com/research/whatweb
GNU General Public License v2.0
5.47k stars 902 forks source link

cannot load such file: lib/whatweb #283

Closed blshkv closed 4 years ago

blshkv commented 4 years ago

I'm trying to push the latest version 0.5 to Pentoo and facing this problem. I have installed the tool using the standard "make install" function and got the following structure:

/usr/bin/whatweb
/usr/share/whatweb/*

However, it fails to start with the following message:

/usr/lib64/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- lib/whatweb (LoadError)
        from /usr/lib64/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/bin/whatweb:37:in `<main>'

FYI: the previous version used to have the following loader:

## set up load paths - must be before loading lib/ files
# add the directory of the file currently being executed to the load path
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless
    $:.include?(File.dirname(__FILE__)) || $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
$LOAD_PATH << "/usr/share/whatweb/"
sytranvn commented 4 years ago

I think symlink should be supported as in previous version too. Because I just link whatweb to my bin folder instead of run make install. There is a PR for this issue #282

blshkv commented 4 years ago

yes, I guess make install should just create a symlink after you patch. That would be the proper fix.

urbanadventurer commented 4 years ago

Thanks for the help @blshkv and @sytranvn

blshkv commented 4 years ago

something is broken. Please re-open this bug

install -p -D -m 644 whatweb.1 /var/tmp/portage/net-analyzer/whatweb-0.5.1/image/usr/share/man/man1/whatweb.1
gzip -f /var/tmp/portage/net-analyzer/whatweb-0.5.1/image/usr/share/man/man1/whatweb.1
install -d /var/tmp/portage/net-analyzer/whatweb-0.5.1/image/usr/share/whatweb
install -d /var/tmp/portage/net-analyzer/whatweb-0.5.1/image/usr/share/doc/whatweb-0.5.1
# copy whatweb into LIBPATH/NAME/ and create a symbolic link in the BINPATH
install -p -D -m 755 whatweb /var/tmp/portage/net-analyzer/whatweb-0.5.1/image/usr/share/whatweb
ln -s /var/tmp/portage/net-analyzer/whatweb-0.5.1/image/usr/share/whatweb/whatweb /var/tmp/portage/net-analyzer/whatweb-0.5.1/image/usr/bin/whatweb
ln: failed to create symbolic link '/var/tmp/portage/net-analyzer/whatweb-0.5.1/image/usr/bin/whatweb': No such file or directory
blshkv commented 4 years ago

ok, found it. You have to make sure that BINPATH exists before linking the binary: https://github.com/urbanadventurer/WhatWeb/blob/master/Makefile#L30