Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Bidirectional lookup algorithm? (Judy)

by Anonymous Monk
on Jan 12, 2015 at 00:07 UTC ( [id://1112913]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Bidirectional lookup algorithm? (Judy)
in thread Bidirectional lookup algorithm? (Updated: further info.)

Ok, i gave it another shot, seems to work, ought to work on strawberry provided you have msys ... the commands
md C:\dev\judyjudy cd C:\dev\judyjudy wget -c http://cpan.metacpan.org/authors/id/J/JJ/JJORE/Alien-Judy-0.27 +.tar.gz wget -c http://cpan.metacpan.org/authors/id/J/JJ/JJORE/Judy-0.41.tar.g +z tar -zxvf Alien-Judy-0.27.tar.gz cd Alien-Judy-0.27-new\src\judy-1.0.5 C:\citrusperl\mingw\msys\bin\sh.EXE configure --enable-static --disabl +e-shared prefix=C:/dev/judyjudy/judyprefix C:\citrusperl\mingw\msys\bin\make.EXE install cd C:\dev\judyjudy tar -zxvf Judy-0.41.tar.gz patch -p0 -i Judy-0.41-new.patch cd Judy-0.41 perl Build.PL build.bat test

The Judy-0.41-new.patch

diff -ruN Judy-0.41/Build.PL Judy-0.41-new/Build.PL --- Judy-0.41/Build.PL 2012-09-23 21:38:01 -0700 +++ Judy-0.41-new/Build.PL 2015-01-11 15:59:00 -0800 @@ -40,7 +40,7 @@ 'Config' => 0, 'Sub::Exporter' => 0, - 'Alien::Judy' => '0.26', +#~ 'Alien::Judy' => '0.26', }, create_readme => 1, @@ -50,8 +50,8 @@ # ACTION_build so the PERL5LIB of the moment can affect the usage # of -I and -L flags to find Judy.h and libJudy.so # - include_dirs => [], - extra_linker_flags => '', + include_dirs => [ 'C:/dev/judyjudy/judyprefix/include/' ], + extra_linker_flags => ' -LC:\dev\judyjudy\judyprefix\lib C:\de +v\judyjudy\judyprefix\lib\libJudy.a ', ); $build->create_build_script(); diff -ruN Judy-0.41/inc/My/Builder.pm Judy-0.41-new/inc/My/Builder.pm --- Judy-0.41/inc/My/Builder.pm 2012-09-23 21:38:01 -0700 +++ Judy-0.41-new/inc/My/Builder.pm 2015-01-11 15:53:22 -0800 @@ -75,31 +75,31 @@ $self->{properties}{include_dirs} = \ @new_include_dirs; - my @old_extra_linker_flags = @{ $self->extra_linker_flags() || [] + }; - my @new_extra_linker_flags = unique( - ( - map { "-L$_" } - @all_dirs - ), - '-lJudy', - ); - if ( "@old_extra_linker_flags" ne "@new_extra_linker_flags" ) { - local $" = q{', '}; - print "$action: extra_linker_flags='@{new_extra_linker_flags} +'\n"; - } - if ( ! grep { /^-L/ } @new_extra_linker_flags ) { - @new_extra_linker_flags = unique( - ( - map { "-L$_" } - @all_dirs - ), - '-lJudy' - ); - local $" = q{', '}; - print "$action: I couldn't resolve -lJudy in any of the below + listed places.\n"; - print "$action: extra_linker_flags='@{new_extra_linker_flags} +'\n"; - } - $self->{properties}{extra_linker_flags} = \ @new_extra_linker_fla +gs; +#~ my @old_extra_linker_flags = @{ $self->extra_linker_flags() || + [] }; +#~ my @new_extra_linker_flags = unique( +#~ ( +#~ map { "-L$_" } +#~ @all_dirs +#~ ), +#~ '-lJudy', +#~ ); +#~ if ( "@old_extra_linker_flags" ne "@new_extra_linker_flags" ) +{ +#~ local $" = q{', '}; +#~ print "$action: extra_linker_flags='@{new_extra_linker_fla +gs}'\n"; +#~ } +#~ if ( ! grep { /^-L/ } @new_extra_linker_flags ) { +#~ @new_extra_linker_flags = unique( +#~ ( +#~ map { "-L$_" } +#~ @all_dirs +#~ ), +#~ '-lJudy' +#~ ); +#~ local $" = q{', '}; +#~ print "$action: I couldn't resolve -lJudy in any of the be +low listed places.\n"; +#~ print "$action: extra_linker_flags='@{new_extra_linker_fla +gs}'\n"; +#~ } +#~ $self->{properties}{extra_linker_flags} = \ @new_extra_linker_ +flags; $self->dispatch( 'config_data' ); diff -ruN Judy-0.41/lib/Judy.pm Judy-0.41-new/lib/Judy.pm --- Judy-0.41/lib/Judy.pm 2012-09-23 21:38:01 -0700 +++ Judy-0.41-new/lib/Judy.pm 2015-01-11 15:53:22 -0800 @@ -6,12 +6,12 @@ $VERSION = '0.41'; -require Alien::Judy; -my $av_version = Alien::Judy->VERSION; -if ( $av_version < 0.18 ) { - die "Alien::Judy version 0.18 required--this is only version $av_ +version"; -} -Alien::Judy::dl_load_libjudy(); +#~ require Alien::Judy; +#~ my $av_version = Alien::Judy->VERSION; +#~ if ( $av_version < 0.18 ) { +#~ die "Alien::Judy version 0.18 required--this is only version $ +av_version"; +#~ } +#~ Alien::Judy::dl_load_libjudy(); # Now load the Perl wrapper over libJudy local @ISA = 'DynaLoader';

All tests pass except for the odd Judy-0.41\t\41typemap.t which tries to compile Judy-0.41/t/MAGIC/lib/MAGIC.xs ... which would have to be patched similarly but I didn't bother

Replies are listed 'Best First'.
Re^4: Bidirectional lookup algorithm? (Judy)
by syphilis (Archbishop) on Jan 12, 2015 at 11:01 UTC
    C:\citrusperl\mingw\msys\bin\sh.EXE configure --enable-static --disable-shared prefix=C:/dev/judyjudy/judyprefix
    C:\citrusperl\mingw\msys\bin\make.EXE install


    Have you built a 64-bit Windows build of Judy-1.0.5 ?
    I had no trouble with 32-bit Windows builds, but with the 64-bit build I get lots of the following warnings:
    warning: right shift count >= width of type [enabled by default]
    and
    warning: left shift count >= width of type [enabled by default]
    Pretty early on, make reports the following errors:
    JudyLInsArray.c:137:5: error: initializer element is not constant JudyLInsArray.c:137:5: error: (near initialization for 'subexp_mask[5] +') JudyLInsArray.c:138:5: warning: left shift count >= width of type [ena +bled by default] ~cJU_POP0MASK(6), ^ JudyLInsArray.c:138:5: error: initializer element is not constant JudyLInsArray.c:138:5: error: (near initialization for 'subexp_mask[6] +') JudyLInsArray.c:139:5: warning: left shift count >= width of type [ena +bled by default] ~cJU_POP0MASK(7), ^ JudyLInsArray.c:139:5: error: initializer element is not constant JudyLInsArray.c:139:5: error: (near initialization for 'subexp_mask[7] +')
    which, of course, soon leads to:
    make[3]: *** [JudyLInsArray.lo] Error 1 make[3]: Leaving directory `/c/_64/comp/judy-1.0.5/src/JudyL' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/c/_64/comp/judy-1.0.5/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/c/_64/comp/judy-1.0.5' make: *** [all] Error 2
    I had a quick but unsuccessful attempt to google up something about these errors.
    Do you happen to know what the fix is ?

    Cheers,
    Rob

      From the Judy Arrays web page:

      The Judy family of functions supports fully dynamic arrays. These arrays may be indexed by a 32- or 64-bit word (depending on processor word size), a null terminated string or an array-of-bytes plus length. A dynamic array (sparsely populated) can also be thought of as a mapping function or associative memory.

      A Word_t is a typedef unsigned long int in Judy.h and must be the same size as sizeof(void *) I.E. a pointer.

      unsigned long int is a 4-byte integer on 64-bit Windows.

      This seems to be the 64-bit data model difference between Windows (LLP64) and *nix (LP64) raising its ugly head.

      Word_t should be typedef'd as long long in order to ensure that sizeof(Word_t) == sizeof(void*) on both platforms.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked
        Word_t should be typedef'd as long long

        typedef'ing to unsigned long long reduces the number of "shift count >= width" warnings. I now see only warnings in relation to left shifts.
        Anyway, there's obviously something else that's not the right size. (Disappointing that the Judy developers haven't ported this correctly.)

        I'm thinking that the "initializer element is not constant" errors must arise from some other issue.
        Before I go digging myself, I'll wait for a bit and see if anonymonk (or anyone else) knows what needs to be done.

        Cheers,
        Rob

        A long long typedef would break your assumption on x32 ABI. Fortunately, there is a type that should fit the bill exactly. You can use typedef ptrdiff_t Word_t; (and ssize_t is almost always the same size as well).

        $ echo | gcc -mx32 -dM -E - | grep SIZEOF
        

        Funny about the JU_LEASTBYTESMASK macro—it still doesn't appear quite right. Diligently the BITSPERBYTE is incorporated, but then, in the same definition, the 0x100 constant assumes 8 bits per byte ...

Re^4: Bidirectional lookup algorithm? (Judy)
by BrowserUk (Patriarch) on Jan 12, 2015 at 00:34 UTC
    ... ought to work on strawberry provided you have msys ...

    Thanks for your efforts.

    Unfortunately, getting a completely different version and flavour of perl + mingw + msys into my customer's set up is a fight I just don't need.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked
      FWIW these are the memory savings as reported by pslist
      it begins 0.734375 WVM: 21976 { WS: 5948 VM: 3164 } after perl add 2.078125 WVM: 157152 { WS: 120132 VM: 117276 } after perl get 0.75 WVM: 157152 { WS: 120140 VM: 117276 } after free perl 1.5 WVM: 153184 { WS: 74936 VM: 72072 } it begins 0.4375 WVM: 21976 { WS: 5948 VM: 3164 } after jAdd 3.734375 WVM: 50648 { WS: 35500 VM: 32644 } after jGet 3.84375 WVM: 50648 { WS: 35512 VM: 32644 } after jFree 1.171875 WVM: 50716 { WS: 7988 VM: 5092 }

      And the Judy code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-03-29 09:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found