On Nov 21, 2009, at 8:16 PM, Jorge E. ´Sanchez Sanchez wrote: > Hi Robert, > > just to tell you that I have built sage-4.2.1 from source (it > took my athlon 64bits 1Gb almost 5 hours), although I cannot embed a > main() with cython --embed hw.pyx I could generate the hw.so file > with the setup.py and finally I could run the hw.so but not from the > sage shell, because when I try > sage -sh > > /opt/sage-4.2.1 > sage subshell$ ./hw.so > Segmentation fault
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.) > after many tries I found: > geo...@george-desktop:/opt/sage-4.2.1$ ls hola* > hola.c hola.pyx hola.so > geo...@george-desktop:/opt/sage-4.2.1$ ls hw* > hw.c hw.py hw.pyc hw.pyx hw.so > geo...@george-desktop:/opt/sage-4.2.1$ rm hw.py hw.pyc ### I > delete the hw.py and hw.pyc to make sure I am taking hw.so > rm: remove write-protected regular file `hw.py'? y > rm: remove write-protected regular file `hw.pyc'? y > geo...@george-desktop:/opt/sage-4.2.1$ sage > > ---------------------------------------------------------------------- > | Sage Version 4.2.1, Release Date: > 2009-11-14 | > | Type notebook() for the GUI, and license() for > information. | > > ---------------------------------------------------------------------- > sage: import hola > Hooooola q tal!!! > sage: import hw > sage: from hw import * > sage: hello_world() > Welcome to Sage - 2^4 * 37 * 151 > sage: exit > Exiting SAGE (CPU time 0m0.07s, Wall time 0m43.36s). So it sounds like you got it working then. > So I go back to my sage-4.1 installation and tried to make the > corresponding imports: > > geo...@george-desktop:~$ mv hw.py hw0.py > geo...@george-desktop:~$ sage0 > > ---------------------------------------------------------------------- > | Sage Version 4.1, Release Date: > 2009-07-09 | > | Type notebook() for the GUI, and license() for > information. | > > ---------------------------------------------------------------------- > sage: from hw import * > sage: hello_world() > Welcome to Sage - 2^4 * 37 * 151 > sage: !ls helloworld* > helloworld.c helloworld.pyx helloworld.so > sage: import helloworld > Hooooola q tal!!! > sage: exit > Exiting SAGE (CPU time 0m0.06s, Wall time 2m21.93s). > > Then there is something I have not understood about how to run this > *.so files. However this is all what I need. Excellent. > A barely connected question I have is that: now I have the new > sage-4.2 installed I would like to just define a python path in the > new site-packages pointing to the old one but I don't know what > happens with the other files in /opt/sage4.1/local/bin and /../lib, > do I need to make a logical link also?, is this a correct fast and > easy way to do this? or I need to recompile and built again all the > stuff. I'm not quite sure I understand your question here. You don't just want to use the site-packages in 4.2.1 from 4.1, as much of the sage stuff in site-packages depends on having the right libraries outside of site-packages. 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. - Robert -- 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