Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

nmake-ing Compress::Bzip2 in Win32 errors fatally

by idnopheq (Chaplain)
on Sep 01, 2001 at 16:31 UTC ( [id://109629]=perlquestion: print w/replies, xml ) Need Help??

idnopheq has asked for the wisdom of the Perl Monks concerning the following question:

Hi ho, all!

I have code that uses Compress::Bzip2 on Solaris, Linux, and FreeBSD. Runs beautifully! But, now I need it on some Win32 boxen.

I grabbed BZip2 and built the executables and dll from the 1.0.1 source ( w/ some minor modifications to the makefile ... and using PPT's cmp! ). I grabbed Compress::Bzip2, modified Makefile.PL for my system's include and lib paths, and tried to nmake it. Below the readmore tag is the result. Please note that I am on a W2K SP2 box w/ VC++ 6 and AS perl 629 ( hense the need for VC++ and not MinGW gcc ). BTW, I also tried w/ the precompiled Win32 stuff from the BZip2 site, with no change in results.

I looked into Compress::Zlib for illumination, but the differences are many, and my attempts at reconsilling them failed miserably.

The CHANGES file from BZip2 says "Avoid library namespace pollution. Prefix all exported symbols with BZ2_.". I made the change to the Bzip2.xs file, with only cosmetic changes to the output below. I downreved the BZip2 to v.9, with negative results.

I don't program C on Win32, or at least not on M$ products since DOS 5. And, I tried to contact the module's author, but his email address seems defunct.

Anyone have advice on how to proceed ( please no CygWin or UWin answers, and I don't want to backtick if I can avoid it )? My guess is that it isn't seeing the libbz2.dll file, but I'm not certain.

C:\incoming\Compress-Bzip2-1.00>perl Makefile.PL Note (probably harmless): No library found for '-lbz2' Writing Makefile for Compress::Bzip2 C:\incoming\Compress-Bzip2-1.00>nmake Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 Copyright (C) Microsoft Corp 1988-1998. All rights reserved. cp Bzip2.pm blib\lib\Compress\Bzip2.pm AutoSplitting blib\lib\Compress\Bzip2.pm (blib\lib\auto\Compress\Bzip2 +) C:\usr\bin\Perl.exe -IC:\usr\lib -IC:\usr\lib C:\usr\lib\ExtUt +ils/xsubpp -typemap C:\usr\lib\ExtUtils\typemap -typemap typemap Bzip2.xs > Bzi +p2.xsc && C:\usr\bin\Perl.exe -IC:\usr\lib -IC:\usr\lib -MExtUtils::Command -e m +v Bzip2.xs c Bzip2.c cl -c -I/usr/include -nologo -O1 -MD -DNDEBUG -DWIN32 -D_CONSO +LE -DNO_ST RICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DP +ERL_MSVCRT _READFIX -O1 -MD -DNDEBUG -DVERSION=\"1.00\" -DXS_VERSION=\"1.00\" + -IC:\usr \lib\CORE Bzip2.c Bzip2.c "Running Mkbootstrap for Compress::Bzip2 ()" C:\usr\bin\Perl.exe -IC:\usr\lib -IC:\usr\lib -MExtUtils::Comm +and -e chm od 644 Bzip2.bs C:\usr\bin\Perl.exe "-IC:\usr\lib" "-IC:\usr\lib" -MExtUtils:: +Mksymlists -e "Mksymlists('NAME' => 'Compress::Bzip2', 'DLBASE' => 'Bzip2', 'DL +_FUNCS' => { }, 'FUNCLIST' => [], 'IMPORTS' => { }, 'DL_VARS' => []);" link -out:blib\arch\auto\Compress\Bzip2\Bzip2.dll -dll -nologo + -nodefaul tlib -release -libpath:"C:\usr\lib\CORE" -machine:x86 Bzip2.obj C: +\usr\lib\C ORE\perl56.lib "C:\Program Files\Microsoft Visual Studio\VC98\lib\oldn +ames.lib" "C:\Program Files\Microsoft Visual Studio\VC98\lib\kernel32.lib" "C:\P +rogram Fil es\Microsoft Visual Studio\VC98\lib\user32.lib" "C:\Program Files\Micr +osoft Visu al Studio\VC98\lib\gdi32.lib" "C:\Program Files\Microsoft Visual Studi +o\VC98\lib \winspool.lib" "C:\Program Files\Microsoft Visual Studio\VC98\lib\comd +lg32.lib" "C:\Program Files\Microsoft Visual Studio\VC98\lib\advapi32.lib" "C:\P +rogram Fil es\Microsoft Visual Studio\VC98\lib\shell32.lib" "C:\Program Files\Mic +rosoft Vis ual Studio\VC98\lib\ole32.lib" "C:\Program Files\Microsoft Visual Stud +io\VC98\li b\oleaut32.lib" "C:\Program Files\Microsoft Visual Studio\VC98\lib\net +api32.lib" "C:\Program Files\Microsoft Visual Studio\VC98\lib\uuid.lib" "C:\Prog +ram Files\ Microsoft Visual Studio\VC98\lib\wsock32.lib" "C:\Program Files\Micros +oft Visual Studio\VC98\lib\mpr.lib" "C:\Program Files\Microsoft Visual Studio\VC +98\lib\win mm.lib" "C:\Program Files\Microsoft Visual Studio\VC98\lib\version.lib +" "C:\Prog ram Files\Microsoft Visual Studio\VC98\lib\odbc32.lib" "C:\Program Fil +es\Microso ft Visual Studio\VC98\lib\odbccp32.lib" "C:\Program Files\Microsoft Vi +sual Studi o\VC98\lib\msvcrt.lib" -def:Bzip2.def Creating library blib\arch\auto\Compress\Bzip2\Bzip2.lib and object + blib\arch \auto\Compress\Bzip2\Bzip2.exp Bzip2.obj : error LNK2001: unresolved external symbol _BZ2_bzBuffToBuf +fCompress@ 28 Bzip2.obj : error LNK2001: unresolved external symbol _BZ2_bzBuffToBuf +fDecompres s@24 Bzip2.obj : error LNK2001: unresolved external symbol _BZ2_bzlibVersio +n@0 blib\arch\auto\Compress\Bzip2\Bzip2.dll : fatal error LNK1120: 3 unres +olved exte rnals NMAKE : fatal error U1077: 'link' : return code '0x460' Stop.

HTH
--
idnopheq
Apply yourself to new problems without preparation, develop confidence in your ability to to meet situations as they arrise.

Replies are listed 'Best First'.
Re: nmake-ing Compress::Bzip2 in Win32 errors fatally
by wog (Curate) on Sep 01, 2001 at 19:06 UTC
    Your problem appears to be described in this line:

    Note (probably harmless): No library found for '-lbz2'

    This error is not harmless in this case. It means that MakeMaker has failed to find the DLL for bzip2. You should be able to fix this by changing Makefile.PL from having something like:

    LIBS => "-lbz2",

    To something specifying the full path to the bz2 DLL like:

    LIBS => '-LC:\some\directory -lbz2'

    And I think that'll fix your problem. If it doesn't work, you should try to, at least, see if you can tweak the Makefile.PL until you get no warning like that.

nmake-ing Compress::Bzip2 in Win32 errors fatally ***FIXED***
by idnopheq (Chaplain) on Sep 02, 2001 at 16:26 UTC
    Morning ( EDT ) all!

    With some help from wog and bikeNomad, Compress::Bzip2 seems to have finally compiled for Win32. You can get it from http://idnopheq.perlmonk.org/perl/packages/.

    ActiveState perl 5.6.1 users can get it via PPM thusly:

    ppm install --location=http://idnopheq.perlmonk.org/perl/packages Compress-Bzip2

    I'm testing it as I type. Please try it out and /msg me if you find problems.

    For those who wondered how I built it, here are the steps I took ( must have VC++ 6 ):

    1. Download BZip2 Sources
    2. Extract the thing ( gzip -dc bzip2-1.0.1.tar.gz | tar xvf - )
    3. Perform nmake -f makefile.msc ***Note*** I did not see the VC++ makefile in the archive. Had I earlier, this would have been far easier!
    4. Perform nmake install
    5. Acquire Compress::Bzip2, and extract it like above.
    6. Edit the Makefile.PL, adjusting the $Bzip2_INCLUDE and $Bzip2_LIB to taste, based off of where you installed BZip2 from above.
    7. Execute perl Makefile.PL
    8. Edit the Bzip2.xs, prefixing BZ2_ to each of the Bzip2 calls. i.e. - bzlibVersion() to BZ2_bzlibVersion().
    9. Execute nmake && nmake install
    That's it!

    HTH
    --
    idnopheq
    Apply yourself to new problems without preparation, develop confidence in your ability to to meet situations as they arrise.

Re: nmake-ing Compress::Bzip2 in Win32 errors fatally
by idnopheq (Chaplain) on Sep 01, 2001 at 19:37 UTC
    Big THX to wog for the assist, but it's a no go. To help out, here's the Makefile.PL:

    require 5.003; use ExtUtils::MakeMaker 5.16; use Config; $Bzip2_INCLUDE = '-I/usr/include'; #$Bzip2_INCLUDE = '-I/usr/local/include'; #$Bzip2_INCLUDE = '-I/usr/local/include/bzip2'; $Bzip2_LIB = '-L/usr/lib -L.'; WriteMakefile( NAME => 'Compress::Bzip2', VERSION_FROM => 'Bzip2.pm', LIBS => [ "$Bzip2_LIB -lbz2" ], INC => "$Bzip2_INCLUDE", 'dist' => {COMPRESS=>'bzip2', SUFFIX=>'bz2'}, ) ;

    The libbz2.dll is in c:\usr\lib, c:\incoming\compress-bzip2-1.00 ( the pwd ), and c:\winnt\system32. I've made several tweeks to the Makefile.PL, but all fail. Note that the headers, etc. are picked up fine ...

    BTW, if I get this bad boy compiled, I will of course share w/ the community ...

    HTH
    --
    idnopheq
    Apply yourself to new problems without preparation, develop confidence in your ability to to meet situations as they arrise.

      So you have a libbz2.lib (an import lib) to go with your DLL? Note that the linker doesn't care about your DLL for symbol resolution; it needs an import lib.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://109629]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-12-03 09:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found