[python-nl] Compile python extension

Ronald Oussoren ronaldoussoren at mac.com
Wed Oct 11 15:14:22 CEST 2006

On Wednesday, October 11, 2006, at 02:43PM, Martijn de Munnik <cologuns at xs4all.nl> wrote:

>I'm trying to build/install pysqlite on a Solaris 10 platform. I've got
>Sun Studio 11 on a AMD 64 platform and got this error. I'm a python newbie
>and just want to install trac. I've got ActiveState python:

This seems to be a bug in distutils, triggered by the %-signs in your CFLAGS. The easiest way to work around this is to change the CFLAGS and CXXFLAGS in your environment, just remove the options containing %-signs. Those seem to be related to optimization and I don't think those will affect the performance of pysqlite very much.

A more permanent fix is change /opt/python/lib/python2.4/distutils/spawn.py" line 122, insert "%s" as the first argument of the call to log.info. This might not be the only place that requires changes.


P.S. please file a bug at http://www.sf.net/projects/python to ensure that this will get fixed in a future release of  python.

>ActivePython 2.4.3 Build 11 (ActiveState Software Inc.) based on
>Python 2.4.3 (#1, Apr  3 2006, 18:07:58) [C] on sunos5
>Type "help", "copyright", "credits" or "license" for more information.
>And sqlite build with the following options ./configure
>--prefix=/opt/64/sqlite --enable-threadsafe --disable-tcl
>my environment looks like this:
>CFLAGS=-xO3 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil
>-xlibmopt -xtarget=opteron -xarch=amd64 -xregs=no%frameptr
>CXXFLAGS=-xO3 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all
>-xlibmil -xlibmopt -xtarget=opteron -xarch=amd64 -xregs=no%frameptr
>LDFLAGS=-xtarget=opteron -xarch=amd64
>and setyp.cfg looks like this
>/opt/sqlite is a symlink to /opt/64/sqlite
>and finally the build command:
>% python setup.py build
>running build
>running build_py
>running build_ext
>building 'pysqlite2._sqlite' extension
>Traceback (most recent call last):
>  File "setup.py", line 159, in ?
>    main()
>  File "setup.py", line 156, in main
>    setup(**get_setup_args())
>  File "/opt/python/lib/python2.4/distutils/core.py", line 149, in setup
>    dist.run_commands()
>  File "/opt/python/lib/python2.4/distutils/dist.py", line 946, in
>    self.run_command(cmd)
>  File "/opt/python/lib/python2.4/distutils/dist.py", line 966, in
>    cmd_obj.run()
>  File "/opt/python/lib/python2.4/distutils/command/build.py", line 112,
>in run
>    self.run_command(cmd_name)
>  File "/opt/python/lib/python2.4/distutils/cmd.py", line 333, in run_command
>    self.distribution.run_command(command)
>  File "/opt/python/lib/python2.4/distutils/dist.py", line 966, in
>    cmd_obj.run()
>  File "/opt/python/lib/python2.4/distutils/command/build_ext.py", line
>279, in run
>    self.build_extensions()
>  File "/opt/python/lib/python2.4/distutils/command/build_ext.py", line
>405, in build_extensions
>    self.build_extension(ext)
>  File "/opt/python/lib/python2.4/distutils/command/build_ext.py", line
>470, in build_extension
>    depends=ext.depends)
>  File "/opt/python/lib/python2.4/distutils/ccompiler.py", line 699, in
>    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
>  File "/opt/python/lib/python2.4/distutils/unixccompiler.py", line 112,
>in _compile
>    self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
>  File "/opt/python/lib/python2.4/distutils/ccompiler.py", line 1040, in
>    spawn (cmd, dry_run=self.dry_run)
>  File "/opt/python/lib/python2.4/distutils/spawn.py", line 37, in spawn
>    _spawn_posix(cmd, search_path, dry_run=dry_run)
>  File "/opt/python/lib/python2.4/distutils/spawn.py", line 122, in
>    log.info(string.join(cmd, ' '))
>  File "/opt/python/lib/python2.4/distutils/log.py", line 33, in info
>    self._log(INFO, msg, args)
>  File "/opt/python/lib/python2.4/distutils/log.py", line 23, in _log
>    print msg % args
>TypeError: not enough arguments for format string
>I've got the same issues with mysql and postgresql extensions, any ideas???
>BTW anybody succesfully compiled python on Solaris using Sun Studio?
>Python-nl mailing list
>Python-nl at python.org

More information about the Python-list mailing list