forum.vmspython.org Forum Index forum.vmspython.org
Forum system
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

cython on Itanium V8.4

 
Post new topic   Reply to topic    forum.vmspython.org Forum Index -> Python for OpenVMS
View previous topic :: View next topic  
Author Message
Colin Brown



Joined: 11 Oct 2012
Posts: 18
Location: Wellington, NZ

PostPosted: Thu Oct 11, 2012 11:58 pm    Post subject: cython on Itanium V8.4 Reply with quote

Running OpenVMS V8.4 on Itanium I am trying to use cython.

So far (ODS2 partition):
HELLOWORLD.PYX:
print 'Hello World'

SETUP.PY:
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
setup(
cmdclass = {'build_ext': build_ext},
ext_modules = [Extension("HelloWorld", ["HelloWorld.pyx"])]
)

$python setup.py build_ext
running build_ext
skipping 'HelloWorld.c' Cython extension (up-to-date)
Traceback (most recent call last):
File "setup.py", line 8, in <module>

File "/python_root/lib/distutils/core.py", line 152, in setup
dist.run_commands()
File "/python_root/lib/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/python_root/lib/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/python_root/local/Cython/Distutils/build_ext.py", line 135, in run
_build_ext.build_ext.run(self)
File "/python_root/lib/distutils/command/build_ext.py", line 339, in run
self.build_extensions()
File "/python_root/local/Cython/Distutils/build_ext.py", line 143, in build_extensions
self.build_extension(ext)
File "/python_root/lib/distutils/command/build_ext.py", line 459, in build_extension
ext_path = self.get_ext_fullpath(ext.name)
File "/python_root/lib/distutils/command/build_ext.py", line 636, in get_ext_fullpath
filename = self.get_ext_filename(ext_name)
File "/python_root/lib/distutils/command/build_ext.py", line 679, in get_ext_filename
return os.path.join(*ext_path) + so_ext
TypeError: cannot concatenate 'str' and 'NoneType' objects

However HELLOWORLD.C is built.

$cc /include=python_include/accept=novaxc_keywords HELLOWORLD.C

builds HELLOWORLD.OBJ

$link/share HELLOWORLD.OBJ
%ILINK-W-NUDFSYMS, 32 undefined symbols:
%ILINK-I-UDFSYM, PYCODE_NEW
%ILINK-I-UDFSYM, PYDICT_NEW
%ILINK-I-UDFSYM, PYERR_OCCURRED
%ILINK-I-UDFSYM, PYERR_SETSTRING
%ILINK-I-UDFSYM, PYERR_WARNEX
%ILINK-I-UDFSYM, PYEXC_IMPORTERROR
%ILINK-I-UDFSYM, PYEXC_OVERFLOWERROR
%ILINK-I-UDFSYM, PYEXC_RUNTIMEERROR
%ILINK-I-UDFSYM, PYEXC_TYPEERROR
%ILINK-I-UDFSYM, PYFILE_SOFTSPACE
%ILINK-I-UDFSYM, PYFILE_WRITEOBJECT
%ILINK-I-UDFSYM, PYFILE_WRITESTRING
%ILINK-I-UDFSYM, PYFRAME_NEW
%ILINK-I-UDFSYM, PYIMPORT_ADDMODULE
%ILINK-I-UDFSYM, PYMODULE_GETDICT
%ILINK-I-UDFSYM, PYOBJECT_SETATTR
%ILINK-I-UDFSYM, PYOBJECT_SETATTRSTRING
%ILINK-I-UDFSYM, PYOS_SNPRINTF
%ILINK-I-UDFSYM, PYSTRING_FROMFORMAT
%ILINK-I-UDFSYM, PYSTRING_FROMSTRING
%ILINK-I-UDFSYM, PYSTRING_FROMSTRINGANDSIZE
%ILINK-I-UDFSYM, PYSTRING_INTERNFROMSTRING
%ILINK-I-UDFSYM, PYSYS_GETOBJECT
%ILINK-I-UDFSYM, PYTRACEBACK_HERE
%ILINK-I-UDFSYM, PYTUPLE_NEW
%ILINK-I-UDFSYM, PYUNICODEUCS4_DECODEUTF8
%ILINK-I-UDFSYM, PY_GETVERSION
%ILINK-I-UDFSYM, PY_INITMODULE4
%ILINK-I-UDFSYM, _PYTHREADSTATE_CURRENT
%ILINK-I-UDFSYM, _PY_NONESTRUCT
%ILINK-I-UDFSYM, _PY_TRUESTRUCT
%ILINK-I-UDFSYM, _PY_ZEROSTRUCT

Any help on where and how to include the undefined symbols please?
Back to top
View user's profile Send private message
jfp



Joined: 12 Jul 2004
Posts: 633

PostPosted: Fri Oct 12, 2012 7:02 am    Post subject: Reply with quote

Colin,
A small running example:
Code:
$ type def hello_world():
     import sys
     print "Welcome to Python %d.%d!" % sys.version_info[:2]

if __name__ == '__main__':
     hello_world()


How to build the extension:
Code:
$ cython hw.pyx


Code:
$ python /python_vms/build_module.py hw


Code:
$ python
Python 2.7.3+ (default, Apr 20 2012, 20:06:26) [DECC] on OpenVMS
Type "help", "copyright", "credits" or "license" for more information.
>>> import hw
>>> hw.hello_world()
Welcome to Python 2.7!
>>> exit()
$


The use of a ODS2 partition may lead to various problems, if you don't have any ODS5 devices, you can create a small on using LD.

If I remember correctly, the distutils problem is know and has been fixed, you can take a look at http://forum.vmspython.org/viewtopic.php?t=268.

JF
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Colin Brown



Joined: 11 Oct 2012
Posts: 18
Location: Wellington, NZ

PostPosted: Sat Oct 13, 2012 12:50 am    Post subject: Reply with quote

Hi Jean

Brilliant! Your sample code worked a treat on ODS-2 file system.

Thanks
Colin
Back to top
View user's profile Send private message
jescab



Joined: 28 Jan 2008
Posts: 254

PostPosted: Sat Oct 13, 2012 7:05 pm    Post subject: Reply with quote

OK, since the original question now is solved, maybe I might add a few new... Smile

I've seen the cython web page so I think I know the "thing" with it.

Is this something that I'm supposed to install separately or is it included in the prebuild packages in some way?

Jan-Erik.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vmspython.org Forum Index -> Python for OpenVMS All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group