First time here? Check out the FAQ!

Ask Your Question
1

Cython command 'gcc' failed with exit status 1

asked 14 years ago

Eviatar Bach gravatar image

updated 14 years ago

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.

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
1

answered 14 years ago

Eviatar Bach gravatar image

updated 14 years ago

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

Preview: (hide)
link

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 ( 14 years ago )

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 ( 14 years ago )

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 ( 14 years ago )

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 ( 14 years ago )
0

answered 14 years ago

Mike Witt gravatar image

updated 14 years ago

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

Preview: (hide)
link

Comments

No luck here. :(

Eviatar Bach gravatar imageEviatar Bach ( 14 years ago )

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 ( 14 years ago )

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

Eviatar Bach gravatar imageEviatar Bach ( 14 years ago )

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: 14 years ago

Seen: 2,326 times

Last updated: Dec 16 '10