Tels <[EMAIL PROTECTED]> writes:
>> And GCC et. al. don't look in there by default.
>> You need a -L
>> Tk has:
>>
>> #     LIBS => [q[-L/usr/X11R6/lib -lX11 -lnsl -lm]]
>>
>> After its Makefile.PL has done some poking about.
>
>Toni Schindl already gave me this tip, but there is one more trick involved:
>
>     LIBS => ['-L"/usr/X11R6/lib" -lX11 -lnsl -lm'],
>
>does _not_ work, The '"' make it fail. This works:
>
>     LIBS => ['-L/usr/X11R6/lib -lX11 -lnsl -lm'],

Which is what I said, but for use of q[] rather than '' ;-)

>
>(For whatever reasons, there is no good documentation in MakeMaker.pm
>detailing what goes into LIBS and why).

Basically it is a list of things to pass to your cc/ld.
MakeMaker knows the basic UNIX cc/ld rules and will drop
libs it cannot find. Which is good and most ld-s will
fail if asked to link against a non-existant library.
MakeMaker also handles setting LD_RUN_PATH to 
match the -L's that got used.

>
>However, attached are two files: my Makefile.PL and a batch file to compile
>the module manually. The batch file works, the Makefile.PL not. I have no
>idea why not. The .so file generated by the Makefile.PL version is 2 K
>shorter and misses the references to the X libs (and thus fails to load).
>The one by the batch file is fine. I now hacked my testsuite first to
>compile the .so file via the shell script - which is unportable but at
>least lets me test it locally.
>
>Any insight would be greatly appreciated!

MakeMaker has:
'LIBS'          => [ '-L/usr/X11R6/lib -L/usr/local/lib/Irrlicht 
                      -lX11 -lXext -lXxf86vm -lIrrlicht -lGL -ljpeg -lz' ],

Script has:

 -L"/usr/X11R6/lib" -L"/usr/local/lib/Irrlicht" 
     -lIrrlicht -lGL -lXxf86vm -lXext -lX11 -ljpeg -lz

Note the ORDER of the -l's.
When you link with MM one when ld searches -lX11 it finds nothing it needs
because it hasn't seen the other -l's yet.

The script's order is sane. The user lib uses GL which uses Xxf86 ...
Your Makefile.PL order is broken.

The snag is that the -shared (or other "build a .so" option(s))
turn OFF checking for unresolved refs - because it is 
assumed such symbols will be provided by the thing into 
which it is loaded. Running 'nm' on the .so will show why 
for a perl XS there are LOTs of symbols that come from perl. 



>
>Cheers,
>
>Tels
>
>
>- --
> Signed on Sat Feb 28 19:20:29 2004 with key 0x93B84C15.
> Visit my photo gallery at http://bloodgate.com/photos/
> PGP key on http://bloodgate.com/tels.asc or per email.
>
> "Retsina?" - "Ja, Papa?" - "Warp 3." - "Is gut, Papa."
>
>
>
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)
>Comment: When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl.
>
>iQEVAwUBQEDiT3cLPEOTuEwVAQEk9gf8DgEQtQ8jdaTbwr0WsKnnuq4zqBRd8F4w
>FyLXWcE7pkdmXkkrrzwJ8dnBuPsydm0TLt/Dcp4rV4aNKZY0h2TG3ZRR3EbByTGo
>MSJOjOTDah0d5j+ICK6JyG2bzpGXhXSXeVYRSDgWJaoRdNdyCMXnXHFc59B0Budo
>CNaDqBqYs8BMbn2yLn/kQ7L4/5CRW/oQCup0hmFjyUntiKLLSa4DkWEmln4NlWhF
>m8DsTot4eVo+HhZTqPav2s2L1HpzdB0A5ECx9kwfSMRxdb+cBZiEGQWgYMv3yjo0
>vJ7X30SK23CHrTK8erFv/eongtZNG5vZN3Ov4T1QXzAm3/cwLEcfyw==
>=J/xF
>-----END PGP SIGNATURE-----

Reply via email to