Ask Your Question
0

Cython command 'gcc' failed with exit status 1

asked 2010-12-15 12:13:51 -0500

Eviatar Bach gravatar image

updated 2010-12-15 18:05:50 -0500

Hello,

Trying to use Cython from the Sage Notebook. I put in the following code from Planet Sage:

%cython

def sum_cython(long n):
    cdef long i, s = 0
    for i in range(n):
        s += i
    return s

However, it fails with this error:

/usr/bin/ld: cannot find -lstdc++ collect2: ld returned 1 exit status error: command 'gcc' failed with exit status 1

I have libstdc++ 6 installed, so why is this happening?

Thank you.

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
0

answered 2010-12-15 14:51:07 -0500

Mike Witt gravatar image

updated 2010-12-16 07:55:12 -0500

It works for me with: Sage Version 4.6 / Fedora 14 / libstdc++ 4.5.1 (i686) For whatever that's worth.

edit flag offensive delete link more

Comments

No luck here. :(

Eviatar Bach gravatar imageEviatar Bach ( 2010-12-15 18:03:49 -0500 )edit

Just out of curiosity do you get any different result from the Sage command line? (With the cython in a separate .spyx file)

Mike Witt gravatar imageMike Witt ( 2010-12-16 05:22:44 -0500 )edit

Thank you, it works there. Still, it would be nice to use it from the notebook.

Eviatar Bach gravatar imageEviatar Bach ( 2010-12-16 14:04:25 -0500 )edit
0

answered 2010-12-16 14:59:16 -0500

Eviatar Bach gravatar image

updated 2010-12-16 14:59:43 -0500

The problem was caused by me running Sage from another directory. It works if I run it from the installation directory.

edit flag offensive delete link more

Comments

Maybe this is a silly question, but is the SAGE_ROOT variable set properly (near the top of the "sage" script in the installation directory)?

Mike Witt gravatar imageMike Witt ( 2010-12-16 15:46:35 -0500 )edit

Yes, it was. If it wasn't, Sage wouldn't work at all. I created a soft link and it worked perfectly, though. I'm wondering now why the "different install location with SAGE_ROOT" option exists, if soft links work just as well.

Eviatar Bach gravatar imageEviatar Bach ( 2010-12-16 18:26:54 -0500 )edit

I *think* sage still needs that path, even if you have a link pointing to the script. But I'm no expert.

Mike Witt gravatar imageMike Witt ( 2010-12-17 09:01:05 -0500 )edit

But SAGE_ROOT is only for running Sage from another directory. Look at your sage executable in the main folder, it shouldn't have SAGE_ROOT set unless you did so yourself.

Eviatar Bach gravatar imageEviatar Bach ( 2010-12-17 09:31:56 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2010-12-15 12:13:51 -0500

Seen: 1,357 times

Last updated: Dec 16 '10