Re: libglib-perl fails to build from source on mips(el), ia64 andalpha



On Friday, January 23, 2004, at 12:16 PM, Marc 'HE' Brockschmidt wrote:

"muppet" <scott asofyet org> writes:
the build log shows what looks a crash in perl while running xsdoc2pod after building everything. basically, this script loads the shiny new module and
queries the GLib type system for proper names of things for writing
documentation.  could you send a stack trace?

No, the build happens automatically on a system not available to me. I
think you should be able to use the machines in the sf.net compile farm
to track this down on alpha.

[much mucking about later]

the problem appears to be *tada* portability issues, namely, the differences between 64-bit values and 32-bit values.

we added calls to GLib's GPOINTER_TO_UINT / GUINT_TO_POINTER macros all over the place in gtk2-perl to help mitigate some portability issues for x86_64 not too long ago. these seem to work great on x86_64 and also on mips (your mips build logs showed problems only with tests that needed to be skipped for glib bugs), but appears to cause all hell to break loose on alpha.

the actual culprit: the Glib module stores GType <=> Perl package mappings in GHashTables; GHashTable actually stores gpointer to gpointer mappings; thus we use the following call to extract a GType from our mapping table:

        type = (GType) GPOINTER_TO_UINT
                         (g_hash_table_lookup (types_by_package, package));

however, GPOINTER_TO_UINT is defined differently per platform; on the particular alpha machine i was using to investigate this, it was

        #define GPOINTER_TO_UINT(p)     ((guint) (gulong) (p))

and on that platform, a gpointer is 8 bytes, a gulong is 8 bytes, a GType is 8 bytes, and a guint is 4 bytes. thus, GPOINTER_TO_UINT strips the top 4 bytes from the 8-byte value, and we then re-assign that to an 8-byte value.

this has the effect of making the GType value completely invalid, causing Very Bad Things to happen when we pass it on down to glib.


as proof, when i removed the macro calls and used plain old casts, everything was perfect.


i have asked the gtk-devel-list if there's something else we should be using instead of GPOINTER_TO_UINT for GType <=> pointer conversions. in the meantime, i propose that we define and use our own macros,

        #define GPOINTER_TO_GTYPE(p)    (platform-dependent definition)


comments?

--
Holy crap, dude, we have kids!
        -- Elysse, six days after giving birth to twins




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]