MakeMaker: Extra libs 
Author Message
 MakeMaker: Extra libs

I've recently ran into a problem with MakeMaker and I can't find any
reference to it on deja, so here goes.

I'm trying to build the module Term::ReadLine::Gnu, which relies on a
working libreadline.a already existing on your system. The user
specifies where libreadline.a and readline.h live on their system by
specifying $libreadlinedir and $increadlinedir. The WriteMakefile()
part of Term::ReadLine::Gnu's Makefile.PL looks like this:

        'LIBS'  => [ "-L$libreadlinedir -lreadline" ],
        'INC'   => "-I$increadlinedir",

The problem with this is that the LIBS arguments gets tacked on to the
end of the link line while the INC argument gets tacked on to the
beginning. Why is this a problem? Well, let's say a user has no root
access and they just want to install the latest readline4.0 in their
home directory even though readline2.2 exists somewhere on their
system already. This causes the header files for readline4.0 to be
included first(since INC comes first), but the library path links
against readline2.2 (since LIB comes last).

It's not Term::ReadLine::Gnu's fault that this happens. I believe that
MakeMaker isn't doing the right thing. I see two fixes. The first is
to change LDDLFLAGS in WriteMakefile() like this:

    #     'LIBS'  => [ "-L$libreadlinedir -lreadline" ],
       'LIBS'    => [ -lreadline ],
       'LDFLAGS' => "-L$libreadlinedir $Config{'ldflags'}",
       'LDDLFLAGS' => "-L$libreadlinedir $Config{'lddlflags'}",
       'INC'   => "-I$increadlinedir",

This solution seems ok to me except is kind of breaks the purpose of
the LIB option. I think a better solution would be to have any
libraries listed in a LIB option come first in the link path.

Am I missing the boat here? What do other people think?


Sat, 10 Nov 2001 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. building static libs with MakeMaker

2. Makemaker LIBS attribute

3. Making ExtUtils::MakeMaker install extra, non .pm files

4. Calling C libs from C libs from Perl with XS

5. Bug in MakeMaker? (How to add stdc++ to LIBS list?)

6. Bug in MakeMaker? (How to add stdc++ to LIBS list?)

7. Q on perl5 build on Linux w/ shared libs

8. Building Tcl/Tk libs as shared/dynamic loading

9. Are there Perl libs for MS Access(.mdb) databse files

10. mh libs, for context, msg-num parsing

11. dynamic module creation without shared libs?

12. Help: Seeking cgi and html libs...


Powered by phpBB® Forum Software