dmgerman / ninka

a license identification tool for Source Code
http://ninka.turingmachine.org
GNU General Public License v2.0
105 stars 31 forks source link

Help with using ninka #49

Open enridaga opened 1 year ago

enridaga commented 1 year ago

I am trying to run the ninka script in bin following the readme notes but haven't succeeded.

I cloned the project on my mac-osx, where I have perl 5. When trying to run the file in bin simply

$ perl bin/ninka
Can't locate Ninka.pm in @INC (you may need to install the Ninka module) (@INC contains: /usr/local/opt/perl/lib/perl5/site_perl/5.36/darwin-thread-multi-2level /usr/local/opt/perl/lib/perl5/site_perl/5.36 /usr/local/opt/perl/lib/perl5/5.36/darwin-thread-multi-2level /usr/local/opt/perl/lib/perl5/5.36 /usr/local/lib/perl5/site_perl/5.36) at bin/ninka line 6.
BEGIN failed--compilation aborted at bin/ninka line 6.

Reading that (you may need to install the Ninka module), I tried to compile/install. I've seen a Makefile.PL, so I also tried following these instructions with no joy... see the following.

Step one works:

$ perl Makefile.PL 
Warning: prerequisite DBD::SQLite 0 not found.
Warning: prerequisite DBI 0 not found.
Warning: prerequisite IO::CaptureOutput 0 not found.
Warning: prerequisite Spreadsheet::WriteExcel 0 not found.
Warning: prerequisite Test::Pod 1.00 not found.
Warning: prerequisite Test::Strict 0 not found.
Generating a Unix-style Makefile
Writing Makefile for Ninka
Writing MYMETA.yml and MYMETA.json

Make seems to work as well:

$ make
...
cp bin/ninka blib/script/ninka
"/usr/local/Cellar/perl/5.36.1/bin/perl" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/ninka
Manifying 1 pod document
Manifying 8 pod documents

Make test fails miserably:

$ make test
PERL_DL_NONLAZY=1 "/usr/local/Cellar/perl/5.36.1/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/pod_ok.t .................... Can't locate Test/Pod.pm in @INC (you may need to install the Test::Pod module) (@INC contains: /Users/ed4565/Development/ninka/blib/lib /Users/ed4565/Development/ninka/blib/arch /usr/local/opt/perl/lib/perl5/site_perl/5.36/darwin-thread-multi-2level /usr/local/opt/perl/lib/perl5/site_perl/5.36 /usr/local/opt/perl/lib/perl5/5.36/darwin-thread-multi-2level /usr/local/opt/perl/lib/perl5/5.36 /usr/local/lib/perl5/site_perl/5.36 .) at t/pod_ok.t line 3.
BEGIN failed--compilation aborted at t/pod_ok.t line 3.
t/pod_ok.t .................... Dubious, test returned 2 (wstat 512, 0x200)
No subtests run 
t/reference_licenses.t ........ Can't locate IO/CaptureOutput.pm in @INC (you may need to install the IO::CaptureOutput module) (@INC contains: /Users/ed4565/Development/ninka/blib/lib /Users/ed4565/Development/ninka/blib/arch /Library/Perl/5.30/darwin-thread-multi-2level /Library/Perl/5.30 /Network/Library/Perl/5.30/darwin-thread-multi-2level /Network/Library/Perl/5.30 /Library/Perl/Updates/5.30.3 /System/Library/Perl/5.30/darwin-thread-multi-2level /System/Library/Perl/5.30 /System/Library/Perl/Extras/5.30/darwin-thread-multi-2level /System/Library/Perl/Extras/5.30 .) at /Users/ed4565/Development/ninka/blib/lib/Ninka/CommentExtractor.pm line 7.
BEGIN failed--compilation aborted at /Users/ed4565/Development/ninka/blib/lib/Ninka/CommentExtractor.pm line 7.
Compilation failed in require at /Users/ed4565/Development/ninka/blib/lib/Ninka.pm line 6.
BEGIN failed--compilation aborted at /Users/ed4565/Development/ninka/blib/lib/Ninka.pm line 6.
Compilation failed in require at /Users/ed4565/Development/ninka/bin/ninka line 6.
BEGIN failed--compilation aborted at /Users/ed4565/Development/ninka/bin/ninka line 6.

    #   Failed test 'stdout is as expected'
    #   at t/reference_licenses.t line 25.
    #          got: ''
    #     expected: '/var/folders/t0/6dry46x961xds6f9cb87z1c580sq3r/T/YmnZ7cSBpL/AAL;UNKNOWN;0;0;0;2;7;Copyright,AllRights-TOOLONG,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN'
    # Looks like you failed 1 test of 2.
t/reference_licenses.t ........ 1/96 
#   Failed test 'AAL'
#   at t/reference_licenses.t line 26.

(... many more like that)

Failed 3/3 test programs. 96/96 subtests failed.
make: *** [test_dynamic] Error 2

What's the fastest way to test the tool with some source code?

jeremiah commented 1 year ago

Hi @enridaga,

Looks like you're missing a bunch of dependencies that ninka needs to run, these pre-requisites seem important for example;

Warning: prerequisite DBD::SQLite 0 not found.
Warning: prerequisite DBI 0 not found.
Warning: prerequisite IO::CaptureOutput 0 not found.
Warning: prerequisite Spreadsheet::WriteExcel 0 not found.
Warning: prerequisite Test::Pod 1.00 not found.
Warning: prerequisite Test::Strict 0 not found.

I don't have a Mac handy to test the build at the moment but I'll review the Ninka instructions on a Linux box which ought to be somewhat similar.

jeremiah commented 1 year ago

I successfully installed Ninka, even without some dependencies, by doing a make install. If that doesn't work for you, you man want to install a tool to install from CPAN, which holds perl modules. I guess MacOS has homebrew but there is also CPAN and cpanminus tools that can install perl modules directly. I don't know if they're installed on Mac OS per default so you may have to run out an get them. This tool is popular for doing that: https://metacpan.org/pod/App::cpanminus (cpanminus).

jeremiah commented 1 year ago

If you want all the tests to pass before you install, simply install Test::Pod and Test::Strict.

jeremiah commented 1 year ago

I am trying to run the ninka script in bin following the readme notes but haven't succeeded.

I cloned the project on my mac-osx, where I have perl 5. When trying to run the file in bin simply

$ perl bin/ninka
Can't locate Ninka.pm in @INC (you may need to install the Ninka module) (@INC contains: /usr/local/opt/perl/lib/perl5/site_perl/5.36/darwin-thread-multi-2level /usr/local/opt/perl/lib/perl5/site_perl/5.36 /usr/local/opt/perl/lib/perl5/5.36/darwin-thread-multi-2level /usr/local/opt/perl/lib/perl5/5.36 /usr/local/lib/perl5/site_perl/5.36) at bin/ninka line 6.
BEGIN failed--compilation aborted at bin/ninka line 6.

FWIW the Ninka.pm (Ninka module) lives in lib/ dir in the Ninka git repo. If you do a make install it should get installed and Ninka should find it.