Menu

#159 setup.py should compile .cpp files with g++ rather than gcc

v1.7.1.0
closed
None
5
2016-12-05
2015-03-13
No

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.

Discussion

  • Jack Howarth

    Jack Howarth - 2015-03-13

    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.

     
  • Jack Howarth

    Jack Howarth - 2015-03-13

    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++.

     
  • Thomas Holder

    Thomas Holder - 2015-03-14

    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"'.

     
  • Thomas Holder

    Thomas Holder - 2016-12-05
    • status: open --> closed
    • assigned_to: Thomas Holder
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.