Building Python 2.5.2 for Itanium

C

Christopher

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}=-
 
M

Martin v. Löwis

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
 
C

Christopher

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


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.


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}=-
 
C

Christopher

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}=-
 
M

Martin v. Löwis

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top