[Distutils] Using boost with distutils (fwd)

Pearu Peterson pearu at cens.ioc.ee
Wed Mar 7 04:26:06 EST 2001


Hi!

I am trying to use distutils with boost (www.boost.org) on MD 7.0 Linux
and with gcc 2.95.2.

When compiling/linking C++ codes, distutils uses gcc compiler. But then
importing shared module fails (it cannot find `cerr').
When I manually used g++ for compiling/linking, import succeeded.

Now I use the following code fragment
++++++++++++++++++++++++++++++++++++++++++++++
from distutils import sysconfig
save_init_posix = sysconfig._init_posix
def my_init_posix():
    print 'my_init_posix: changing gcc to g++'
    save_init_posix()
    g = sysconfig._config_vars
    g['CC'] = 'g++'
    g['LDSHARED'] = 'g++ -shared'
sysconfig._init_posix = my_init_posix
+++++++++++++++++++++++++++++++++++++++++++++
in my setup.py file.

I am wondering if there is a "nicer" way to change compiler and
linker program in setup.py?

If a package contains both C and C++ codes, then the above will not
work. Any ideas how to build such mixed extension modules?

I'll appreciate an example setup.py that uses boost.

Pearu


_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG at python.org
http://mail.python.org/mailman/listinfo/distutils-sig





More information about the Python-list mailing list