Movatterモバイル変換
[0]ホーム
[Python-Dev] To -I(nclude) or not to -I(nclude), that is the question...
M.-A. Lemburgmal@lemburg.com
Sat, 19 Oct 2002 12:18:43 +0200
Skip Montanaro wrote:> In installing mxBase 2.0.4 on my MacOS 10.2.1 system I get warnings like the> following:>> gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -Wno-long-double -no-cpp-precomp -Imx/Queue/mxQueue -I/Users/skip/local/include/python2.3 -I/usr/include -I/usr/local/include -c mx/Queue/mxQueue/mxQueue.c -o build/temp.darwin-6.1-Power Macintosh-2.3/mx/Queue/mxQueue/mxQueue/mxQueue.o> cc1: warning: changing search order for system directory "/usr/local/include"> cc1: warning: as it has already been specified as a non-system directory> cc1: warning: changing search order for system directory "/usr/include"> cc1: warning: as it has already been specified as a non-system directory>> This warning bothers me a bit, as it suggests I'm screwing up the compiler's> notions about header file search order. Has anyone else seen this and> investigated how to get rid of this problem?I've had a few bug reports related to this, but all of themwere from Solaris users. The -I/usr/include causes the GCC compilerto pick up a system stdarg.h header file which causes a compileerror (GCC ships with its own stdarg.h files).The report for MacOS is new, though. Perhaps this is a generic GCC problem ?(#include <stdarg.h> should look in the compiler dirs first and onlythen scan the additional -I paths)> This is related to bug>http://python.org/sf/589427 (which was assigned to me). It's due to the> gen_preprocess_options() function in distutils/ccompiler.py. This warning> seems to be related to gcc version >= 3.1.>> I have a quick hack in my local copy of distutils/ccompiler.py. At the> bottom of gen_preprocess_options() I replaced>> for dir in include_dirs:> pp_opts.append ("-I%s" % dir)>> with>> pp_opts.extend (gen_preprocess_includes(include_dirs))>> and added these two functions to the file:>> def gen_preprocess_includes_macosx_gcc(dirs):> """GCC on MacOSX complains if /usr/include or /usr/local/include are> mentioned in -I.> """> pp_opts = []> for dir in dirs:> if dir not in ("/usr/include", "/usr/local/include"):> pp_opts.append ("-I%s" % dir)> return pp_opts>> def gen_preprocess_includes(dirs):> """Generate the -I flags for a compile command."""> if sys.platform == "darwin":> return gen_preprocess_includes_macosx_gcc(dirs)>> pp_opts = []> for dir in dirs:> pp_opts.append ("-I%s" % dir)> return pp_opts>> This is an obscure solution, at best. I'd prefer to at least test the> compiler and version. How can I tell what compiler and version will be used> to compile files, or can't I can this level? (Seems to me that> gen_preprocess_options begs to be a method of the CCompiler class.)>> Thx,>> Skip>> _______________________________________________> Python-Dev mailing list>Python-Dev@python.org>http://mail.python.org/mailman/listinfo/python-dev-- Marc-Andre LemburgCEO eGenix.com Software GmbH_______________________________________________________________________eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...Python Consulting:http://www.egenix.com/Python Software:http://www.egenix.com/files/python/
[8]ページ先頭