[Distutils] changing default compiler
M.-A. Lemburg
mal@lemburg.com
Thu Feb 8 04:51:54 2001
Enrico Sirola wrote:
>
> >>>>> "MA" == M -A Lemburg <mal@lemburg.com> writes:
>
> MA> Enrico Sirola wrote:
> >> Hello, i wrote a C++ extention module, but distutils keep
> >> trying to compile it as a plain C interface one. Is t possible
> >> it's confused by my strange platform name?
> >>
> >> from sys import platform print platform
> >>
> >> gives out
> >>
> >> linux2
> >>
> >> This is prolly non standard, but maybe it's becouse i'm using a
> >> beta distro (progeny debian)... Anyway everithing works if i
> >> run compiler commands by hand (changing gcc to g++) and finally
> >> type "python setup.py install". So, how can i force distutils
> >> to use g++ instead of gcc?
>
> <*slap* self>
> I was wrong... on standard debian platforms python has the same
> behavior and everything works fine in distutils.
>
> MA> Try the --compiler option to the build_ext command. Note that
> MA> build_ext is not yet up to compiling C++ code. For gcc a
> MA> simple renaming of the source file to .cc or .cxx will let gcc
> MA> compile the file as C++ without any additional options.
>
> i just tried, but --compiler let me choose 'unix' only (and then it
> chooses gcc instead of g++).
Dang, you're right.
C++ support should go on the TODO list
then... it should either auto-detect C vs. C++ depending on the
filename or provide an option --c++ for explicitely using a
C++ compiler.
> there's another strange behavior:
> the directories under build/ have the following names:
> lib.linux2/
> temp.linux2/
> and prolly should be
> lib.linux-i686-1.5/
> temp.linux-i686-1.5/
> How do distutils select buid-directory names? This could be a good
> starting point..
Well, it uses distutils.util.get_platform() which uses sys.platform
as fall-back on Unix if the os module doesn't define uname(). On SuSE
I get correct names (linux-i586).
Could you verify this ?
--
Marc-Andre Lemburg
______________________________________________________________________
Company: http://www.egenix.com/
Consulting: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/