Skip Menu |

This queue is for tickets about the File-LibMagic CPAN distribution.

Report information
The Basics
Id: 97945
Status: resolved
Priority: 0/
Queue: File-LibMagic

People
Owner: Nobody in particular
Requestors: alexander.bluhm [...] gmx.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.02
Fixed in: 1.03



Subject: libmagic in /usr/local
I am trying to get File-LibMagic-1.02 ported to OpenBSD. There libmagic is located in /usr/local/. In version 1.01 this was easy as I could pass the flags as an configure argument to Devel::CheckLib. CONFIGURE_ARGS += "INC=-I/usr/local/include" CONFIGURE_ARGS += "LIBS=-L/usr/local/lib -lmagic" In Config::AutoConf version 0.22 you are using now, I could not find a way to pass this information via command line or environment to configure. Of course I can maintain local patches for your module to make the compiler and linker find what they need. But I guess there should be a more elegant way with all that configure magic. Any ideas?
On Mon Aug 11 16:16:56 2014, bluhm wrote: Show quoted text
> I am trying to get File-LibMagic-1.02 ported to OpenBSD. There > libmagic is located in /usr/local/. In version 1.01 this was easy > as I could pass the flags as an configure argument to Devel::CheckLib. > > CONFIGURE_ARGS += "INC=-I/usr/local/include" > CONFIGURE_ARGS += "LIBS=-L/usr/local/lib -lmagic" > > In Config::AutoConf version 0.22 you are using now, I could not > find a way to pass this information via command line or environment > to configure. > > Of course I can maintain local patches for your module to make the > compiler and linker find what they need. But I guess there should > be a more elegant way with all that configure magic. Any ideas?
First of all, I don't think the "-lmagic" bit is necessary. After all, that's what I'm trying to check with Config::AutoConf. As to the rest, it's possible to pass extra args such as "extra_include_dirs" and "extra_link_flags" to Config::AutoConf->new and have it use that. I could change the Makefile.PL to accept some CLI args. Also, I don't suppose that libmagic uses pkg-config. C::AC can use that to find the necessary flags.
Subject: Re: [rt.cpan.org #97945] libmagic in /usr/local
Date: Mon, 11 Aug 2014 23:20:35 +0200
To: Dave Rolsky via RT <bug-File-LibMagic [...] rt.cpan.org>
From: Alexander Bluhm <alexander.bluhm [...] gmx.net>
On Mon, Aug 11, 2014 at 04:33:09PM -0400, Dave Rolsky via RT wrote: Show quoted text
> First of all, I don't think the "-lmagic" bit is necessary. After all, that's what I'm trying to check with Config::AutoConf.
If I don't set CONFIGURE_ARGS += "LIBS=-L/usr/local/lib -lmagic" make test fails. I need both of them, -L and -l. PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t /usr/bin/perl:/usr/ports/pobj/p5-File-LibMagic-1.02/File-LibMagic-1.02/blib/arch/auto/File/LibMagic/LibMagic.so: undefined symbol 'magic_close' They seem to store the required libraries and paths in /usr/local/libdata/perl5/site_perl/amd64-openbsd/auto/File/LibMagic/LibMagic.so so the dynamic loader finds the dependent library automatically. Show quoted text
> As to the rest, it's possible to pass extra args such as "extra_include_dirs" and "extra_link_flags" to Config::AutoConf->new and have it use that. I could change the Makefile.PL to accept some CLI args.
With this hardcoded patch, I can build the module. --- Makefile.PL.orig Sat Jul 26 18:53:32 2014 +++ Makefile.PL Mon Aug 11 22:59:45 2014 @@ -10,8 +10,12 @@ use ExtUtils::MakeMaker 6.30; use lib qw( inc ); use Config::AutoConf; -unless ( Config::AutoConf->check_header('magic.h') - && Config::AutoConf->check_lib( 'magic', 'magic_open' ) ) { +my $ac = Config::AutoConf->new( + extra_link_flags => [ "-L/usr/local/lib" ], +); + +unless ( $ac->check_header('magic.h') + && $ac->check_lib( 'magic', 'magic_open' ) ) { warn <<'EOF'; This module requires the libmagic.so library and magic.h header. See Show quoted text
> Also, I don't suppose that libmagic uses pkg-config. C::AC can use that to find the necessary flags.
I have never used pkg-config.
Subject: Re: [rt.cpan.org #97945] Resolved: libmagic in /usr/local
Date: Mon, 1 Sep 2014 00:06:25 +0200
To: Dave Rolsky via RT <bug-File-LibMagic [...] rt.cpan.org>
From: Alexander Bluhm <alexander.bluhm [...] gmx.net>
I have tried File-LibMagic-1.03 and it works. I still need these two lines CONFIGURE_ARGS += --include /usr/local/include --lib /usr/local/lib CONFIGURE_ARGS += "LIBS=-L/usr/local/lib -lmagic" That is fine as no local patch is required. Thanks for fixing this. I think there is a typo in your documentation perl Makefile.PL --lib /usr/local/include --include /usr/local/include Should there be one /usr/local/lib instead of two /usr/local/include?