I have a few questions about building modules linked against libraries
that are installed in non-standard locations, and a specific question
about why I can't link to zlib on Solaris.

First, I want to provide instructions in a README that will work for 
Perl >= 5.00503.  What's the correct way to build a module that requires a
library that was installed in a non-standard location (for example, if
someone does not have root)?

In the past I've suggested using LIBS and CCFLAGS (or INC) as in this
example:

First, build some C application that installs a library (in $HOME/foo/lib
in this case):

   $ ./configure --prefix=$HOME/foo
   $ make && make install

Then build the Perl module like this:

   $ cd perl
   $ perl Makefile.PL \
     CCFLAGS=-I$HOME/foo/include \
     LIBS='-lz -L$HOME/foo/lib -lswish-e'
   $ LD_RUN_PATH=$HOME/foo/lib make

- I'm not clear when to use INC vs. CCFLAGS.

- It would seem what I should do is simply *add* paths to existing
settings in Makefile.PL.  Can that be done from the command line, or is
that inadvisable for some reason?

- It also seems that I only sometimes need to use LD_RUN_PATH (sometimes
it is set for me by MakeMaker).  Is that an issue with the MakeMaker
version?


Now, a more specific question about zlib linking.

A few times now on Solaris machines I've had problems linking with zlib
and I'm not sure why.

For example, I remember an issue with libz and libxml2:
http://mail.gnome.org/archives/xml/2001-September/msg00088.html

Anyway, I think I'm specifying the paths correctly so I'm a bit lost to
why this isn't working (and why I'm able to build Compress::Zlib without
any problems):

Here's building the module (which links to zlib and also to libswish-e.a
installed in $HOME/brian/lib):

perl Makefile.PL \
 INC=-I$HOME/brian/include \ 
 LIBS="-L/usr/local/lib -lz -L$HOME/brian/lib -lswish-e"

Then the make line looks like:

LD_RUN_PATH="/usr/local/lib:/data/_g/lii/brian/lib" gcc -B/usr/ccs/bin/ -o
blib/arch/auto/SWISH/API/API.so 
-R/usr/local/lib -R/data/_g/lii/brian/lib
-G -L/usr/local/lib API.o    -L/usr/local/lib -lz 
-L/data/_g/lii/brian/lib -lswish-e


Make test results in:

...fatal: relocation error: file blib/arch/auto/SWISH/API/API.so: symbol
compress2: referenced symbol not found at...

Here's the function in libz.a:

%nm /usr/local/lib/libz.a | grep compress2
[6]     |       160|     168|FUNC |GLOB |0    |2      |compress2

and the unresolved 

%nm blib/arch/auto/SWISH/API/API.so | grep compress2
[610]   |         0|       0|NOTY |GLOB |0    |UNDEF  |compress2


To compare, Compress::Zlib, which builds fine, builds like:

LD_RUN_PATH="/usr/local/lib" gcc -B/usr/ccs/bin/ -o
blib/arch/auto/Compress/Zlib/Zlib.so    
-R/usr/local/lib -G -L/usr/local/lib Zlib.o    
-L/usr/local/lib -lz 

Which looks basically the same with regard to zlib.  So I'm missing
something.


BTW - should the difference in compilers be an issues?

gcc version 3.2.1
This is perl, version 5.005_03 built for sun4-solaris
  Compiler:
    cc='gcc -B/usr/ccs/bin/', optimize='-O', gccversion=2.95.1 19990816 (release)








-- 
Bill Moseley [EMAIL PROTECTED]




Reply via email to