Building Python 2.5.2 for Itanium

Discussion in 'Python' started by Christopher, Nov 21, 2008.

  1. Christopher

    Christopher Guest

    Hello,

    A tool that we use needs to be ported to Itanium. It wsa written
    for Python 2.5.2, and so I was happily using the Itanium version of
    that release. However, as I have gotten deeper into the port, I see
    that ctypes was not included with the Itanium Python 2.5.2 release.

    I need to compile that module for that release and platform, but I
    have been unable to discover which MS compiler version and runtime was
    used to generate the binaries. My understanding is that Python 2.5.2
    in general uses Visual Studio 2003, but MS does not appear to have
    shipped an Itanium compiler with that version of VS.

    I know that there is an Itanium compiler in VS2K5 Team System, and
    also a pre-release version was shipped with the Windows 2003 SP1
    Platform SDK. However, the compiler in the SDK appears to basically
    be an earlier version of the VS2K5 compiler.

    When I run setup.py build, the distutils die b/c it is apparently
    not the right compiler version.

    I am basically looking for some direction w/r to the compiler
    environment needed to build modules loadable by Python 2.5.2,
    Itanium.

    Thanks!
    -={C}=-
    Christopher, Nov 21, 2008
    #1
    1. Advertising

  2. > I need to compile that module for that release and platform, but I
    > have been unable to discover which MS compiler version and runtime was
    > used to generate the binaries. My understanding is that Python 2.5.2
    > in general uses Visual Studio 2003, but MS does not appear to have
    > shipped an Itanium compiler with that version of VS.


    That's correct. See PCbuild/readme.txt for (somewhat) detailed
    instructions; in essence, you need to use vsextcomp, if you want to
    use the official build process.

    > I know that there is an Itanium compiler in VS2K5 Team System, and
    > also a pre-release version was shipped with the Windows 2003 SP1
    > Platform SDK.


    I don't think that is a pre-release. The SDK had been shipping with
    an Itanium compiler for quite some time, and it is the official compiler
    to build binaries for Win64/IA-64 (to my knowledge, it is the compiler
    that Windows itself was built with).

    > However, the compiler in the SDK appears to basically
    > be an earlier version of the VS2K5 compiler.


    That might be. The more critical issue is what CRT to link with.
    I had been building the Python Itanium binaries always with the SDK
    compiler (of different SDKs, actually); the SDK then would always
    link with msvcrt.dll. If you use VS2K5, you might end up linking
    with a different CRT, which would be bad.

    > When I run setup.py build, the distutils die b/c it is apparently
    > not the right compiler version.


    Correct. distutils is not used for building on Windows.

    Wrt. the original issue: I am quite skeptical that you can make ctypes
    work on Win64/IA-64. There is are several reasons why it wasn't build,
    such as it doesn't compile, and, if it would compile, it wouldn't work.
    So prepare to do some porting of libffi. Alternatively, rewrite the code
    that requires ctypes to use a plain extension module, which is probably
    easier to port to Itanium.

    Regards,
    Martin
    Martin v. Löwis, Nov 21, 2008
    #2
    1. Advertising

  3. Christopher

    Christopher Guest

    On Nov 21, 3:50 pm, "Martin v. Löwis" <> wrote:
    > >   I need to compile that module for that release and platform, but I
    > > have been unable to discover which MS compiler version and runtime was
    > > used to generate the binaries.  My understanding is that Python 2.5.2
    > > in general uses Visual Studio 2003, but MS does not appear to have
    > > shipped an Itanium compiler with that version of VS.

    >
    > That's correct. See PCbuild/readme.txt for (somewhat) detailed
    > instructions; in essence, you need to use vsextcomp, if you want to
    > use the official build process.
    >
    > >   I know that there is an Itanium compiler in VS2K5 Team System, and
    > > also a pre-release version was shipped with the Windows 2003 SP1
    > > Platform SDK.

    >
    > I don't think that is a pre-release. The SDK had been shipping with
    > an Itanium compiler for quite some time, and it is the official compiler
    > to build binaries for Win64/IA-64 (to my knowledge, it is the compiler
    > that Windows itself was built with).
    >
    > > However, the compiler in the SDK appears to basically
    > > be an earlier version of the VS2K5 compiler.

    >
    > That might be. The more critical issue is what CRT to link with.
    > I had been building the Python Itanium binaries always with the SDK
    > compiler (of different SDKs, actually); the SDK then would always
    > link with msvcrt.dll. If you use VS2K5, you might end up linking
    > with a different CRT, which would be bad.
    >
    > >   When I run setup.py build, the distutils die b/c it is apparently
    > > not the right compiler version.

    >
    > Correct. distutils is not used for building on Windows.
    >
    > Wrt. the original issue: I am quite skeptical that you can make ctypes
    > work on Win64/IA-64. There is are several reasons why it wasn't build,
    > such as it doesn't compile, and, if it would compile, it wouldn't work.
    > So prepare to do some porting of libffi. Alternatively, rewrite the code
    > that requires ctypes to use a plain extension module, which is probably
    > easier to port to Itanium.
    >
    > Regards,
    > Martin


    Thank you very much. I appreciate the information. I will look into
    the libffi porting, but it probably will be more time-efficient to
    create a native-code module to hit the functions I need. I appreciate
    your responding.

    -={C}=-
    Christopher, Nov 23, 2008
    #3
  4. Christopher

    Christopher Guest

    On Nov 21, 3:50 pm, "Martin v. Löwis" <> wrote:
    > >   I need to compile that module for that release and platform, but I
    > > have been unable to discover which MS compiler version and runtime was
    > > used to generate the binaries.  My understanding is that Python 2.5.2
    > > in general uses Visual Studio 2003, but MS does not appear to have
    > > shipped anItaniumcompiler with that version of VS.

    >
    > That's correct. See PCbuild/readme.txt for (somewhat) detailed
    > instructions; in essence, you need to use vsextcomp, if you want to
    > use the official build process.



    I am trying to follow the official build process. I installed
    vsextcomp, and it appears to work fine. However, I have a number of
    resource errors when I try to build pythoncore.

    My first error was:


    Compiling resources...
    \Python-2.5.2\Pc\python_nt.rc(35) : error RC2104 : undefined keyword
    or key name: MS_DLL_ID

    So I remarked out the String table section:

    STRINGTABLE DISCARDABLE
    BEGIN
    1000, MS_DLL_ID
    END

    then I got:

    Compiling resources...
    \Python-2.5.2\Pc\python_nt.rc(44) : error RC2104 : undefined keyword
    or key name: FIELD3

    So I removed FIELD3 from:

    #define PYVERSION64 PY_MAJOR_VERSION, PY_MINOR_VERSION, FIELD3,
    PYTHON_API_VERSION

    Finally, I received:

    Compiling resources...
    \Python-2.5.2\Pc\python_nt.rc(65) : error RC2104 : undefined keyword
    or key name: PYTHON_DLL_NAME

    ----

    Having so many errors I began to suspect something else had failed.

    Lo and behold! --

    Performing Custom Build Step
    '.\make_versioninfo.exe' is not recognized as an internal or external
    command,
    operable program or batch file.
    Project : error PRJ0019: A tool returned an error code from
    "Performing Custom Build Step"

    ---

    I had to manually build make_version.exe, which seems to have
    generated those fields. I'm not sure what the problem was with the
    build of make_version. The only error I could find was "unable to
    create response file."

    I experienced the same problem with make_buildinfo. After manually
    building it, I was able to build pythoncore.

    I am now looking into getting ctypes to build correctly. My
    investigations show that ctypes supports ia64, so I may be able to
    make some progress on this front.

    -={C}=-
    Christopher, Nov 24, 2008
    #4
  5. > Lo and behold! --
    >
    > Performing Custom Build Step
    > '.\make_versioninfo.exe' is not recognized as an internal or external
    > command,
    > operable program or batch file.
    > Project : error PRJ0019: A tool returned an error code from
    > "Performing Custom Build Step"


    Hmm. make_versioninfo.exe should *not* be compiled with the Itanium
    compiler - it should be an x86 binary.

    > I had to manually build make_version.exe, which seems to have
    > generated those fields. I'm not sure what the problem was with the
    > build of make_version. The only error I could find was "unable to
    > create response file."


    Unfortunately, debugging vsextcomp is quite tricky. Python was its
    only application ever, so it hasn't seen much testing.

    > I am now looking into getting ctypes to build correctly. My
    > investigations show that ctypes supports ia64, so I may be able to
    > make some progress on this front.


    Good luck!

    Martin
    Martin v. Löwis, Nov 24, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bernhard Mulder
    Replies:
    4
    Views:
    281
    Martin v. =?iso-8859-15?q?L=F6wis?=
    Nov 3, 2003
  2. =?ISO-8859-15?Q?Bernard_Delm=E9e?=

    python 2.3 + cx_oracle on HP-UX Itanium

    =?ISO-8859-15?Q?Bernard_Delm=E9e?=, May 18, 2005, in forum: Python
    Replies:
    0
    Views:
    424
    =?ISO-8859-15?Q?Bernard_Delm=E9e?=
    May 18, 2005
  3. Sion Roberts

    HP/UX Itanium C comiler & std C

    Sion Roberts, Nov 15, 2004, in forum: C Programming
    Replies:
    20
    Views:
    785
    Dan Pop
    Nov 17, 2004
  4. Replies:
    16
    Views:
    595
    Martin v. Löwis
    Nov 23, 2008
  5. Replies:
    6
    Views:
    1,371
    Lawrence D'Oliveiro
    May 21, 2009
Loading...

Share This Page