What is the content of that -L directory? In particular, does it
contain
a libpython2.7.a static library? On Fedora, we don't ship the
static
vinay@zeta-oneiric-scratch:~/projects/gcc-python-plugin$ ls /usr/lib/python2.7/config/
config.c libpython2.7.a Makefile Setup
config.c.in libpython2.7-pic.a makesetup Setup.config
install-sh libpython2.7.so python.o Setup.local
So it does contain the shared library.
So I think that what might be happening is that in your machine's
builds
the plugin has been statically linking against libpython2.7.a, and only
linking against some subset of that library's symbols, rather than all
of them.
Good analysis, but I'm not sure that's the problem. Specifically, I created a
simple batch file to make python.so which omits the -L:
vinay@zeta-oneiric-scratch:~/projects/gcc-python-plugin$ cat makeit.sh
gcc -I/usr/lib/gcc/i686-linux-gnu/4.6.1/plugin/include -fPIC -O2 -Wall -Werror -g
-I/usr/include/python2.7 -fno-strict-aliasing -DNDEBUG -fwrapv -lpthread -ldl -lutil -lm
-Xlinker -export-dynamic -Wl,-O1 -shared gcc-python.o gcc-python-callgraph.o
gcc-python-cfg.o gcc-python-closure.o gcc-python-function.o gcc-python-gimple.o
gcc-python-location.o gcc-python-option.o gcc-python-parameter.o gcc-python-pass.o
gcc-python-pretty-printer.o gcc-python-rtl.o gcc-python-tree.o gcc-python-variable.o
autogenerated-callgraph.o autogenerated-cfg.o autogenerated-option.o
autogenerated-function.o autogenerated-gimple.o autogenerated-location.o
autogenerated-parameter.o autogenerated-pass.o autogenerated-pretty-printer.o
autogenerated-rtl.o autogenerated-tree.o autogenerated-variable.o -o python.so
The python.so created with this has all Py* symbols as UNDEF, as expected. The only
symbols which aren't UNDEF which match Py* are PyInit_gcc and VEC_XXX_as_PyList, which
look to be parts of the plugin machinery.
In fact, even with the -L added back in, the symbols in python.so are as described above,
so ISTM there is no linking with the static library,
I don't know whether or not I've accidentally introduced a
Fedora-ism
into the Makefile, but given that it appears to work on Gentoo and
Mandriva, perhaps there's something about Ubuntu that's breaking things?
(the Makefile assumes that python-config --ldflags are what's need to
link)
It seems like a fair assumption; it looks as if this is related to differences in our gcc
versions which are either due to one or more of 64-bit vs. 32-bit, 4.6.0 vs. 4.6.1 or
Fedora vs. Ubuntu :-)
I should comment that this is a beta of Ubuntu Oneiric Ocelot I'm running on (and
I'm using it because gcc 4.6 is available there).
I don't think that's an issue; I believe that this just leads
to
duplicate adjacent values in a prioritized list, which is essentially
idempotent.
True, though it is a little untidy. It appears to also be the case on your system, so
maybe it's intentional.
Regards,
Vinay Sajip