为什么Sage不会编译我的代码?

时间:2012-02-23 21:05:41

标签: cython sage

Sage应该能够使用Cython创建编译代码。我从来没有能够让这个工作。问题似乎与我的Sage安装有关,因为编译失败了所包含的示例。我不相信我在安装过程中做了什么特别的事情,但显然我有些不对劲。 Sage tutorial

  

为了制作自己编译的Sage代码,请为该文件指定.spyx扩展名(而不是.sage)。如果您正在使用命令行界面,则可以像解释代码一样附加和加载已编译的代码(此时,笔记本界面不支持附加和加载Cython代码)。实际的编译是在“幕后”完成的,无需你做任何明确的事情。有关直接使用GMP C库的阶乘函数的编译实现的示例,请参阅$ SAGE_ROOT / examples / programming / sagex / factorial.spyx。要自己尝试一下,请cd到$ SAGE_ROOT / examples / programming / sagex /,然后执行以下操作:

sage: load "factorial.spyx"

当我尝试时,我收到以下消息:

  

编译./factorial.spyx ...   编译cython文件时出错:   编译./factorial.spyx时出错:   运行构建   运行build_ext   建立'_home_oliver_Desktop_sage_4_7_1_linux_32bit_ubuntu_10_04_lts_i686_Linux_examples_programming_sagex_factorial_spyx_0'扩展   创建构建   创建build / temp.linux-i686-2.6   gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -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 / oliver / Desktop / 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_10_04_lts_i686_Linux_examples_programming_sagex_factorial_spyx_0.o -w -O2   创建build / lib.linux-i686-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 / local / lib -lmpfr -lgmp -lgmpxx -lstdc ++ -lpari -lm -lcurvesntl -lg0nntl -ljcntl -lrankntl -lgsl -lgslcblas -latlas -lntl -lcsage -lpython2 .6 -o build / lib.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.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

有什么建议吗?感谢。

1 个答案:

答案 0 :(得分:2)

根据DSM的评论,我重新安装了g ++ - multilib,现在一切正常。