Current pymol svn only links _cmd.so with g++. The transition to c++ would be smoother if the setup.py were modified to compile the .cpp source files with the g++ compiler rather than gcc.
It appears that the pymol's setup.py is overriding ccompiler and thus losing the ability to automatically use the appropriate compiler for the given suffix of source file...
# Default language settings. language_map is used to detect a source
# file or Extension target language, checking source filenames.
# language_order is used to detect the language precedence, when deciding
# what language to use when mixing source types. For example, if some
# extension has two files with ".c" extension, and one with ".cpp", it
# is still linked as c++.
language_map = {".c" : "c",
".cc" : "c++",
".cpp" : "c++",
".cxx" : "c++",
".m" : "objc",
}
language_order = ["c++", "objc", "c"]
from distutils/ccompiler.py.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What exactly is the pymol setup.py doing that disables the language mapping? If I prune down the setup.py to not use the custom CCompiler, it still defaults to gcc rather than cc or c++.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I don't think that pymol's setup.py does anything to the language mapping. The "distutils" package seems to be quite incomplete with respect to specific C++ support. I usually test on Gentoo, Ubuntu, Macports and Fink. Only Gentoo - which has a heavily patched distutils - takes my CXX and CXXFLAGS environment variables. My GCC versions need -std=c++11 or -std=c++0x to compile the current PyMOL code correct, I pass them with CPPFLAGS since CXXFLAGS doesn't work (expect on Gentoo). On OSX, fink and macports use clang by default and don't need the -std=c++11 argument, but acutally fail on c files (yes there are some) if I pass the argument with CPPFLAGS.
Bottom line: Works for me on OSX without any environment variables, and on Linux with 'export CPPFLAGS="-std=c++0x"'.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It appears that the pymol's setup.py is overriding ccompiler and thus losing the ability to automatically use the appropriate compiler for the given suffix of source file...
from distutils/ccompiler.py.
What exactly is the pymol setup.py doing that disables the language mapping? If I prune down the setup.py to not use the custom CCompiler, it still defaults to gcc rather than cc or c++.
I don't think that pymol's setup.py does anything to the language mapping. The "distutils" package seems to be quite incomplete with respect to specific C++ support. I usually test on Gentoo, Ubuntu, Macports and Fink. Only Gentoo - which has a heavily patched distutils - takes my CXX and CXXFLAGS environment variables. My GCC versions need -std=c++11 or -std=c++0x to compile the current PyMOL code correct, I pass them with CPPFLAGS since CXXFLAGS doesn't work (expect on Gentoo). On OSX, fink and macports use clang by default and don't need the -std=c++11 argument, but acutally fail on c files (yes there are some) if I pass the argument with CPPFLAGS.
Bottom line: Works for me on OSX without any environment variables, and on Linux with 'export CPPFLAGS="-std=c++0x"'.
Since r4133, "monkeypatch_distutils.py" takes care of this.
https://sourceforge.net/p/pymol/code/HEAD/tree/trunk/pymol/monkeypatch_distutils.py