Erick:

Well I confess, I have never tried Judy in an Iphone.  I don't know much of the
details of that build environment, but from the looks of the information provided, 
I think you probably have a 32/64 bit compile problem.  So I will ramble a bit.

1) The -DJU_32BIT or -DJU_64BIT compile flag must be correct.

2) JudyLTables.c is build from the JudyTables.c program and the proper table 32 bit
tables can be build if that flag is set properly.  I.E.
>    cc  -DJU_32BIT -I. -I.. -I../JudyCommon -DJUDYL JudyLTablesGen.c -o GenTable
>    GenTable
 will generate a correct 32 bit  "JudyLTable.c" in a 32bit or 64bit compile.

3) Your errors below suggest you have tried to compile for 32 bit, but some of the components
were compiled with the -DJU_64BIT flag set in a 32 bit compile environment.

4)  Since the standard way of building Judy does not work in cross environments, I use the
script: "sh_build" in the "src" directory to build 32 bit Judy in a 64 bit machine.  For example:
I just built and ran a 32 bit Judy on this 64 bit MacBook Air machine I am typing this letter to you.
Using the sh_build script with COPT='-O -m32' set in the sh_build script (executing from the src
directory).

5) Those warnings are NOT safe to ignore.

Good luck and I hope you have success with Judy on an iphone.

Doug Baskins <dougbaskins@yahoo.com>


From: Erick Tryzelaar <erick.tryzelaar@gmail.com>
To: judy <judy-devel@lists.sourceforge.net>
Sent: Wednesday, April 20, 2011 10:09 PM
Subject: Re: JudyTables causing some problems for cross compiling

Hello,

I think I've found a problem with the JudyTables.c code generator. I
was having some trouble trying to cross compile judy for the iphone.
Unfortunately, I was running into the following malloc error:

flx_pkgconfig(70749) malloc: *** error for object 0x100954: incorrect
checksum for freed object - object was probably modified after being
freed.
*** set a breakpoint in malloc_error_break to debug
flx_pkgconfig(70749) malloc: *** error for object 0x1014b4: incorrect
checksum for freed object - object was probably modified after being
freed.
*** set a breakpoint in malloc_error_break to debug
flx_pkgconfig(70749) malloc: *** error for object 0x1014ce: pointer
being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

The stack trace suggested that this was somehwere within judy:

#0  0x934c8f6a in malloc_error_break ()
#1  0x934ca114 in szone_error ()
#2  0x934ca287 in free_list_checksum_botch ()
#3  0x933d71a6 in tiny_malloc_from_free_list ()
#4  0x933d62c1 in szone_malloc_should_clear ()
#5  0x933d6168 in malloc_zone_malloc ()
#6  0x933d4238 in malloc ()
#7  0x0004ab83 in JudyMalloc (Words=3) at
src/judy/src/JudyCommon/JudyMalloc.c:43
#8  0x0004281a in j__udyLAllocJBBJP (NumJPs=1, Pjpm=0x1004b0) at
build/iphone-simulator/debug/src/judy/src/JudyL/JudyLMallocIF.c:255
#9  0x0003855d in j__udyStageJBBtoJBB (PjpLeaf=0x1005f8,
PStageJBB=0xbfffe234, PjpArray=0xbfffe134, PSubCount=0xbfffe304
"\023", Pjpm=0x1004b0) at
build/iphone-simulator/debug/src/judy/src/JudyL/JudyLCascade.c:272
#10 0x00039911 in j__udyLCascade3 (Pjp=0x1005f8, Pjpm=0x1004b0) at
build/iphone-simulator/debug/src/judy/src/JudyL/JudyLCascade.c:902
#11 0x00040c62 in j__udyInsWalk (Pjp=0x1005f8, Index=1050192,
Pjpm=0x1004b0) at
build/iphone-simulator/debug/src/judy/src/JudyL/JudyLIns.c:804
#12 0x00041a25 in j__udyInsWalk (Pjp=0x1005f8, Index=1050192,
Pjpm=0x1004b0) at
build/iphone-simulator/debug/src/judy/src/JudyL/JudyLIns.c:1650
#13 0x000422b8 in JudyLIns (PPArray=0x1001a8, Index=1050192,
PJError=0x1001b8) at
build/iphone-simulator/debug/src/judy/src/JudyL/JudyLIns.c:1847
#14 0x0001fb71 in flx::gc::collector::flx_collector_t::impl_allocate
(this=0x100170, shape=0x5e9e0, nobj=1) at src/gc/flx_collector.cpp:128
#15 0x000216f9 in flx::gc::collector::flx_ts_collector_t::v_allocate
(this=0x100170, ptr_map=0x5e9e0, x=1) at
src/gc/flx_ts_collector.cpp:16
#16 0x00021430 in flx::gc::generic::collector_t::allocate
(this=0x100170, shape=0x5e9e0, x=1) at flx_gc.hpp:115
#17 0x00021324 in flx::gc::generic::gc_profile_t::allocate
(this=0x100200, shape=0x5e9e0, count=1, allow_gc=true) at
src/gc/flx_gc.cpp:92
#18 0x000213e1 in operator new (amt=8, gcp=@0x100200, shape=@0x5e9e0,
allow_gc=true) at src/gc/flx_gc.cpp:149
#19 0x00008ace in
flxusr::flx_pkgconfig::_i26865_f26865_aux_uncurry::apply
(this=0xbfffe9d8, _arg=@0xbfffe9ec) at
build/iphone-simulator/debug/src/flx_pkgconfig/flx_pkgconfig.cpp:1704
#20 0x00008f81 in flxusr::flx_pkgconfig::add::apply (this=0xbfffeb00,
_arg=@0xbfffeb18) at
build/iphone-simulator/debug/src/flx_pkgconfig/flx_pkgconfig.cpp:1507
#21 0x00010bdd in flxusr::flx_pkgconfig::parse_args::stack_call
(this=0xbfffed1c, _arg=@0xbfffedc8) at
build/iphone-simulator/debug/src/flx_pkgconfig/flx_pkgconfig.cpp:859
#22 0x00010914 in flxusr::flx_pkgconfig::parse_args::stack_call
(this=0xbfffef58, _arg=@0x100274) at
build/iphone-simulator/debug/src/flx_pkgconfig/flx_pkgconfig.cpp:848
#23 0x00015206 in flxusr::flx_pkgconfig::_init_::resume
(this=0x1002f0) at
build/iphone-simulator/debug/src/flx_pkgconfig/flx_pkgconfig.cpp:1024
#24 0x0001d808 in flx::rtl::fthread_t::run (this=0x100330) at
src/rtl/flx_rtl.cpp:113
#25 0x0001ddb9 in flx::run::sync_state_t::frun (this=0xbffff13c) at
src/rtl/flx_sync.cpp:63
#26 0x00002a8d in doflx (data=0x100370) at flx_run.include:99
#27 0x000034ef in run_felix_pthread (debug_driver=false, gcp=0x100200,
thread_control=0xbffff44c, library=0xbffff2c0, instance=0xbffff2d8) at
flx_run.include:323
#28 0x000037e0 in run_felix (debug_driver=false, gcp=0x100200,
thread_control=0xbffff44c, filename=0xbffff5f4
"/Users/erickt/Projects/felix/felix/build/iphone-simulator/debug/bin/flx_pkgconfig",
flx_argc=4, flx_argv=0xbffff4fc) at flx_run.include:466
#29 0x0000453e in main (argc=4, argv=0xbffff4fc) at flx_run.include:681


I think the problem is stemming from the code generator, judytables.
Since I can't run judytables on the iphone, I have to compile it on my
host platform (a 64 bit machine) and have it generate code for the 32
bit iphone. Unfortunately, I think judy is baking in some of the host
platform information into the code it generates. I believe the
culprits are:

src/JudyCommon/JudyTables.c, line 33:
#define BPW sizeof(Word_t)    // define bytes per word

src/Judy.h, line 110:
#ifndef _WORD_T
#define _WORD_T
#if defined(_WIN64)
typedef unsigned long long  Word_t, * PWord_t;  // expect 32-bit or
64-bit words.
#else
typedef unsigned long    Word_t, * PWord_t;  // expect 32-bit or 64-bit words.
#endif
#endif


Would it be safe to just replace the Word_t definition with:

#ifndef _WORD_T
#define _WORD_T
#ifdef JU_64BIT
typedef uint64_t Word_t, * PWord_t;  // expect 32-bit or 64-bit words.
#else
typedef uint32_t Word_t, * PWord_t;  // expect 32-bit or 64-bit words.
#endif
#endif

This gets rid of the error, but then I'm seeing some warnings like:


In file included from src/judy/src/Judy1/Judy1.h:72,
                from
build/iphone-simulator/debug/src/judy/src/Judy1/Judy1TablesGen.c:36:
src/judy/src/JudyCommon/JudyPrivate.h: In function ‘j__udySearchLeaf1’:
src/judy/src/JudyCommon/JudyPrivate.h:1556: warning: large integer
implicitly truncated to unsigned type
src/judy/src/JudyCommon/JudyPrivate.h:1556: warning: comparison is
always false due to limited range of data type
src/judy/src/JudyCommon/JudyPrivate.h: In function ‘j__udySearchLeaf2’:
src/judy/src/JudyCommon/JudyPrivate.h:1563: warning: large integer
implicitly truncated to unsigned type
src/judy/src/JudyCommon/JudyPrivate.h:1563: warning: comparison is
always false due to limited range of data type
src/judy/src/JudyCommon/JudyPrivate.h: In function ‘j__udySearchLeaf3’:
src/judy/src/JudyCommon/JudyPrivate.h:1570: warning: large integer
implicitly truncated to unsigned type
src/judy/src/JudyCommon/JudyPrivate.h:1570: warning: comparison is
always false due to limited range of data type
src/judy/src/JudyCommon/JudyPrivate.h: In function ‘j__udySearchLeafW’:
src/judy/src/JudyCommon/JudyPrivate.h:1609: warning: large integer
implicitly truncated to unsigned type
src/judy/src/JudyCommon/JudyPrivate.h:1609: warning: comparison is
always false due to limited range of data type
build/iphone-simulator/debug/src/judy/src/Judy1/Judy1TablesGen.c: In
function ‘main’:
build/iphone-simulator/debug/src/judy/src/Judy1/Judy1TablesGen.c:219:
warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long
unsigned int’


As best as I can tell, these are safe to ignore, but I'm not positive.
Any help would be appreciated. Thanks.

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve
application availability and disaster protection. Learn more about boosting
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Judy-devel mailing list
Judy-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/judy-devel