Skip Menu |

This queue is for tickets about the Algorithm-FastPermute CPAN distribution.

Report information
The Basics
Id: 4905
Status: resolved
Priority: 0/
Queue: Algorithm-FastPermute

People
Owner: robin [...] cpan.org
Requestors: muenalan [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.05
Fixed in: (no value)



Subject: [win32/activestate5.8.3] unresolved external symbol _cxinc
The trick from graham seems to suck. There is also this suspective line in FastPermute.xs Renew(cxstack, cxstack_max + 1, struct context); /* XXX should fix CXINC macro */ But my XS knowledge ends here. Sorry but it did not lead to a patch. Cheers, Murat --- V:\.cpan\build\Algorithm-FastPermute-0.05>nmake Microsoft (R) Program Maintenance Utility Version 7.00.9466 Copyright (C) Microsoft Corporation. All rights reserved. cp perms.pl blib\lib\Algorithm\perms.pl cp FastPermute.pm blib\lib\Algorithm\FastPermute.pm Z:\www\perl\bin\perl.exe Z:\www\perl\lib\ExtUtils/xsubpp -typemap Z:\www\perl\lib\ExtUtils\typemap FastPermute.xs > FastPermute.xsc && Z:\www\perl\bin\perl.exe -MExtUtils::Com mand -e mv FastPermute.xsc FastPermute.c cl -c -nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSV CRT_READFIX -pg -DVERSION=\"0.05\" -DXS_VERSION=\"0.05\" "-IZ:\www\perl\lib\CORE" FastPermute.c cl : Command line warning D4002 : ignoring unknown option '-pg' FastPermute.c FastPermute.xs(151) : warning C4013: 'cxinc' undefined; assuming extern returning int Running Mkbootstrap for Algorithm::FastPermute () Z:\www\perl\bin\perl.exe -MExtUtils::Command -e chmod 644 FastPermute.bs Z:\www\perl\bin\perl.exe -MExtUtils::Mksymlists -e "Mksymlists('NAME'=>\"Algorithm::FastPermute\", 'DLBASE' => 'FastPermute', 'DL_FUNCS' => { }, 'FUNCLIST' => [], 'IMPORTS' => { }, 'DL_VARS' => []);" link -out:blib\arch\auto\Algorithm\FastPermute\FastPermute.dll -dll -nologo -nodefaultlib -debug -opt:ref,icf -libpath:"z:\www\perl\lib\CORE" -machine:x86 FastPermute.obj Z: \www\perl\lib\CORE\perl58.lib oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.li b mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib -def:FastPermute.def Creating library blib\arch\auto\Algorithm\FastPermute\FastPermute.lib and object blib\arch\auto\Algorithm\FastPermute\FastPermute.exp FastPermute.obj : error LNK2019: unresolved external symbol _cxinc referenced in function _XS_Algorithm__FastPermute_permute blib\arch\auto\Algorithm\FastPermute\FastPermute.dll : fatal error LNK1120: 1 unresolved externals NMAKE : fatal error U1077: 'link' : return code '0x460' Stop. --- Summary of my perl5 (revision 5 version 8 subversion 2) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=undef use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DP ERL_MSVCRT_READFIX', optimize='-MD -Zi -DNDEBUG -O1', cppflags='-DWIN32' ccversion='', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -libpath:"z:\www\perl\lib\CORE" -machine:x86' libpth=C:\PROGRA~1\MICROS~3\VC98\lib libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm .lib version.lib odbc32.lib odbccp32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib gnulibc_version='undef' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -libpath:"z:\www\perl\lib\CORE" -machine:x86' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS Locally applied patches: ActivePerl Build 808 21846 Configure gets d_u32align wrong 21739 [perl #24493] install.html not working 21737 Ooops. left an XXX comment in, and worse still it's a // comment 21735 utf8 keys now work for tied hashes 21734 Accessing unicode keys in tie hashes via hv_exists was broken 21733 ext/threads/t/problem.t 21732 Config::myconfig() fails under ithreads 21728 Update perlhist with 5.6.2 21723 Include 'SCCS' in the list of dir names ignored by installperl 21718 Empty subroutine as object method segfaults in 5.8.2 (sometimes) 21714 Fix bug #24380: assigning list with duplicated keys to a hash 21706 [perl #24460] [DOC PATCH] the begincheck program 21693 must copy changes from win32/makeifle.mk to wince/makefile.ce 21691 Update the list of pumpkings in perlhist.pod 21687 [PATCH 5.6.2-RC1 pod/perlhist.pod] Updated 21677 OS/2 docu 21676 Bug #24407: key for shared hash got stringified into wrong pool 21673 Be sure to use -fPIC not -fpic on Linux/SPARC 21672 extending the hash attack test 21671 Benchmark.pm cmpthese segfault 21662 'make minitest' fails for op/cproto and op/pat 21586 Comment that this 'optimisation' is actually a necessary fixup 21548 Sync with Pod::Perldoc 3.12 21540 Fix backward-compatibility issues in if.pm Built under MSWin32 Compiled at Dec 9 2003 10:19:40 @INC: Z:/www/perl/lib Z:/www/perl/site/lib .
Could you try the attached replacement for FastPermute.xs, and let me know whether it works (or if not, how it fails)?
#include "EXTERN.h" #include "perl.h" #include "XSUB.h" /* For 5.005 compatibility */ #ifndef aTHX_ # define aTHX_ #endif #ifndef aTHX # define aTHX #endif #ifndef pTHX # define pTHX #endif #ifndef pTHX_ # define pTHX_ #endif #ifdef ppaddr # define PL_ppaddr ppaddr #endif /* This hack is stolen from Graham Barr's Scalar-List-Utils package. The comment therein runs: Some platforms have strict exports. And before 5.7.3 cxinc (or Perl_cxinc) was not exported. Therefore platforms like win32, VMS etc have problems so we redefine it here -- GMB With any luck, it will enable us to build under ActiveState Perl. */ #ifndef SvUOK # define SvUOK(sv) SvIOK_UV(sv) #endif #ifndef cxinc # define cxinc() my_cxinc(aTHX) static I32 my_cxinc(pTHX) { cxstack_max = cxstack_max * 3 / 2; Renew(cxstack, cxstack_max + 1, struct context); /* XXX should fix CXINC macro */ return cxstack_ix + 1; } #endif /* Prior to version 0.04 we would assign to AvARRAY(array). Unfortunately * that expands to an assignment which has a typecast on the left-hand side. * So it was technically illegal, but GCC is decent enough to accept it * anyway. Unfortunately other compilers are not usually so forgiving... */ #define AvARRAY_set(av, val) ((XPVAV*) SvANY(av))->xav_array = (char*) val void permute_engine(AV* av, SV** array, I32 level, I32 len, SV*** tmparea, OP* callback) { SV** copy = tmparea[level]; int index = level; bool calling = (index + 1 == len); SV* tmp; Copy(array, copy, len, SV*); if (calling) AvARRAY_set(av, copy); do { if (calling) { PL_op = callback; CALLRUNOPS(aTHX); } else { permute_engine(av, copy, level + 1, len, tmparea, callback); } if (index != 0) { tmp = copy[index]; copy[index] = copy[index - 1]; copy[index - 1] = tmp; } } while (index-- > 0); } MODULE = Algorithm::FastPermute PACKAGE = Algorithm::FastPermute void permute(callback_sv, array_sv) SV* callback_sv; SV* array_sv; PROTOTYPE: &\@ PREINIT: AV* array; CV* callback; I32 x; I32 len; SV*** tmparea; SV** array_array; U32 array_flags; SSize_t array_fill; SV** copy = 0; /* Non-magical SV list for magical array */ PERL_CONTEXT* cx; I32 gimme = G_VOID; /* We call our callback in VOID context */ I32 saved_cxstack_ix; PERL_CONTEXT* saved_cxstack; bool old_catch; PPCODE: if (!SvROK(callback_sv) || SvTYPE(SvRV(callback_sv)) != SVt_PVCV) Perl_croak(aTHX_ "Callback is not a CODE reference"); if (!SvROK(array_sv) || SvTYPE(SvRV(array_sv)) != SVt_PVAV) Perl_croak(aTHX_ "Array is not an ARRAY reference"); callback = (CV*)SvRV(callback_sv); array = (AV*)SvRV(array_sv); len = 1 + av_len(array); if (SvREADONLY(array)) Perl_croak(aTHX_ "Can't permute a read-only array"); if (len == 0) { /* Should we warn here? */ return; } array_array = AvARRAY(array); array_flags = SvFLAGS(array); array_fill = AvFILLp(array); /* Magical array. Realise it temporarily. */ if (SvRMAGICAL(array)) { copy = (SV**) malloc (len * sizeof *copy); for (x=0; x < len; x++) { SV **svp = av_fetch(array, x, FALSE); copy[x] = (svp) ? SvREFCNT_inc(*svp) : &PL_sv_undef; } SvRMAGICAL_off(array); AvARRAY_set(array, copy); AvFILLp(array) = len - 1; } SvREADONLY_on(array); /* Can't change the array during permute */ /* Allocate memory for the engine to scribble on */ tmparea = (SV***) malloc( (len+1) * sizeof *tmparea); for (x = len; x >= 0; x--) tmparea[x] = malloc(len * sizeof **tmparea); /* Set up the context for the callback */ SAVESPTR(CvROOT(callback)->op_ppaddr); CvROOT(callback)->op_ppaddr = PL_ppaddr[OP_NULL]; /* Zap the OP_LEAVESUB */ #ifdef PAD_SET_CUR PAD_SET_CUR(CvPADLIST(callback),1); #else SAVESPTR(PL_curpad); SAVESPTR(PL_comppad); PL_curpad = AvARRAY((AV*)AvARRAY(CvPADLIST(callback))[1]); #endif SAVETMPS; SAVESPTR(PL_op); saved_cxstack = cxstack; saved_cxstack_ix = cxstack_ix; PUSHBLOCK(cx, CXt_NULL, SP); /* make a pseudo block */ cxstack += cxstack_ix; /* deny the existence of anything outside */ cxstack_ix = 0; old_catch = CATCH_GET; CATCH_SET(TRUE); permute_engine(array, AvARRAY(array), 0, len, tmparea, CvSTART(callback)); CATCH_SET(old_catch); /* PerlIO_stdoutf("Back from engine\n"); */ dounwind(-1); cxstack = saved_cxstack; cxstack_ix = saved_cxstack_ix; for (x = len - 1; x >= 0; x--) free(tmparea[x]); free(tmparea); if (copy) { for (x=0; x < len; x++) SvREFCNT_dec(copy[x]); free(copy); } AvARRAY_set(array, array_array); SvFLAGS(array) = array_flags; AvFILLp(array) = array_fill;
[ROBIN - Mon Jan 12 09:29:32 2004]: Show quoted text
> Could you try the attached replacement for FastPermute.xs, and let me > know > whether it works (or if not, how it fails)?
It works ;) Thank you very much and sorry for the delay, Murat --- Installing perl extension Checking if your kit is complete... Looks good Writing Makefile for Algorithm::FastPermute Microsoft (R) Program Maintenance Utility Version 7.00.9466 Copyright (C) Microsoft Corporation. All rights reserved. cp perms.pl blib\lib\Algorithm\perms.pl cp FastPermute.pm blib\lib\Algorithm\FastPermute.pm Z:\www\perl\bin\perl.exe Z:\www\perl\lib\ExtUtils/xsubpp - typemap Z:\www\perl\lib\ExtUtils\typemap FastPermute.xs > FastPermute.xsc && Z:\www\perl\bin\perl .exe -MExtUtils::Command -e mv FastPermute.xsc FastPermute.c cl -c -nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 - D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED - DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DU SE_PERLIO -DPERL_MSVCRT_READFIX -pg -DVERSION=\"0.05\" - DXS_VERSION=\"0.05\" "-IZ:\www\perl\lib\CORE" FastPermute.c cl : Command line warning D4002 : ignoring unknown option '-pg' FastPermute.c Running Mkbootstrap for Algorithm::FastPermute () Z:\www\perl\bin\perl.exe -MExtUtils::Command -e chmod 644 FastPermute.bs Z:\www\perl\bin\perl.exe -MExtUtils::Mksymlists -e "Mksymlists ('NAME'=>\"Algorithm::FastPermute\", 'DLBASE' => 'FastPermute', 'DL_FUNCS' => { }, 'FUNCLIST' => [], 'IMPORTS' => { }, 'DL_VARS' => []);" link - out:blib\arch\auto\Algorithm\FastPermute\FastPermute.dll -dll -nologo - nodefaultlib -debug -opt:ref,icf -libpath:"z:\www\perl\lib\CORE" - machine:x86 FastPermute.obj Z:\www\perl\lib\CORE\perl58.lib oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut 32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib -def:FastPermute.def Creating library blib\arch\auto\Algorithm\FastPermute\FastPermute.lib and object blib\arch\auto\Algorithm\FastPermute\FastPermute.exp Z:\www\perl\bin\perl.exe -MExtUtils::Command -e chmod 755 blib\arch\auto\Algorithm\FastPermute\FastPermute.dll Z:\www\perl\bin\perl.exe -MExtUtils::Command -e cp FastPermute.bs blib\arch\auto\Algorithm\FastPermute\FastPermute.bs Z:\www\perl\bin\perl.exe -MExtUtils::Command -e chmod 644 blib\arch\auto\Algorithm\FastPermute\FastPermute.bs Z:\www\perl\bin\perl.exe "-Iblib\lib" "-Iblib\arch" test.pl 1..8 ok 1 ok 2 ok 3 ok 4 ok 5 ok 6 ok 7 ok 8