Robert:

   Now I am understanding, in the William Stein's example he could get an 
executable hw:
   Now I can in fact do: cython --embed hw.py without any complains
   but when I try to gcc-compile, I got a message involving the main (see 
below), so I thought
   that this feature is not working for me:

sage subshell$ rm hw.c
/home/george
sage subshell$ ls hw*
hw0.py    hw.py  hw.so
/home/george
sage subshell$ cython --embed hw.py
/home/george
sage subshell$ ls hw*
hw0.py    hw.c  hw.py  hw.so
/home/george
sage subshell$ gcc -I /opt/sage-4.2.1/local/include/python2.6 
/opt/sage-4.2.1/local/lib/libpython2.6.a -o hw hw.c
/tmp/ccGXE0bt.o: In function `__pyx_pf_2hw_hello_world':
hw.c:(.text+0x3c): undefined reference to `_Py_NoneStruct'
hw.c:(.text+0x43): undefined reference to `_Py_NoneStruct'
hw.c:(.text+0x4e): undefined reference to `_Py_NoneStruct'
hw.c:(.text+0x150): undefined reference to `PyObject_GetAttr'
hw.c:(.text+0x1df): undefined reference to `PyObject_GetAttr'
hw.c:(.text+0x262): undefined reference to `PyTuple_New'
hw.c:(.text+0x2d8): undefined reference to `PyObject_Call'
hw.c:(.text+0x396): undefined reference to `PyTuple_New'
hw.c:(.text+0x487): undefined reference to `_Py_NoneStruct'
hw.c:(.text+0x48e): undefined reference to `_Py_NoneStruct'
hw.c:(.text+0x499): undefined reference to `_Py_NoneStruct'
/tmp/ccGXE0bt.o: In function `__Pyx_InitGlobals':
hw.c:(.text+0x5ea): undefined reference to `PyInt_FromLong'
/tmp/ccGXE0bt.o: In function `inithw':
hw.c:(.text+0x692): undefined reference to `PyTuple_New'
hw.c:(.text+0x736): undefined reference to `Py_InitModule4_64'
hw.c:(.text+0x78e): undefined reference to `PyImport_AddModule'
hw.c:(.text+0x7e6): undefined reference to `PyObject_SetAttrString'
hw.c:(.text+0x839): undefined reference to `PyObject_SetAttrString'
hw.c:(.text+0x91a): undefined reference to `PyObject_SetAttr'
hw.c:(.text+0x9f5): undefined reference to `PyObject_RichCompare'
hw.c:(.text+0xb6c): undefined reference to `PyObject_Call'
/tmp/ccGXE0bt.o: In function `main':
hw.c:(.text+0xd22): undefined reference to `Py_SetProgramName'
hw.c:(.text+0xd27): undefined reference to `Py_Initialize'
hw.c:(.text+0xd38): undefined reference to `PySys_SetArgv'
hw.c:(.text+0xd42): undefined reference to `PyErr_Occurred'
hw.c:(.text+0xd53): undefined reference to `PyErr_Print'
hw.c:(.text+0xd58): undefined reference to `Py_FlushLine'
hw.c:(.text+0xd61): undefined reference to `PyErr_Clear'
hw.c:(.text+0xda0): undefined reference to `Py_Finalize'
/tmp/ccGXE0bt.o: In function `__Pyx_Import':
hw.c:(.text+0xdf2): undefined reference to `PyObject_GetAttrString'
hw.c:(.text+0xe1c): undefined reference to `PyList_New'
hw.c:(.text+0xe3e): undefined reference to `PyModule_GetDict'
hw.c:(.text+0xe4e): undefined reference to `PyDict_New'
hw.c:(.text+0xe86): undefined reference to `PyObject_CallFunctionObjArgs'
/tmp/ccGXE0bt.o: In function `__Pyx_GetName':
hw.c:(.text+0xf72): undefined reference to `PyObject_GetAttr'
hw.c:(.text+0xf84): undefined reference to `PyExc_NameError'
hw.c:(.text+0xf93): undefined reference to `PyErr_SetObject'
/tmp/ccGXE0bt.o: In function `__Pyx_GetStdout':
hw.c:(.text+0xfab): undefined reference to `PySys_GetObject'
hw.c:(.text+0xfbd): undefined reference to `PyExc_RuntimeError'
hw.c:(.text+0xfca): undefined reference to `PyErr_SetString'
/tmp/ccGXE0bt.o: In function `__Pyx_Print':
hw.c:(.text+0x1016): undefined reference to `PyFile_SoftSpace'
hw.c:(.text+0x102b): undefined reference to `PyFile_WriteString'
hw.c:(.text+0x1068): undefined reference to `PyFile_WriteObject'
hw.c:(.text+0x109b): undefined reference to `PyString_AsString'
hw.c:(.text+0x10ab): undefined reference to `PyString_Size'
hw.c:(.text+0x110a): undefined reference to `PyFile_SoftSpace'
hw.c:(.text+0x113c): undefined reference to `PyFile_WriteString'
hw.c:(.text+0x1158): undefined reference to `PyFile_SoftSpace'
/tmp/ccGXE0bt.o: In function `__Pyx_AddTraceback':
hw.c:(.text+0x11ae): undefined reference to `PyString_FromString'
hw.c:(.text+0x11ea): undefined reference to `PyString_FromFormat'
hw.c:(.text+0x11fc): undefined reference to `PyString_FromString'
hw.c:(.text+0x121a): undefined reference to `PyModule_GetDict'
hw.c:(.text+0x1238): undefined reference to `PyString_FromStringAndSize'
hw.c:(.text+0x12bf): undefined reference to `PyCode_New'
hw.c:(.text+0x12d1): undefined reference to `_PyThreadState_Current'
hw.c:(.text+0x12e9): undefined reference to `PyFrame_New'
hw.c:(.text+0x130d): undefined reference to `PyTraceBack_Here'
/tmp/ccGXE0bt.o: In function `__Pyx_InitStrings':
hw.c:(.text+0x1490): undefined reference to `PyUnicodeUCS4_DecodeUTF8'
hw.c:(.text+0x14b8): undefined reference to `PyString_InternFromString'
hw.c:(.text+0x14e3): undefined reference to `PyString_FromStringAndSize'
/tmp/ccGXE0bt.o: In function `__Pyx_PyObject_IsTrue':
hw.c:(.text+0x152e): undefined reference to `_Py_TrueStruct'
hw.c:(.text+0x1540): undefined reference to `_Py_ZeroStruct'
hw.c:(.text+0x154f): undefined reference to `_Py_NoneStruct'
hw.c:(.text+0x156b): undefined reference to `PyObject_IsTrue'
collect2: ld returned 1 exit status
/home/george
sage subshell$ 

   That's why I used setup.py instead, but then I end with a .so file,
    very little in size compared with the one William got:
    sage subshell$ ls -lh hw.so
    -rwxr-xr-x 1 george george 39K 2009-11-21 21:38 hw.so
 .
   And also that's why in his example, within the sage shell he just type:
   ./hw 
   and got it running, but when I try this:   
bash: ./hw: No such file or directory
   and I supposed that I had to add the extension and end with the Segmentation 
fault message.

   Just to get rid of my curiosity, could you see what am I missing to finish 
the compilation?

> You can't "run" an .so file, it's a shared object library, meant to be  
> loaded into another program. (That's why we have --embed or  
> cython_freeze stuff.)
> 

> Excellent.
> 
> 
> Or is it that you have a bunch of python modules that you have  
> installed into your old Sage that you want to use from the new one?  
> The easiest (and safest) way would be to re-install them inside the  
> new Sage, but you could also try copying the relevant subdirectories  
> of site-packages over.
> 
   This last one is my case,
 I'll try to re-install them as soon as I get armed with enough time and 
patience.
> - Robert

Best regards,
Jorge
                                          
_________________________________________________________________
Que todos sigan tus pasos en Windows Live
www.messengernews.com.mx

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to