How does sysconfig.get_config_vars() get config info...

venkatbo at yahoo.com venkatbo at yahoo.com
Sat Oct 14 04:46:56 CEST 2006


Hi,

I'm trying to cross compile a C extension - on a i686 linux box,
targeting a ppc-linux box.

  get_config_vars(*args):
     global _config_vars
     if _config_vars is None:
        ...
     else:
        ...
     ...

What I don't understand is, on the first invocation of
get_config_vars(), _config_vars is not None - and how does
it get populated.  According to the comments, the makefile
of the build (i686) python is read for the config info.

However, since my os.name is Tho my system is "posix",
I would expect _posix_init() to get invoked, but it doesn't.
Dropped some prints in all the places where _config_vars
is set, but none get triggered ...

Since its picking up the build (i686) python config info
somewhere, I'm hoping to intervenw and in this cross
compile case, force it to use the makefile of the target
(ppc) python... if only I knew where its being read in...

I even renamed the build (i686) python makefile to see
if I can observe an alternate codepath, but _config_vars
still has the build (i686) python config info.

If only I could get it to look at the target python config
info, I can have it use the linker for the target and build
the target .so... By using the $CC env option, I was
able to have build (i686) python use my cross-gcc (ppc),
so I can generate the .o's for the pcc target... need to
just override the linker to use the cross-linker (ie
cross-gcc itself)...

Any help appreciated...
Thanks much,
/venkat




More information about the Python-list mailing list