Some additional data points:
I copied libpython2.7.so to the project directory (which is on my LD_LIBRARY_PATH), but
python.so still can't be loaded because of a missing symbol _Py_ZeroStruct, which is
defined in libpython2.7.so.
However, if I do LD_PRELOAD=libpython2.7.so make, then most things work correctly: 105
test successes, 4 test failures. So: for some reason, when running within gcc/cc1, the
libpython2.7.so isn't being loaded, despite being in the cwd and LD_LIBRARY_PATH (+
presumably known to ld via ldconfig, as /usr/lib/python2.7/config also contains
libpython2.7.so).
I ran tests under strace and ltrace - failure is occurring on a
dlopen('python.so') call.
You might want to document that pygments is a requirement for running the tests - without
it being installed, you get many more failures.
Regards,
Vinay Sajip
----- Original Message -----
From: David Malcolm <dmalcolm(a)redhat.com>
To: Vinay Sajip <vinay_sajip(a)yahoo.co.uk>;
gcc-python-plugin(a)lists.fedorahosted.org
Cc:
Sent: Tuesday, 6 September 2011, 23:52
Subject: Re: Problems with loading python.so
On Tue, 2011-09-06 at 23:19 +0100, Vinay Sajip wrote:
> I've just checked out the project from source and tried building on
> Ubuntu (using gcc 4.6.1-9ubuntu2). Everything compiles and links OK,
> but when I try to load python.so, it fails because a symbol is
> undefined: "cfun". I see that cfun is declared in
> plugin/include/function.h:
>
> extern GTY(()) struct function * cfun;
>
> but I don't know where it's meant to be defined. I presume it's
meant
> to be part of gcc, and from the docs, any gcc 4.6 should work; can any
> one shed any light on this?
On my machine (Fedora 15), within
gcc-4.6.0-20110603/gcc/function.c
I see:
/* The currently compiled function. */
struct function *cfun = 0;
as lines 123-124.
Looking within:
$ eu-readelf -s /usr/bin/gcc | grep cfun
on this box I don't see "cfun", but it _is_ present within
/usr/libexec/gcc/x86_64-redhat-linux/4.6.0/cc1
/usr/libexec/gcc/x86_64-redhat-linux/4.6.0/cc1plus
/usr/libexec/gcc/x86_64-redhat-linux/4.6.0/f951
so it seems like it's only present in the actual compiler parts of the
toolchain (language frontend+optimizer+write-out-assembler-backend), not
in the "gcc" harness.
How are you invoking the plugin?
Hope this is helpful
Dave