Ask Your Question
1

Cython command 'gcc' failed with exit status 1

asked 2010-12-15 19:13:51 +0100

Eviatar Bach gravatar image

updated 2010-12-16 01:05:50 +0100

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
1

answered 2010-12-16 21:59:16 +0100

Eviatar Bach gravatar image

updated 2010-12-16 21:59:43 +0100

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 22:46:35 +0100 )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-17 01:26:54 +0100 )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 16:01:05 +0100 )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 16:31:56 +0100 )edit
0

answered 2010-12-15 21:51:07 +0100

Mike Witt gravatar image

updated 2010-12-16 14:55:12 +0100

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-16 01:03:49 +0100 )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 12:22:44 +0100 )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 21:04:25 +0100 )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 19:13:51 +0100

Seen: 2,314 times

Last updated: Dec 16 '10