the wxpython package compiles a lot of C++ code using $(CFLAGS) instead of $(CXXFLAGS) # portageq envvar -v CFLAGS CXXFLAGS CFLAGS='-O2 -march=k8 -pipe -Wimplicit-function-declaration' CXXFLAGS='-O2 -march=k8 -pipe' # emerge wxpython ... x86_64-pc-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -march=k8 -pipe -Wimplicit-function- declaration -fPIC -DSWIG_TYPE_TABLE=_wxPython_table -DHAVE_CONFIG_H -DWXP_USE_THREAD=1 -UNDEBUG -DGTK_N O_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DNO_GCC_PRAGMA -Iinclude -Isrc -I/usr/ lib64/wx/include/gtk2-ansi-release-2.6 -I/usr/include/wx-2.6 -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2. 0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/python2.4 -c src/gtk/grid_wrap.cpp -o build-gtk2/temp.linu x-x86_64-2.4/src/gtk/grid_wrap.o cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++ cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++ ...
i took a look at this and i can't find where CFLAGS gets picked up by the build system. the only place that it seems to even look is in config.py: cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1] which still wouldn't use CFLAGS. unless it gets this info from swig somehow.
i'm guessing this is distutils failing /usr/lib/python2.5/distutils/sysconfig.py this checks CFLAGS, CPPFLAGS, and LDFLAGS -- no CXXFLAGS
Created attachment 148178 [details, diff] distutils uses CXXFLAGS instead of CFLAGS for C++ files I added "-include killcpp.h" to CFLAGS, where killcpp.h contained illegal c++ code, but valid c. emerge finished, so I'm pretty sure my solution worked :) I'm pretty sure it's correct, but I hope somebody with more python skills can look it over. I hope nobody minds that I patched against python-2.5.2, but that's what I have installed, and I need some sleep.
Comment on attachment 148178 [details, diff] distutils uses CXXFLAGS instead of CFLAGS for C++ files strangeness crept in
Created attachment 148180 [details, diff] fixed some strange things in my last patch (irrelevant code)
@Mark: nice job. The patch I started working on was meant to do the same but you were a bit faster. I guess it can be included as it is.
where did you get the .c/.m list of types ? there are other types which should go through the C compiler, but i think it may be saner to flip the logic ... hard code the list for C++, and have everything else go through C ... otherwise, thanks, it looks good :)
Created attachment 148946 [details, diff] Better language detection Maybe this is more what you're looking for. I found a function detect_language() that uses a map of extension -> language. Below is a patch from my previous revision to this one.
Created attachment 148947 [details, diff] The difference between last two revisions I made.
ah, very nice ... that looks good to me
+*python-2.5.2 (18 Apr 2008) +*python-2.4.4-r10 (18 Apr 2008) +*python-2.3.6-r5 (18 Apr 2008) + + 18 Apr 2008; Ali Polatel <hawking@gentoo.org> +python-2.3.6-r5.ebuild, + +python-2.4.4-r10.ebuild, +python-2.5.2.ebuild: + Version bumps. Updated patchsets to fix buffer overflow in zlib extension + (CVE-2008-1721) bug 217221 and unsafe PyString_FromStringAndSize(). Added + patch by Mark Peloquin for distutils to respect CXXFLAGS, bug 145206. Add + wininst USE flag to conditionally install MS Windows executables, bug + 198021. Use EAPI=1, rename nothreads and nocxx USE flags to threads and + cxx. + Thanks Mark, I've included your patch to our patchset.
Yikes, this patch breaks distutils if CXXFLAGS is not defined. I discovered it when I tried to compile matplotlib outside of portage. Distutils fails with the following traceback: Traceback (most recent call last): File "setup.py", line 277, in <module> **additional_params File "/usr/lib64/python2.5/distutils/core.py", line 151, in setup dist.run_commands() File "/usr/lib64/python2.5/distutils/dist.py", line 974, in run_commands self.run_command(cmd) File "/usr/lib64/python2.5/distutils/dist.py", line 994, in run_command cmd_obj.run() File "/usr/lib64/python2.5/distutils/command/build.py", line 112, in run self.run_command(cmd_name) File "/usr/lib64/python2.5/distutils/cmd.py", line 333, in run_command self.distribution.run_command(command) File "/usr/lib64/python2.5/distutils/dist.py", line 994, in run_command cmd_obj.run() File "/usr/lib64/python2.5/distutils/command/build_ext.py", line 265, in run customize_compiler(self.compiler) File "/usr/lib64/python2.5/distutils/sysconfig.py", line 177, in customize_compiler cxx_cmd = cxx + ' ' + cxxflags TypeError: cannot concatenate 'str' and 'NoneType' objects If I define CXXFLAGS, I can compile again.
2.5.2-r2 and 2.4.4-r11 fixes that.