nwellnhof / perl-commonmark

Perl bindings for the CommonMark C library
https://metacpan.org/release/CommonMark
Other
5 stars 7 forks source link

Makefile.PL aborts too early #2

Closed nanis closed 8 years ago

nanis commented 8 years ago

Devel::CheckLib has issues on Windows and sometimes on OSX as well. Therefore, check_lib can fail even when a library is properly installed, and compilation works properly.

check_lib dies silently on failure. The warn you have in Makefile.PL suggests to me that maybe you expect it not to interrupt the generation of a make file.

When check_lib fails, the build does not proceed, and, consequently you get no failure reports from systems where Devel::CheckLib is dysfunctional.

I believe eliminating the dependency would be beneficial. I don't have a real solution at the moment, but I thought I would file this while the thought was on my mind.

nwellnhof commented 8 years ago

The warn(...), exit code in Makefile.PL is intentional.

I want to abort the build process early if libcmark is not installed. Otherwise, I get lots of useless failures from CPAN Testers. Here's what the reports looked like before I started to use Devel::CheckLib: http://matrix.cpantesters.org/?dist=CommonMark+0.1601

I also want to print a meaningful error message if the libcmark version is too old.

nanis commented 8 years ago

I know, but that assumes check_lib only fails when the library is not installed. That assumption does not seem to be warranted in the case of Darwin and Windows (w/ Microsoft tools). See http://matrix.cpantesters.org/?dist=Devel-CheckLib+1.05

Here's what happens on my system:

C:\...\CommonMark-0.240100> set lib=%lib%;c:\opt\lib

C:\...\CommonMark-0.240100> set include=%include%;c:\opt\include

C:\...\CommonMark-0.240100> perl Makefile.PL
libcmark 0.21.0 or higher not found at Makefile.PL line 16.

Now, compile this simple program:

C:\...\CommonMark-0.240100> type t.c
#include <cmark.h>
#include <stdio.h>

int main(void) {
    printf("0x%08X\n", CMARK_VERSION);
    return 0;
}

C:\...\CommonMark-0.240100> cl t.c    
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x64       
Copyright (C) Microsoft Corporation.  All rights reserved.                

t.c                                                                       
Microsoft (R) Incremental Linker Version 12.00.31101.0                    
Copyright (C) Microsoft Corporation.  All rights reserved.                

/out:t.exe                                                                
t.obj                                                                     

C:\...\CommonMark-0.240100> t.exe
0x00001801

In any case, as I was writing this, I realized why Devel::CheckLib is so broken on Windows with recent versions of Microsoft tools. I'll put together a pull request for that distro in the next day or two. Apologies for wasting your time.

PS: Fixed. mattn/p5-Devel-CheckLib#16