Sage应该能够使用Cython创建编译过的代码。我从来没能让这件事起作用。问题似乎与我的Sage安装有关,因为在包含的示例上编译失败。我不认为我在安装过程中做了什么特别的事情,但显然我做错了什么。鼠尾草教程说
为了使您自己编译的Sage代码,给文件一个.spyx扩展名(而不是.sage)。如果您使用的是命令行接口,则可以附加和加载编译后的代码,与解释的代码完全一样(目前,笔记本界面不支持附加和加载Cython代码)。实际编译是“幕后”完成的,而不必做任何明确的操作。有关直接使用GMP库的阶乘函数的编译实现的示例,请参见$SAGE_ROOT/examples/programming/sagex/factorial.spyx。为了自己尝试一下,cd到$SAGE_ROOT/examples/programming/sagex/,然后执行以下操作:
sage: load "factorial.spyx"当我尝试时,我会得到以下信息:
编译。/factorial.spyx..。编译cython文件错误:错误编译./factorial.spyx:运行build运行build_ext构建扩展创建构建创建构建/tem.linux-i 686-2.6 gcc -fno-严格-别名-g -O2 -DNDEBUG -g -O3 -Wall -Wstrict原型-fPIC -I/home/oliver/Desktop/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-Linux/local/include/csage/ -I/home/oliver/Desktop/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-Linux/local/include/ -I/home/oliver/Desktop/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-Linux/local/include/python2.6/ -I/home/奥利弗/桌面/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-Linux/local/lib/python2.6/site-packages/numpy/core/include -I/home/oliver/Desktop/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-Linux/devel/sage/sage/ext/ -I/home/oliver/Desktop/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-Linux/devel/sage/-I/home/oliver/Desktop/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-Linux/devel/sage/sage/gsl/ -I.-I/home/oliver/Desktop/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-Linux/local/include/python2.6 -c _home_oliver_Desktop_sage_4_7_1_linux_32bit_ubuntu_10_04_lts_i686_Linux_examples_programming_sagex_factorial_spyx_0.c -o build/temp.linux-i686-2.6/_home_oliver_Desktop_sage_4_7_1_linux_32bit_ubuntu创建build/lib.linux-i 686-2.6 gcc -pthread -shared build/temp.linux-i686-2.6/_home_oliver_Desktop_sage_4_7_1_linux_32bit_ubuntu_10_04_lts_i686_Linux_examples_programming_sagex_factorial_spyx_0.o -L/home/oliver/Desktop/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-Linux/local//lib/ -L/home/wstein/build/sage-4.7.1/本地/解放、发展和发展、发展和发展(linux-32bit-ubuntu_10.04_lts-i686-Linux/local//lib/)_examples_programming_sagex_factorial_spyx_0.so -L/home/oliver/Desktop/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-Linux/local//lib /usr/bin/ ld :无法找到-lstdc++ collect2: ld返回1个退出状态错误:命令'gcc‘失败,退出状态为1
有什么建议吗?谢谢。
发布于 2012-03-02 21:48:22
根据DSM的评论,我重新安装了g++-multilib,现在一切正常。
https://stackoverflow.com/questions/9421282
复制相似问题