[SciPy-dev] Building newcore with the intel compilers on Itanium2...

Fernando Perez Fernando.Perez at colorado.edu
Thu Nov 3 00:42:03 CST 2005


Fernando Perez wrote:

>  From looking at the code, I wonder if it's just a matter of overriding the 
> link() method in ccompiler, to honor the CC env. variable (as a start).  I may 
> have a go at it, at least out of curiosity...

OK, just for informational purposes...  I overrode the link() method in 
unixccompiler.py in a similar manner to the others, and just added this hack 
on top (I just copied the existing method from std.distutils):

def UnixCCompile_link(self, target_desc, objects,
          output_filename, output_dir=None, libraries=None,
          library_dirs=None, runtime_library_dirs=None,
          export_symbols=None, debug=0, extra_preargs=None,
          extra_postargs=None, build_temp=None, target_lang=None):

     print '* fperez'
     self.linker_so[:] = ['icc','-shared']


With this, it all works fine (meaning, a straight install passes all tests 
without needing any manual hacking).

Now, I understand _perfectly_ that this is not the kind of hack that can go 
into something permanent, and I don't pretend to understand distutils even a 
.1% of how much Pearu knows about it.  But at least this shows that it's 
feasible to somehow allow different linker selections for shared library building.

Could we perhaps add a --linker option to setup.py?  If given, it would simply 
be used to build the compiler.linker_so call list.  This is not the same as 
implementing the full compiler machinery that exists for Fortran compilers, 
but perhaps this is a case where 'good enough beats perfect'.  It would allow 
users to link using icc and keep their regular python, with all the attending 
benefits of that.

Since icc is explicitly known to be strongly binarly compatible with gcc 
(quoting the icc manpage):

    gcc* Interoperability
        C language object files created with the Intel C++ Compiler are  binary
        compatible  with  the  GNU* gcc* compiler and glibc, the GNU C language
        library.  This binary compatibility results in the following  key  fea-
        tures:

        o   C  objects generated by icc are interoperable with C objects gener-
            ated by gcc.

        o   C++ objects generated by icpc  using  the  -cxxlib-gcc  option  are
            interoperable  with  C++ objects generated by g++.  This means that
            third-party C++ libraries built by gcc++ will work with C++ objects
            generated by the Intel C++ Compiler 8.0.

        o   C++  objects generated by icpc without using the -cxxlib-gcc option
            are not guaranteed to be interoperable with C++  objects  generated
            by g++.

        o   Preprocessor macros predefined by gcc are also predefined by icc.

        The  Intel  C++  Compiler 8.0 has made significant improvements towards
        interoperability and compatibility with the GNU gcc compiler.  See  the
        Intel C++ Compiler User's Guide for more information.


this might be a reasonable compromise solution.  If those who know distutils 
better than me approve, I'm even willing to do the implementation work (for a 
simple approach, not for building a full machinery like the FCompiler system). 
  I figure I should at least do something useful :)

Cheers,

f




More information about the Scipy-dev mailing list