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

Hi all.

Today I tried to install Algorithm::FastPermute by robin. Unfortunately it fails to build under W2k/AS629.

I get the following error and I dont have a clue what to do about it (not a perlguts/perlxs/c kinda guy just yet... :-)

FastPermute.obj : error LNK2001: unresolved external symbol _Perl_cxin +c blib\arch\auto\Algorithm\FastPermute\FastPermute.dll : fatal error LNK1120: 1 unresolved externals NMAKE : fatal error U1077: 'link' : return code '0x460'
Any ideas?

Yves / DeMerphq
--
When to use Prototypes?
Advanced Sorting - GRT - Guttman Rosler Transform

Replies are listed 'Best First'.
Re: Building Algorithm::FastPermute under AS
by robin (Chaplain) on Mar 05, 2002 at 14:20 UTC
    Other people have mentioned this problem before, but I'm ashamed to say that I can't remember whether there's a solution. According to Edwin Pratomo, who has done some investigation, the problem is the use of the PUSHBLOCK macro (in the FastPermute source code) in conjunction with the MULTIPLICITY option (which ActiveState use to compile their perls).

    Do you have the same problem with Graham Barr's Scalar-List-Utils package? That package also uses PUSHBLOCK, so I wonder how it has been made to work. Does anyone have any ideas?

      This is the most recent change from Scalar-List-Utils-1.06/ChangeLog:
      Change 645 on 2001/09/07 by <gbarr@pobox.com> (Graham Barr) Some platforms require the main executable to export symbols needed by modules. In 5.7.2 and prior releases of perl Perl_cxinc was not exported so we need to duplicate its functionality
      I'm sure that's the same problem that you're seeing. I'll see if I can steal Graham's solution and add it to Algorithm::FastPermute.
        Yes it would appear that you have resolved the problem.

        I havent tried to use it yet so this could be premature (but probably isnt) but it passed all the tests and installed fine.

        I just wanted to say that your responsiveness regarding this issue is/should be an example to the many who post XS modules that wont build under AS/Cygwin. Not all of us are good enough C programmers to figure this stuff out themselves. I know im not anyway.

        BTW heres the output, thanks a million.

        D:\Perl\HandBuild\Algorithm-FastPermute-0.05>perl makefile.pl Checking if your kit is complete... Looks good Writing Makefile for Algorithm::FastPermute D:\Perl\HandBuild\Algorithm-FastPermute-0.05>nmake Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 Copyright (C) Microsoft Corp 1988-1998. All rights reserved. cp FastPermute.pm blib\lib\Algorithm\FastPermute.pm cp perms.pl blib\lib\Algorithm\perms.pl D:\Perl\bin\Perl.exe -ID:\Perl\lib -ID:\Perl\lib D:\Perl\lib\E +xtUtils/xsubpp -typemap D:\Perl\lib\ExtUtils\type map FastPermute.xs > FastPermute.xsc && D:\Perl\bin\Perl.exe -ID:\Perl +\lib -ID:\Perl\lib -MExtUtils::Command -e mv FastP ermute.xsc FastPermute.c cl -c -nologo -O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT + -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_ IMPLICIT_SYS -DPERL_MSVCRT_READFIX -pg -DVERSION=\"0.05\" -DXS_VER +SION=\"0.05\" -ID:\Perl\lib\CORE FastPermute.c Command line warning D4002 : ignoring unknown option '-pg' FastPermute.c "Running Mkbootstrap for Algorithm::FastPermute ()" D:\Perl\bin\Perl.exe -ID:\Perl\lib -ID:\Perl\lib -MExtUtils::C +ommand -e chmod 644 FastPermute.bs D:\Perl\bin\Perl.exe "-ID:\Perl\lib" "-ID:\Perl\lib" -MExtUtil +s::Mksymlists -e "Mksymlists('NAME' => 'Algorithm ::FastPermute', 'DLBASE' => 'FastPermute', 'DL_FUNCS' => { }, 'FUNCLI +ST' => [], 'IMPORTS' => { }, 'DL_VARS' => []);" link -out:blib\arch\auto\Algorithm\FastPermute\FastPermute.dll + -dll -nologo -nodefaultlib -release -libpath:"D: \Perl\lib\CORE" -machine:x86 FastPermute.obj D:\Perl\lib\CORE\perl5 +6.lib oldnames.lib kernel32.lib user32.lib gdi32.l ib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleau +t32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib -def:FastPe +rmute.def Creating library blib\arch\auto\Algorithm\FastPermute\FastPermute.l +ib and object blib\arch\auto\Algorithm\FastPermute \FastPermute.exp D:\Perl\bin\Perl.exe -ID:\Perl\lib -ID:\Perl\lib -MExtUtils::C +ommand -e chmod 755 blib\arch\auto\Algorithm\FastP ermute\FastPermute.dll D:\Perl\bin\Perl.exe -ID:\Perl\lib -ID:\Perl\lib -MExtUtils::C +ommand -e cp FastPermute.bs blib\arch\auto\Algorit hm\FastPermute\FastPermute.bs D:\Perl\bin\Perl.exe -ID:\Perl\lib -ID:\Perl\lib -MExtUtils::C +ommand -e chmod 644 blib\arch\auto\Algorithm\FastP ermute\FastPermute.bs D:\Perl\HandBuild\Algorithm-FastPermute-0.05>nmake test Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 Copyright (C) Microsoft Corp 1988-1998. All rights reserved. D:\Perl\bin\Perl.exe -Iblib\arch -Iblib\lib -ID:\Perl\lib -ID: +\Perl\lib test.pl 1..8 ok 1 ok 2 ok 3 ok 4 ok 5 ok 6 ok 7 ok 8 D:\Perl\HandBuild\Algorithm-FastPermute-0.05>nmake install Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 Copyright (C) Microsoft Corp 1988-1998. All rights reserved. Installing D:\Perl\site\lib\auto\Algorithm\FastPermute\FastPermute.bs Installing D:\Perl\site\lib\auto\Algorithm\FastPermute\FastPermute.dll Installing D:\Perl\site\lib\auto\Algorithm\FastPermute\FastPermute.exp Installing D:\Perl\site\lib\auto\Algorithm\FastPermute\FastPermute.lib Installing D:\Perl\site\lib\Algorithm\FastPermute.pm Installing D:\Perl\site\lib\Algorithm\perms.pl Writing D:\Perl\site\lib\auto\Algorithm\FastPermute\.packlist Appending installation info to D:\Perl\lib/perllocal.pod

        Yves / DeMerphq
        --
        When to use Prototypes?
        Advanced Sorting - GRT - Guttman Rosler Transform

Algorithm::FastPermute 0.05
by robin (Chaplain) on Mar 05, 2002 at 17:48 UTC
    Algorithm::FastPermute 0.05 is making its way to the CPAN. Until it reaches your local mirror, you can grab it from http://London.pm.org/~robin/Algorithm-FastPermute-0.05.tar.gz.

    This release is functionally identical to the previous one, but should be more portable. It has been reported to work on Win32 and IRIX, and has also been tested against Perl 5.005.

    Thanks to demerphq for reporting the problem, and to gbarr for (unwittingly) fixing it.

Re: Building Algorithm::FastPermute under AS
by demerphq (Chancellor) on Mar 05, 2002 at 10:37 UTC
    Oh and under cygwin my colleague gets the following results, note its a different error.
    CPAN.pm: Going to build R/RO/ROBIN/Algorithm-FastPermute-0.03.tar.gz Checking if your kit is complete... Looks good Writing Makefile for Algorithm::FastPermute cp FastPermute.pm blib/lib/Algorithm/FastPermute.pm cp perms.pl blib/lib/Algorithm/perms.pl /usr/bin/perl -I/usr/lib/perl5/5.6.1/cygwin-multi -I/usr/lib/perl5/5.6 +.1 /usr/li b/perl5/5.6.1/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.6.1/ExtUtils/ +typemap Fa stPermute.xs > FastPermute.xsc && mv FastPermute.xsc FastPermute.c gcc -c -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -I/usr/local/inclu +de -DUSEIM PORTLIB -pg -DVERSION=\"0.03\" -DXS_VERSION=\"0.03\" -I/usr/lib/per +l5/5.6.1/c ygwin-multi/CORE FastPermute.c Running Mkbootstrap for Algorithm::FastPermute () chmod 644 FastPermute.bs rm -f blib/arch/auto/Algorithm/FastPermute/FastPermute.dll LD_RUN_PATH="" ld2 -s -L/usr/local/lib FastPermute.o -o blib/arch/au +to/Algorit hm/FastPermute/FastPermute.dll /usr/lib/perl5/5.6.1/cygwin-multi/CORE +/libperl5_ 6_1.a dllwrap --dllname FastPermute.dll --driver-name gcc --dlltool dlltool +--export-a ll-symbols --as as --output-def libFastPermute.def --output-lib libFas +tPermute.a \ -s -L/usr/local/lib FastPermute.o /usr/lib/perl5/5.6.1/cygwin-multi/C +ORE/libper l5_6_1.a dllwrap: no export definition file provided dllwrap: creating one, but that may not be what you want FastPermute.o(.text+0x11):FastPermute.c: undefined reference to `mcoun +t' FastPermute.o(.text+0x252):FastPermute.c: undefined reference to `mcou +nt' FastPermute.o(.text+0xdef):FastPermute.c: undefined reference to `mcou +nt' collect2: ld returned 1 exit status dllwrap: gcc exited with status 1 perlld: *** system() failed to execute dllwrap --dllname FastPermute.dll --driver-name gcc --dlltool dlltool +--export-a ll-symbols --as as --output-def libFastPermute.def --output-lib libFas +tPermute.a \ -s -L/usr/local/lib FastPermute.o /usr/lib/perl5/5.6.1/cygwin-multi/C +ORE/libper l5_6_1.a make: *** [blib/arch/auto/Algorithm/FastPermute/FastPermute.dll] Error + 1 /cygdrive/d/cygwin/bin/make -- NOT OK Running make test Can't test without successful make Running make install make had returned bad status, install seems impossible mdupont@PI{~} #perl -V Summary of my perl5 (revision 5.0 version 6 subversion 1) configuratio +n: Platform: osname=cygwin, osvers=1.3.2(0.3932), archname=cygwin-multi uname='cygwin_nt-4.0 loreley 1.3.2(0.3932) 2001-05-20 23:28 i686 u +nknown ' config_args='-de -Dusemultiplicity' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultipl +icity=def ne useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef Compiler: cc='gcc', ccflags ='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -I +/usr/loca /include', optimize='-O2', cppflags='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -I/usr/local +/include' ccversion='', gccversion='2.95.3-5 (cygwin special)', gccosandvers +='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +2 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', + lseeksiz =4 alignbytes=8, usemymalloc=y, prototype=define Linker and Libraries: ld='ld2', ldflags =' -s -L/usr/local/lib' libpth=/usr/local/lib /usr/lib /lib libs=-lgdbm -lcrypt perllibs=-lcrypt libc=/usr/lib/libc.a, so=dll, useshrplib=true, libperl=libperl5_6_ +1.a Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' -s' cccdlflags=' ', lddlflags=' -s -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_LARGE_FILES PERL_IMPLICIT_CON +TEXT Built under cygwin Compiled at Aug 22 2001 01:05:05 @INC: /usr/lib/perl5/5.6.1/cygwin-multi /usr/lib/perl5/5.6.1 /usr/lib/perl5/site_perl/5.6.1/cygwin-multi /usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl

    Yves / DeMerphq
    --
    When to use Prototypes?
    Advanced Sorting - GRT - Guttman Rosler Transform